By Shubham on 2016-07-05 21:28 in GSoC 16 Improving the menu item workflow

Date: 5th July 2016 on Glip Chat

Time: 14:30 (UTC / GMT)


Meeting was attended by: Shubham Rajput, Gunjan Patel, Peter Martin

 

  • Presentation and Review on work done previous week

Making the article title and alias into the menu link tab using JavaScript: Completed it and made the necessary commit. Some of the code improvements and problem i faced during coding were suggested by Gunjan and Yves Hoppe.

 

The problem that I faced were that I was using JavaScript by defining id field in the article.xml <field> tag. Gunjan suggested to jquery keyup() function instead of onkeyup() event of javascript. As I was new to jQuery Yves helped me by pointing out the syntax and indentation error in my code. In the end the code worked fine and functions properly.

There was a problem with multilingual articles on multilingual websites: This issue was solved by using article’s language code to set the language code for the menu item

The above two improvement can be tracked using this PR:
https://github.com/joomla-projects/gsoc16_menu-for-article/pull/6

Next task was to investigate a couple of approaches to make the functionality more generic: using a Plugin and or using the component’s helper file.

As I went through both approaches I found out that the Plugin event can be triggered in any component when the user opens the edit view. The JDispatcher class performs as event handler which calls all plugins registered for a particular event, when that event is triggered. So basically one plugin and then calling that plugin in other component solve the issue.


Coming to second method of using helper function in menu component that we can make helper function inside com_menu and use that function to make the functionality more generic. One advantage that plugin have over helper method that using plugin manager in joomla backend user can choose whether to use add menu item plugin or not using single click. While using helper function method user have no choice as the functionality is already added.
And the events trigger provides more flexibility in using plugin method as compared to helper function method. So I have decided to go with plugin method to make the functionality more generic.

 

I went through the PR of Michael Babker as Gunjan suggested as a resource to read in order to have more understanding of joomla: https://issues.joomla.org/tracker/joomla-cms/10881

 

I had some questions about it and Michael answered them: https://github.com/joomla/joomla-cms/pull/10881#discussion-diff-69378865

  • Timeline & Tasks

The tasks decided fo next week are;

1. To solve the bugs and Improve the coding for previous commits in the PR. The issues can be tracked through: https://github.com/joomla-projects/gsoc16_menu-for-article/milestones/6th%20Week

2. To start a new Pull Request for the plugin method to make the menu-item worklow more generic.

 

  • Open Questions

I had a doubt regarding how helper method is not overridable

Gunjan and Peter explained that The Article Manager (com_content) uses a helper file to display the submenus on the left + to let the Category Manager (com_category) count the items to display in the category overview. But public static function countItems(&$items) is a static function,so you cannot override it. you can only choose to use or not to use the countItems method in your own component, just add the method in the helper file of your own 3rd party component.So the flexibility of using this helper approach is limited to: use or not use.

  • Resources to read

https://docs.joomla.org/Plugin/Events/Content#onContentPrepareForm

Examples:

https://github.com/joomla/joomla-cms/blob/staging/plugins/user/profile/profile.php#L61

 

https://github.com/joomla/joomla-cms/blob/staging/plugins/user/profile/profile.php#L227

 

  • Next meeting Date & Timing

     

Date: 12th July 2016 on Glip Chat

Time: 14:30 (UTC / GMT)