User tests: Successful: Unsuccessful:
Problem
Joomla! create a useless menu item for backend, when I create a simple component (with only a site part) that have no backend.
How to test this pull
Make a simple component, and try install it. Create folder com_hello
, and put there two files hello.php
(empty) and hello.xml
hello.xml
content for test the component without backed:
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.3" method="upgrade">
<name>com_hello</name>
<author>Your Name</author>
<authorEmail>your.email@example.com</authorEmail>
<authorUrl>example.com</authorUrl>
<creationDate>September 2014</creationDate>
<license>GNU/GPL</license>
<version>1.0.0</version>
<description>Simple Hello component</description>
<files folder="site">
<file>hello.php</file>
</files>
</extension>
hello.xml
content for test the component with backed:
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.3" method="upgrade">
<name>com_hello</name>
<author>Your Name</author>
<authorEmail>your.email@example.com</authorEmail>
<authorUrl>example.com</authorUrl>
<creationDate>September 2014</creationDate>
<license>GNU/GPL</license>
<version>1.0.0</version>
<description>Simple Hello component</description>
<files folder="site">
<file>hello.php</file>
</files>
<administration>
<files />
</administration>
</extension>
Pack this to archive and try install.
After installation, check the admin menu Components->com-hello. It should not exist when test with the first XML, and exist for a second.
Labels |
Added:
?
|
I agree, I thought about remove whole section:
// No menu element was specified, Let's make a generic menu item
else
{
....
}
but not sure about b/c, so made test by <administration>
About a special attribute, if you mean something like
I think it not intuitive, but also not so bad idea
I thought about either using <menu />
(empty) or <menu hidden="true" />
or similar. Something more intuitive than do-not-create-menu
I don't think there are many components which actually don't need a backend menu. Most do at least have some options and thus need a button somewhere to load the settings page. It's also good practice to have some information/license/help page in the backend so people can figure out what this component is supposed to do. I think even if you don't need list and edit views, you likely end up having at least a static page sooner than later.
Thus I don't think it needs to be a "prominent" feature for beginners. But it may be useful for more experienced developers.
As this is likely an edge case, I don't think it would pass the 80/20 rule. That being the case, why not simply use a post-install script to remove the menu entry?
I don't think there are many components which actually don't need a backend menu.
you forgot about people who do a lot small component just for specific cases and not for JED,
each time go to phpmyadmin and remove it there, this thing very annoying
As this is likely an edge case, I don't think it would pass the 80/20 rule.
I also have doubt, but I see no reason why Joomla! create a useless menu item and it should be not fixed
...why not simply use a post-install script to remove the menu entry?
Because this script need to write ... more simple just do not do the things that not requested by manifest file. And it sounds like "fix Joomla! yourself"
In principle I agree totally that if the <menu>
isn't specified then there shouldn't be an entry added. I'd even go so far as to add a sanity check and ensure the <administration>
section is actually defined too. But, this is one of those instances where changing a default behavior like this could be an unexpected B/C break, even if it's for the benefit of others. FWIW I've been shipping an extension for 3 years where I've been removing the menu item through a post-install script, and though it feels like a hack (you have to put a menu item back in too during the uninstall routine or Joomla throws errors, at least it did in 2011, because it was trying to just delete the item without checking for its existence), it does get the job done. Even if we added this code today, I'd have to keep shipping my workaround code until I dropped support for every version of Joomla on the market today.
more simple just do not do the things that not requested by manifest file
That I completely agree with. Unfortunately, it seems like the current default behavior is different, as much as we wish it wasn't. At this point, we need to look at this as backwards compatibility issue.
@mbabker currently there no error when uninstall without menu, see component.php#L1487-L1522 @since 3.1
otherwise this pull would not work, but it works (at least for me)
I guess the force menu creation was made for newbie in component programing, or something related to the new component programing, when you start from administrator/com_example/ and add new stuff by needs...
ok, tricky
then what about @Bakual suggestion about <menu hidden="true" />
, all agree that it will be good solution?
Category | ⇒ | Administration Components |
Labels |
Added:
?
|
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4323.
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4323.
ah, I forgot update the XML example, for testing... after last changes...
I already did update for the testing info, now should be good
@Fedik: I just updated XML file and test successfull.
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4323.
@test success
backend menuitem is not created if menu is set to hidden="true"
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4323.
@test OK,
To test I crafted a component replacing the administration with
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4323.
just noticed: xml examples are different on github and the tracker
for my test i used the one on github containing menu hidden="true"
confused now :-)
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4323.
@bakual @mbabker @betweenbrain Have the changes made resolved the issues you raised especially b/c
Setting to Needs Review - no point people testing this any more if its not going to go any further,
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4323.
Status | Pending | ⇒ | Needs Review |
@brianteeman here no b/c problem anymore, after last commit
As they were the ones that expressed B/C issues then I think they need to confirm that they have now been resolved.
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4323.
Status | Needs Review | ⇒ | Ready to Commit |
It is fine now, yes. Set to RTC.
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-10-23 15:57:47 |
Labels |
Removed:
?
|
That's a bit controversial because using the
<administration>
tag is semantically the wrong tag to use to decide if there should be a menu or not.We already have the
<menu>
tag which should be used for that. But that may not be B/C as we even don't use it in some of our core extensions manifests (like in com_content). So simply not creating a menu if the menu tag is not present would not work. But maybe if it is present but empty or with a special attribute it may work.