Override for the Joomla! 1.6 Menu Item metadata.xml File

override.zip - Marius's patch implemented as a Class Override

 

Last week, I shared a system plugin called Override with examples of how to override Joomla! 1.6 Core Classes. I needed to identify options for overriding core code in Joomla! 1.6 for the Molajo distribution for those rare cases when Extensions don't quite get you there. I shared it hoping it might be useful to others.

Some may be following the discussion in the Bug Squad regarding the bug related to the Frontend Component metadata.xml file. Marius Van Rijnsoever reported that some 1.5 MVC Component Menu Items were not working in 1.6.  During debugging, he uncovered a TODO note indicating that the metadata.xml file must still be reconnected following 1.6 revisions to the Menu System.

As is appropriate, Marius created a patch and posted issue on the tracker:  [#24562] com_menu not looking for component xml file. Beat and Radek Suski have also reported this issue. As it turns out, even Hannes's Menu Item patch from June addressed this problem but was set aside by Andrew as not an appropriate solution.

Andrew agreed to review Marius's patch provided he had time this coming weekend at which time the patch will hopefully be applied to core. Unfortunately, Andrew also indicated his time availability is very low, so patience will be required.

To me, this is a good reason to look at Overrides. Overrides are seldom permanent. But, in cases like this, an override can be very helpful to buy everyone a little time. Developers can move forward migrating extensions. The project can review patches, as they are able.

I applied Marius's patch to an up-to-date Joomla! 1.6 (revision: 20433). Then, I placed that modified Menu Item class into the Override Plugin folder.  To perform the override, I added the one line of code to my Override System Plugin in order to make certain the application uses Marius's fix instead of the core class:

    function onAfterInitialise()
{
JLoader::register('MenusModelItem', dirname(__FILE__).'/item.php');
}
As an aside, I think it's important to remember that there is nothing wrong with innovating solutions that don't necessarily color perfectly inside of the lines. A different way of thinking can create important innovation. Sometimes, that innovation winds up in core.

If you disagree, check out the JXtended Library for Joomla! 1.5. With that library, the core 1.5 MVC can be overridden. The core 1.5 ACL is override with the JX Library. So is the Database Query class. JForm is in there, thus relegating the core JParameter class to a corner office without a phone. Is it bad that the JXtended team used their library instead of core 1.5? Of course not. In fact, a lot of what is now in 1.6 came from that source.

We need to learn to focus on the code, get things to work, not sweat the small stuff, and celebrate innovation. I am very interested in hearing of other overrides devs find necessary. If you have an interesting migration story and code to share, please do!

Views: 509

Tags: joomla1.6

Comment by Robert Vining on January 25, 2011 at 7:41am

You're so much more politically correct than I ever will be Amy... and that's why I love you! I was just about to engage in that debate on the bugsquad list when I saw a tweet about this post. Thanks for keeping me sane this morning!

Comment by Marius van Rijnsoever on January 26, 2011 at 8:09am
Thanks Amy.

I am not sure if this is experienced by other people as as well, but I find it very frustrating to try and contribute to the Joomla core project.  While migrating my extension to Joomla 1.6, I found an empty TODO tag in the joomla source code. This empty section was preventing my (and many other components) to function in Joomla 1.6. Well no point in complaining, therefore I created a patch, tested it, explained my rationale and posted it on the tracker.

The tone of the response surprised me. Instead of a simple thanks and lets test it, the response was: its your own fault for using bad code, people should never be using component/view level menu parameters and don't count on the patch being accepted anytime soon. If this is the tone of the response to fixing a todo tag in the source code, I can imagine the difficulty getting other patches accepted.

Now your override system comes in handy as it means the functioning of my extension is not in the hand of an unwilling person. Here is your new override plugin in action for JFusion:
http://code.google.com/p/jfusion/source/detail?r=2439

Many many thanks Amy. At least now we have a feature that a joomla core developer does not approve of, we can use the innovative Joomla 1.6 override system to bypass those objections. Its really a very clever system that works exactly as you advertised it.

Marius

Comment by Amy Stephen on January 26, 2011 at 9:17pm

Marius -

 

Yes, it's been disheartening. It's no secret that there is a lot of dysfunction. I have tried to help, but failed. I'm done. I hope they sort it out.

I like the comradary and collaboration building in our community of developers. You have been a hero to me for some time so it is an honor helping you in this small way. That's what community is all about. -sharing and supporting one another.

Keep up the professional approach. In the end, you will never regret holding true to your integrity.In doing so, you are a role model for others, too.

 

Thanks for your work, Marius.

Comment by Marius van Rijnsoever on January 26, 2011 at 11:05pm

Hi Amy,

 

You are just an amazing inspiration to the whole community. Thanks to your inspiration many years ago, we decided to take GPL compatible approach rather than a quick and dirty hack.  And now you have done the same for us just yesterday, with an approach that allows us to innovate without hacking the joomla core. Without you, we would not have been in the place we are now. I have an incredible amount of respect for the tireless work you do in making the whole Joomla community more enjoyable.

 

I have decided to take a chill-pill and refocus my efforts to where they are most useful. There is no point in getting my bloodpressure up when I can not have a positive effect or my efforts are not welcomed. It is sad to read that you "are done with it". But every ending has a new beginning and Molajo has an exciting future. Please let me know if there is anything I can do to help-out with the molajo project, I am at your service.

 

Marius

Comment by Amy Stephen on January 27, 2011 at 6:51am

Definitely will want your involvement!

 

When I say "done with it" - I mean my approach of trying to help negotiate conversations or understandings with the project. I am no where close to be done with Joomla!. Just done with Joomla! drama. lol! It's time for everyone to grow up.

 

You are very kind and you just gave me a huge boost of energy to get after this day.

 

Once we get Molajo into an alpha state, our goal is to figure out how we plan to engage the developer community. It's been so hard to get involved -- we want Molajo to be "ours" -- in a wild dream sense - it could be a collaborative environment for community devs to manage our shared extensions -- to build consensus on what we want to propose for core -- to figure out how to strengthen our market - and so on. We want it open for participation based on what people do - not who they are or their titles or previous involvements or how well known they are. I know you can help us find how to do that.

 

Huge community. So much talent and passion. Tapping into that and figuring out how to improve how we communicate with one another and collaborate and advance our software. That's the goal of Molajo.

Comment by Amy Stephen on February 5, 2011 at 6:20am

Looks like Mark got Marius's patch into core yesterday.

 

Glad to see that.

Comment

You need to be a member of All Together, As A Whole to add comments!

Join All Together, As A Whole

Badge

Loading…

© 2012   Created by Amy Stephen.

Badges  |  Report an Issue  |  Terms of Service