Page 1 of 2

Alter source list code

Posted: Mon Jun 26, 2017 8:49 pm
by paracosm
Hi there!
Recently our forum upgraded to version 3.2, and with the update, we also noticed that the list button changed.

Previously, when an user would use the "[-list ] text [/list]" code, the list would only show the <li> attribute as default. However, now with the new update, this feature automatically adds bulletpoints to the list.
  • like this
I have taken a look at the bbcode in the source, but it looks quite complicated. Is there any way I can alter the list code back to the one without the default bullet point?

Thanks in advance!
- Paracosm.

Re: Alter source list code

Posted: Tue Jun 27, 2017 8:42 am
by Mick
paracosm wrote:
Mon Jun 26, 2017 8:49 pm
Recently our forum upgraded to version 3.2
Do you mean you upgraded the board yourself or it did it on it's own? If you did it what method did you use?

Re: Alter source list code

Posted: Tue Jun 27, 2017 9:35 am
by paracosm
Someone from our site team updated it from 3.0 to 3.2. I can't tell the exact method as I wasn't there, but I am quite sure the normal protocol has been followed.

However, the list attribute changing seems to be an update with phpbb 3.2, and I just want to set it back to where there are no default bullet points, as the users on our board use the list option to make indents and standard bulletpoints therefore are not desired.

Additionally, we also want to remove that {list } (but with []) returns the list code as well. Only the use of {list} should start the list code if possible.

Re: Alter source list code

Posted: Tue Jun 27, 2017 12:20 pm
by paracosm
In addition, I found a sort of similar thread here, which describes better what I mean.

My question is now, what to do to alter the source code that the 'list=none' is the default setup?

(sorry for double posting)

Re: Alter source list code

Posted: Tue Jun 27, 2017 8:58 pm
by JoshyPHP
You need to create an extension, listen to the core.text_formatter_s9e_configure_after event and set the default value with this:

Code: Select all

$event['configurator']->tags['list']->attributes['type']->defaultValue = 'none';

Re: Alter source list code

Posted: Wed Jun 28, 2017 6:56 am
by paracosm
JoshyPHP wrote:
Tue Jun 27, 2017 8:58 pm
You need to create an extension, listen to the core.text_formatter_s9e_configure_after event and set the default value with this:

Code: Select all

$event['configurator']->tags['list']->attributes['type']->defaultValue = 'none';
Thank you for your answer! Perhaps a silly question but what exactly do you mean with 'create an extension'? Do I need to make an additional file in a directory or something?

Re: Alter source list code

Posted: Wed Jun 28, 2017 7:08 am
by JoshyPHP
Yes. There's probably some documentation on how to create an extension somewhere.

Re: Alter source list code

Posted: Wed Jun 28, 2017 7:17 am
by paracosm
Okay, thank you. I will try to get to work with that then. Do I need to put anything specific in the extension to 'listen' to the event you stated or can I just paste the code? Sorry if these questions are stupid, but I am quite new to phpBB and extensions and all. I honestly just hoped I could override it somewhere in an already existing file ^^"

Re: Alter source list code

Posted: Sun Jul 02, 2017 1:57 pm
by paracosm
Hi there,
So I am trying to make an extension but I am still clueless about what to do exactly. I am trying to follow the tutorial about it, but I don't know where I should put the extension exactly and what file to use. This is the code I have so far:

click here for the code

So my questions are,
1. Where in the root do I need to place my extension? in the /all/ folder?
2. Are there any php files I should put after 'use'? If yes, which ones?
3. Do I need to make more files than this or would this file be sufficient?

Sorry if I ask a lot of questions but I am afraid to mess this up and I don't want that ^^'

Re: Alter source list code

Posted: Sun Jul 02, 2017 2:47 pm
by Toxyy
1) /ext
2) if you need them
3) you'll need more

Take a look at other extensions and go through their files to see what you'll need done.

Re: Alter source list code

Posted: Sun Jul 02, 2017 4:39 pm
by JoshyPHP
paracosm wrote:
Sun Jul 02, 2017 1:57 pm
Sorry if I ask a lot of questions but I am afraid to mess this up and I don't want that ^^'
You should definitely develop your extension on a local installation so you don't have to worry about messing it up.

You can try using this extension as a template. Obviously you'll have to use your own namespace. The LICENSE and README.md files are not required.

Re: Alter source list code

Posted: Sun Jul 02, 2017 5:58 pm
by david63
If you are trying to create an extension then try using this as your starting point - https://www.phpbb.com/customise/db/download/133296

Re: Alter source list code

Posted: Sun Jul 02, 2017 6:17 pm
by JoshyPHP
That extension has 200+ files (excluding the vendor dir) and registers 20+ services. That's not a good starting point for someone who's never written an extension.

Correction: that extension is not a template, it's a generator. That's why it's so big. It generates extensions.

Re: Alter source list code

Posted: Wed Jul 05, 2017 1:29 pm
by paracosm
Thank you all for your help!
I feel like I am getting somewhere now. I am using JoshyPHP's extension as an example because the other starting point made my head spin.

I have one more question, seeing as I am using the phpbb tutorial on extensions as well. Now they are talking about template listeners, because they want to alter something in their layout. But I figure I don't need a template listener, right? Because all I am editing is the PHP core code? (here is the tutorial I am talking about, by the way.)

Re: Alter source list code

Posted: Wed Jul 05, 2017 2:26 pm
by david63
Templates don't have listeners they only have events.

If your extension does not need to use template events then that is fine - just use the PHP events/listeners.