How to add a option to "Notice Options"?

Slind

Active member
hey,

where can I find a tutorial how I can add another option to the defualt "Notice Options"?
I would like to add a drop down menu which allows to select a style. Or is there alrady an addon which adds this? :)
 
A style? Display notice only if in certain styles?
I mean a own style for the notice, at the moment I can change it only global but I would like to have a other style/css depending on choice.
For example:
notice 1 is a warning notice so I select the red style for the notice. Notice 2 is a information, then I select my blue style.

Altogether I want to add a dropdown menu where I can select my style which I created before with css.
 
I mean a own style for the notice, at the moment I can change it only global but I would like to have a other style/css depending on choice.
For example:
notice 1 is a warning notice so I select the red style for the notice. Notice 2 is a information, then I select my blue style.

Altogether I want to add a dropdown menu where I can select my style which I created before with css.
I mean a own style for the notice, at the moment I can change it only global but I would like to have a other style/css depending on choice.
For example:
notice 1 is a warning notice so I select the red style for the notice. Notice 2 is a information, then I select my blue style.

Altogether I want to add a dropdown menu where I can select my style which I created before with css.
Are the styles predefined or user-defined?
 
I don't know if I understood you correctly.
You have such menut with the styles:
QIoQwTg.png

In this notice options:
R6gwuqu.png
 
I don't know if I understood you correctly.
You have such menut with the styles:
QIoQwTg.png

In this notice options:
R6gwuqu.png
Yes, but where do the option values come from? They can come from a constant in your php files (like you can only order a preset chicken menu at KFC) or from a database table (like everybody can submit posts to a forum)
 
Yes, but where do the option values come from? They can come from a constant in your php files (like you can only order a preset chicken menu at KFC) or from a database table (like everybody can submit posts to a forum)
From a php file.
 
From a php file.
OK, so predefined.

1. Add an admin template modification to add in the option.
2. Extend ControllerAdmin_Notice::actionSave so it accepts your new options.
3. Extend DataWriter_Notice to add your option to the field list.

You can see from my Custom Markup for User add on to see how it is done.
 
For which template should I create the modification and what should I add there?
notice_edit. You should add your options template code there.

I highly recommend looking at existing code to see how it is done - XF's code is very self-explanatory.
 
notice_edit. You should add your options template code there.

I highly recommend looking at existing code to see how it is done - XF's code is very self-explanatory.
I already looked in your code but I have no overview about the many files.

And it can't find an template called notice_edit
 
I already looked in your code but I have no overview about the many files.

And it can't find an template called notice_edit

There is an option called User is browsing with the following style in User Criteria tab, maybe it's what're you looking for. And you can find a template called notice_edit in Admin Templates in Development tab
 
There is an option called User is browsing with the following style in User Criteria tab, maybe it's what're you looking for. And you can find a template called notice_edit in Admin Templates in Development tab
No it is not. It does not matter which style the user has selected. It matters only which notice style the admin has selected in the creation.

Ah found the template but how can I create a template modification with a admin template?
 
No it is not. It does not matter which style the user has selected. It matters only which notice style the admin has selected in the creation.

Ah found the template but how can I create a template modification with a admin template?
See Admin Template Mods.

Also, not my code, XenForo's own code. My Usergroup Ranks addon also edits the notice templates, but it's rather outdated.

There is an option called User is browsing with the following style in User Criteria tab, maybe it's what're you looking for. And you can find a template called notice_edit in Admin Templates in Development tab

He is defining a set of styles to be applied to the notices.
 
I created now this Template Modification:
HTML:
<xen:spinboxunit label="{xen:phrase display_order}:" name="display_order" value="{$notice.display_order}" min="0" step="10" />
HTML:
<xen:spinboxunit label="{xen:phrase display_order}:" name="display_order" value="{$notice.display_order}" min="0" step="10" />
   
                <xen:selectunit label="Style:">
                                     <xen:option name="style" value="" label="Testing"
                                             <xen:option value="">(Default)</xen:option>
                                        <xen:options source="$searchContentTypes" />
                        hint="Explain" />
                                </xen:selectunit>
But it get not applied. Did I something wrong?
 
Back
Top Bottom