Override of view parameters in Menu Item Edit form

Locked
tarasm
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon Oct 19, 2009 3:18 am

Override of view parameters in Menu Item Edit form

Post by tarasm » Thu Dec 17, 2009 9:24 pm

Hello,

I think it would be very useful to be able to override the xml file that is used to generate the Parameters form in Menu Item edit form.

This would allow to add custom parameters to menu items and can be used to improve administration work flow.

One of the biggest advantages that I see to this is ability to associate info on per menu item bases.
This would allow Administrator to add additional information to specific menu items. This information can later be used on the frontend to display this associated information.

This override could work in the same way that component view override works, except the file location would be different.

The overwritten xml files would go into the Administrator Template.

If you wanted to add text field to Article Edit form, you would do the following.

Code: Select all

# create directory
mkdir -p administrator/templates/khepri/html/com_content/article/

# copy default template
cp components/com_content/article/default.xml administrator/templates/khepri/html/com_content/article/default.xml

# modify the template
# add <param name="additional_text" type="text" size="30" default="" label="Some text" description="PARAMPAGETITLE" />
vim administrator/templates/khepri/html/com_content/article/default.xml
This would give you a new text field to add text to this menu item.

What do you guys think?
If you like this, I would be happy to write the code.

I could use this in projects right away.

Thank you,
Taras

User avatar
fabrizim
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Wed Mar 29, 2006 7:37 pm
Contact:

Re: Override of view parameters in Menu Item Edit form

Post by fabrizim » Fri Dec 18, 2009 1:57 pm

Hi Taras-

I agree with you that it would be great if the parameters for menu items could be more flexible - especially since that is the only place where you can store arbitrary data. I don't think it would be great for advanced custom content, but for simple fields, it works fine. There may be a solution you could look into that already exists...

I have seen custom parameters for menu parameters on RocketTheme templates. They use an extension for navigation menus called RokNavMenu (http://www.rockettheme.com/extensions-joomla/roknavmenu). During the installation for the plugin (it needs to install as a component), it copies a custom override file to the active administrator template. The overrides it uses (templates/khepri/html/com_menus/form.php) adds new parameter groups in the menu area. I would take a look through that code and see if it is similar to what you are looking for.

Unfortunately, this type of override could only be for one extension in each joomla installation, as subsequent overrides would kill the prior functionality.

Hope this helps-
Mark

BTW - I couldn't submit this post with quick reply...

tarasm
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon Oct 19, 2009 3:18 am

Re: Override of view parameters in Menu Item Edit form

Post by tarasm » Fri Dec 18, 2009 8:36 pm

Hey Mark,

Thanks for your feedback.

I did some research into this.

It looks like it would be very easy to implement this modification without modifying Joomla core.

1. Overload /administrator/components/com_menus/view/item/edit.php by adding /administrator/templates/khepri/html/com_menus/item/edit.php
2. In the override template, add code to look for a custom params definition file according to specific pattern
3. If file exists, load it and display the fields for it another panel

As long as the generated form html stores all values in params[], then the params will be automatically stored in the database.

The cool thing about this is that we can use elements to allow some pretty advanced form modification while keeping things 100% hack free.

User avatar
masterchief
Joomla! Hero
Joomla! Hero
Posts: 2247
Joined: Fri Aug 12, 2005 2:45 am
Location: Brisbane, Australia
Contact:

Re: Override of view parameters in Menu Item Edit form

Post by masterchief » Mon Dec 28, 2009 5:27 am

You won't be able to override the core XML layouts but in 1.6 we'll be allowing for "extra" layouts in the template to provide their own XML file. The menu item page will be able to detect these extra layouts in the template overrides folder.
Andrew Eddie - Tweet @AndrewEddie
<><
http://eddify.me
http://www.kiva.org/team/joomla - Got Joomla for free? Pay it forward and help fight poverty.


Locked

Return to “Feature Requests - White Papers - Archived”