Extensions display order - any rules?

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
Zyleta
Registered User
Posts: 41
Joined: Fri Apr 25, 2014 10:59 am

Extensions display order - any rules?

Post by Zyleta »

I have a question, because I'm wondering, how it is with extensions, when they used same EVENT.

I mean, I have 2 extensions: ext1 and ext2, both use same event: example_event.

Is there any rule, that makes one of this extensions to be displayed first? I mean, e.g. ext1 shows "age", ext2 - "group". Is there anything that can change order of displayed extensions? How it works? The first installed extension is 1st, or last when displayed? Any kind of code makes some extensions "more importand" then the other to makes it 1st? It depends on extension name?

User avatar
Zyleta
Registered User
Posts: 41
Joined: Fri Apr 25, 2014 10:59 am

Re: Extensions display order - any rules?

Post by Zyleta »

I makes some tests, but I want a confirm - first of it depends on author name (alphabetical order), then extension name (alphabetical order) - is that true?

And it is possible, to change this order to another one, by adding some code into this extensions, or anything else?

User avatar
david63
Registered User
Posts: 17251
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Extensions display order - any rules?

Post by david63 »

Zyleta wrote:first of it depends on author name (alphabetical order), then extension name (alphabetical order) - is that true?
Yes and no. In practise you will probably find that happening but the "official" answer is that events are loaded in a random order.

You can, however, add a parameter to the items in the getSubscribedEvents() function to specift the order in which events run. There is a topic somewhere about this but I cannot find it at the moment but basically you would have 'core.page_header' => 'array(page_header', 5),

From memory the lower the number the higher it will run - omitting that value mean that it will use the default (99?)
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Zyleta
Registered User
Posts: 41
Joined: Fri Apr 25, 2014 10:59 am

Re: Extensions display order - any rules?

Post by Zyleta »

Ty for Your reply.
So that means, that extensions which adds/change only style (I mean, doesn't have listener, only style folder inside), will have "random order" or I have to add listener to it, if I want control order of them

User avatar
david63
Registered User
Posts: 17251
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Extensions display order - any rules?

Post by david63 »

Zyleta wrote:Ty for Your reply.
So that means, that extensions which adds/change only style (I mean, doesn't have listener, only style folder inside), will have "random order" or I have to add listener to it, if I want control order of them
You cannot control the order of template events
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Zyleta
Registered User
Posts: 41
Joined: Fri Apr 25, 2014 10:59 am

Re: Extensions display order - any rules?

Post by Zyleta »

I mean, control order of extensions, which uses only template events, which uses only style files.
Uhmm.. I mean, as simple as possible extensions, where I don't use listener, when I use only template events.

On example (as simple as possible, but not useble):
I have two extensions.
1. "username_on_index", which uses EVENT index_body_markforums_before and in file index_body_markforums_before.html have only this:

Code: Select all

{S_USERNAME}
2. "welcome_on_index", which also uses EVENT index_body_markforums_before and in file index_body_markforums_before.html have only this:

Code: Select all

Welcome, 
In those two extension, only what I need to work is composer.json, README.md (not needed?), license.txt (not needed?), and styles/prosilver/template/event/index_body_markforums_before.html

But now, I don't have control at the order, and from my tests, I know that it would by displayed like this:

Code: Select all

ZyletaWelcome, 
because "username_on_index" is before "welcome_on_index" (that "random order"), and if I would have it displayed correctly, I can change the name from "welcome_on_index" on e.g. "index_welcome" - the correct would be

Code: Select all

Welcome, Zyleta
But, like You said before
david63 wrote:You can, however, add a parameter to the items in the getSubscribedEvents() function to specift the order in which events run. There is a topic somewhere about this but I cannot find it at the moment but basically you would have 'core.page_header' => 'array(page_header', 5),
but this can't makes the correct order in this situation?

User avatar
david63
Registered User
Posts: 17251
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Extensions display order - any rules?

Post by david63 »

Currently there is no way to do it in core phpBB (and I am not aware that there is anything planned to change that in the immediate future)

There is one possible way around this and that is to put an event within the extension's template file that the other extension can utilise, but that requires the co-operation of both extension developers.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Lumpy Burgertushie
Registered User
Posts: 67240
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Extensions display order - any rules?

Post by Lumpy Burgertushie »

didn't I read somewhere that they would show up in the order they were installed? therefore, you could uninstall them and change the order of installation to get them in the order you wish.


robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?

User avatar
david63
Registered User
Posts: 17251
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Extensions display order - any rules?

Post by david63 »

Lumpy Burgertushie wrote:didn't I read somewhere that they would show up in the order they were installed? therefore, you could uninstall them and change the order of installation to get them in the order you wish.


robert
I think that was a theory in the "early days" of extensions but it most definitely is not the case
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
3Di
Former Team Member
Posts: 14828
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: Extensions display order - any rules?

Post by 3Di »

david63 wrote:
Zyleta wrote:first of it depends on author name (alphabetical order), then extension name (alphabetical order) - is that true?
Yes and no. In practise you will probably find that happening but the "official" answer is that events are loaded in a random order.

You can, however, add a parameter to the items in the getSubscribedEvents() function to specift the order in which events run. There is a topic somewhere about this but I cannot find it at the moment but basically you would have 'core.page_header' => 'array(page_header', 5),

From memory the lower the number the higher it will run - omitting that value mean that it will use the default (99?)
viewtopic.php?p=14468386#p14468386
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
:studio_microphone: Premium extensions @ The Studio

Post Reply

Return to “Extension Writers Discussion”