Field Property "display" set to "menu" has no effect on menu item: XML for Menu item is incomplete #1083

Closed
opened 2024-03-13 13:54:52 +00:00 by kommid · 8 comments
Member

Steps to reproduce the issue

Set up a text field with property dropdown set to "display" and value set to "menu" (at the very bottom of the field configuration page, where the description says: "Display switch for dynamic placement in relation to the use of the field in menu and global configuration options. So the (config) option will only add the field to the global configuration area, (menu) will add the field only to the menu area."
Compile the component

Expected result

Menu item, where this field belongs to, gets a new tab added, where the text field can be filled in

Actual result

no tab is being added

System information (as much as possible)

  • OS Name & Version: Linux 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64
  • MySql Version: 10.5.23-MariaDB-0+deb11u1
  • Apache Version: Apache/2.4.56 (Debian)
  • PHP Version: PHP 8.0
  • Joomla Version: JCB runs on J!3..10.12 and site where the component is installed runs on 4.4.3
  • JCB Version: 3.2.0-beta5
  • Browser: Firefox 115.8.0esr (64-Bit)

Additional comments

I have a text field that adds a parameter to the a menu item. This parameter holds a category which is passed to the page, the menue item links to. I don't know, in which version of JCB this stopped working, It does work on 3.1.28 though.
Using JCB 3.2.0-beta5 in components created for J!4 and J!5 this seems to have no effect anymore, since the tab for the parameter in the menu item is gone.

Here is, how I set up the field. This did work for J!3:
field_setup.png

This is how it is suppoesed to work:
working_menu_item_as_intended.png

On J!4 the tab for my category parameter is gone:
menu_item_with_missing_parameter_tab.png

The xml file that is generated for the menu item by 3.2.0-beta5 (and 3.2.0-beta6) is missing the information for this field:

<?xml version="1.0" encoding="utf-8" ?>
<metadata>
	<layout title="COM_CMV_MENU_VORKONFIGURATIONLP_TITLE" option="COM_CMV_MENU_VORKONFIGURATIONLP_OPTION">
		<message>
			<![CDATA[COM_CMV_MENU_VORKONFIGURATIONLP_DESC]]>
		</message>
	</layout>
</metadata>

It should look like this:

<?xml version="1.0" encoding="utf-8" ?>
<metadata>
	<layout title="COM_CMV_MENU_VORKONFIGURATIONLP_TITLE" option="COM_CMV_MENU_VORKONFIGURATIONLP_OPTION">
		<message>
			<![CDATA[COM_CMV_MENU_VORKONFIGURATIONLP_DESC]]>
		</message>
	</layout>
	<!-- Adding page parameters -->
	<fields name="params">
		<fieldset name="basic" label="COM_CMV"
			addrulepath="/administrator/components/com_cmv/models/rules"
			addfieldpath="/administrator/components/com_cmv/models/fields">
		<!--  Cmv_mnu_kategorie_lp Field. Type: Text. (joomla) -->
	<field type="text"
               name="cmv_mnu_kategorie_lp"
               label="COM_CMV_CONFIG_CMV_MNU_KATEGORIE_LP_LABEL"
               size="10"
               maxlength="64"
               default=""
               class="text_area"
               readonly="false"
               disabled="false"
               required="false"
               filter="STRING"
               autocomplete="on"
                />
		</fieldset>
	</fields>
</metadata>

I'll didn't test, if JCB 3.2.0-beta5 compiles this correctly for J!3 though, since I don't have a J!3 site to test this on atm. Do you need me to do so?

### Steps to reproduce the issue Set up a text field with property dropdown set to "display" and value set to "menu" (at the very bottom of the field configuration page, where the description says: "Display switch for dynamic placement in relation to the use of the field in menu and global configuration options. So the (config) option will only add the field to the global configuration area, (menu) will add the field only to the menu area." Compile the component ### Expected result Menu item, where this field belongs to, gets a new tab added, where the text field can be filled in ### Actual result no tab is being added ### System information (as much as possible) - OS Name & Version: Linux 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64 - MySql Version: 10.5.23-MariaDB-0+deb11u1 - Apache Version: Apache/2.4.56 (Debian) - PHP Version: PHP 8.0 - Joomla Version: JCB runs on J!3..10.12 and site where the component is installed runs on 4.4.3 - JCB Version: 3.2.0-beta5 - Browser: Firefox 115.8.0esr (64-Bit) ### Additional comments I have a text field that adds a parameter to the a menu item. This parameter holds a category which is passed to the page, the menue item links to. I don't know, in which version of JCB this stopped working, It does work on 3.1.28 though. Using JCB 3.2.0-beta5 in components created for J!4 and J!5 this seems to have no effect anymore, since the tab for the parameter in the menu item is gone. Here is, how I set up the field. This did work for J!3: ![field_setup.png](/attachments/ac5d7d80-187e-4369-b74c-ef175cf3ea54) This is how it is suppoesed to work: ![working_menu_item_as_intended.png](/attachments/43c61085-4a09-4c8d-adec-67aa15baaa59) On J!4 the tab for my category parameter is gone: ![menu_item_with_missing_parameter_tab.png](/attachments/29eee3ba-9faa-47f9-8c90-aa934f3a4eac) The xml file that is generated for the menu item by 3.2.0-beta5 (and 3.2.0-beta6) is missing the information for this field: ``` <?xml version="1.0" encoding="utf-8" ?> <metadata> <layout title="COM_CMV_MENU_VORKONFIGURATIONLP_TITLE" option="COM_CMV_MENU_VORKONFIGURATIONLP_OPTION"> <message> <![CDATA[COM_CMV_MENU_VORKONFIGURATIONLP_DESC]]> </message> </layout> </metadata> ``` It should look like this: ``` <?xml version="1.0" encoding="utf-8" ?> <metadata> <layout title="COM_CMV_MENU_VORKONFIGURATIONLP_TITLE" option="COM_CMV_MENU_VORKONFIGURATIONLP_OPTION"> <message> <![CDATA[COM_CMV_MENU_VORKONFIGURATIONLP_DESC]]> </message> </layout> <!-- Adding page parameters --> <fields name="params"> <fieldset name="basic" label="COM_CMV" addrulepath="/administrator/components/com_cmv/models/rules" addfieldpath="/administrator/components/com_cmv/models/fields"> <!-- Cmv_mnu_kategorie_lp Field. Type: Text. (joomla) --> <field type="text" name="cmv_mnu_kategorie_lp" label="COM_CMV_CONFIG_CMV_MNU_KATEGORIE_LP_LABEL" size="10" maxlength="64" default="" class="text_area" readonly="false" disabled="false" required="false" filter="STRING" autocomplete="on" /> </fieldset> </fields> </metadata> ``` I'll didn't test, if JCB 3.2.0-beta5 compiles this correctly for J!3 though, since I don't have a J!3 site to test this on atm. Do you need me to do so?
kommid changed title from Field Property "display" set to "menu" has no effect on menu item to Field Property "display" set to "menu" has no effect on menu item: XML for Menu item is incomplete 2024-03-13 14:18:08 +00:00
Owner

Have you looked at the JCB tutorials?

Have you looked at the [JCB tutorials](https://www.youtube.com/watch?v=tgtonbyyjDs&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=91&pp=iAQB)?
Author
Member

I watched almost all of the tutorials, but this tutorial wasn't available when I first created the component so I accomplished it by passing a parameter as described above :). Doing this with categories seems logical and is tempting, but I think it would be quite a lot of work to switch to categories. Was the ability to pass parameters from a menu item to a site view, the way I did this removed?

I watched almost all of the tutorials, but this tutorial wasn't available when I first created the component so I accomplished it by passing a parameter as described above :). Doing this with categories seems logical and is tempting, but I think it would be quite a lot of work to switch to categories. Was the ability to pass parameters from a menu item to a site view, the way I did this removed?
Author
Member

I also updated my initial post, since my xml-examples didn't display - sorry for the inconvenience....

I also updated my initial post, since my xml-examples didn't display - sorry for the inconvenience....
Owner

The tutorial is not just about categories, unless you've watch this tutorial from this point in the video and have implemented the linking correctly there is not much I can say more.

Sermon Distributor Example Outcome:

JCB build this based on the above tutorial..

This is the way to setup those kind of menus, once you can confirm that you've done that. Then we can look at JCB if it still does not work, until then JCB is not the issue. Just selecting "display"="menu' is not enough for this to work.

In the compiler, this is how that field is detected.

The tutorial is not just about categories, unless you've watch [this tutorial from this point in the video](https://youtu.be/tgtonbyyjDs?si=Qlal48ELoVkpoQLS&t=1517) and have implemented the linking correctly there is not much I can say more. * You must make sure your [dynamic get is setup](https://youtu.be/tgtonbyyjDs?si=6Tf77g7iU3zFPHi3&t=484) correctly. Use:`$this->input->getInt('id', 0);` to target your ID value. * That your site view is [correctly linked](https://youtu.be/tgtonbyyjDs?si=JEyp4QKbtzFPfZ4M&t=1523) to the component. * Then your field that is added to the component [configuration field](https://youtu.be/tgtonbyyjDs?si=eOl-B5FdHmEL9YCY&t=1641)... in the [right tab](https://youtu.be/tgtonbyyjDs?si=xxJEuUY-EmTD6Slh&t=1721). * Then you must make sure your [field is a custom field type](https://youtu.be/tgtonbyyjDs?si=IjTezUjtxZ-ipMGK&t=1876), not text: ![image](https://git.vdm.dev/attachments/625c7c02-0090-4e10-acd8-266ea5414488) But **custom** with the `viewname_request_id` as [name](https://youtu.be/tgtonbyyjDs?si=RMFymd1icCcr0igW&t=2592)! **Sermon Distributor Example Outcome:** > JCB build this based on the above tutorial.. * Here is the [default.xml for Joomla 3](https://git.vdm.dev/christian/Joomla-Sermon-Distributor/src/branch/3.x/site/views/preacher/tmpl/default.xml#L14) * Here is the [default.xml for Joomla 4](https://git.vdm.dev/christian/Joomla-Sermon-Distributor/src/branch/4.x/site/tmpl/preacher/default.xml#L14) * Here is the [default.xml for Joomla 5](https://git.vdm.dev/christian/Joomla-Sermon-Distributor/src/branch/5.x/site/tmpl/preacher/default.xml#L14) This is the way to setup those kind of menus, once you can confirm that you've done that. Then we can look at JCB if it still does not work, until then JCB is not the issue. Just selecting `"display"="menu'` is not enough for this to work. In the compiler, [this is how that field is detected](https://git.vdm.dev/joomla/Component-Builder/src/branch/3.x/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Creator/ConfigFieldsetsSiteControl.php#L135).
Author
Member

ok, I found the reason: I had to rename my site view because there was a '_' in its name which caused trouble with namespacing, and in the component configuration where I define the tab field, the name didn't match anymore exactly, so the xml for the tab wasn't generated.
I apologize for the inconvenience :/

ok, I found the reason: I had to rename my site view because there was a '_' in its name which caused trouble with namespacing, and in the component configuration where I define the tab field, the name didn't match anymore exactly, so the xml for the tab wasn't generated. I apologize for the inconvenience :/
Owner

Never an inconvenience.. ;)

Feedback, and issues are critical to the success of JCB... please! The underscore in your view name should not cause the issue, since we have underscores all over JCB's views and even in many of the components we build. You will see that _s are everywhere... there must be another issue.

Your feedback is the greatest profit we have in making JCB opensource, it is never an inconvenience 👍 since we are ever learning how to do and explain things better.

Never an inconvenience.. ;) Feedback, and issues are critical to the success of JCB... please! The underscore in your view name should not cause the issue, since we have underscores all over [JCB's views](https://git.vdm.dev/joomla/Component-Builder/src/branch/5.x/admin/src/View) and even in many of the components we build. You will see that `_`s are everywhere... there must be another issue. **Your feedback** is the `greatest` profit we have in making JCB *opensource*, it is never an inconvenience 👍 since we are ever learning how to do and explain things better.
Owner

What you've also help us realize once again is that this feature in JCB should be made easier and simpler. Thank you!

What you've also help us realize once again is that this feature in JCB should be made easier and simpler. Thank you!
Author
Member

The way, this is done may not be obvious, but it is OK. The problem as with more issues that occur with the usage of JCB, is that the main documentation is by video. Don't get me wrong here: This is not a criticism. I can only imagine, how much work it would be to create a structured written documentation and I do not expect one...
I'm not a professional developer and I also don't work with JCB every day. But JCB enabled me to put together some awesome Joomla extensions and it's fun work with it and to get results. I just tend to have a hard time remembering how things were done and I have an even harder time to remember where the information was, that explained to me, how to do certain things :)

The way, this is done may not be obvious, but it is OK. The problem as with more issues that occur with the usage of JCB, is that the main documentation is by video. Don't get me wrong here: This is not a criticism. I can only imagine, how much work it would be to create a structured written documentation and I do not expect one... I'm not a professional developer and I also don't work with JCB every day. But JCB enabled me to put together some awesome Joomla extensions and it's fun work with it and to get results. I just tend to have a hard time remembering how things were done and I have an even harder time to remember where the information was, that explained to me, how to do certain things :)
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1083
No description provided.