Component Config field in Global Tab #1189

Closed
opened 2024-11-13 14:12:52 +00:00 by eciudad · 3 comments

Steps to reproduce the issue

Setup in component settings configuration a field in global tab to be able to pull as global param in the component and echo value in site views

Expected result

Being able to echo the global field params in site views

Actual result

If I do something like this:
$val = $input->get(param_name, default_value, filter)
I get a null value,

Quick question about fields set in the component configuration ->Global tab. Are this global params? Example if the field is called "one_site" and the value is set to "New York", How can I php echo that in a site view (I know how to do the tag) I just do not know where to find the global variable name?

System information (as much as possible)

OS Name & Version: Linux lamp302.cloudaccess.net 3.10.0-962.3.2.lve1.5.85.el6h.x86_64 #1 SMP Thu Apr 18 09:46:51 UTC 2024 x86_64
MySql Version: 8.0.34-cll-lve
Apache Version:
PHP Version: 8.2.23
Joomla Version: Joomla! 5.1.4 Stable [ Kudumisha ] 27-August-2024 16:00 GM
JCB Version: 5.0.4-beta1
Browser: Microsoft Edge Version 130.0.2849.46 (Official build) (64-bit)

Additional comments

This is not an issue; I just could not find anything in the documentation.
Gave one example of where I am setting since I want to be able to install my component in my sites, I would like to just to change the value according to the site rather the change the site view and recompile the component every time.

Perhaps there is better way to do this, but I thought that the config was the best place. I just do not where and how to pick up the value.

### Steps to reproduce the issue Setup in component settings configuration a field in global tab to be able to pull as global param in the component and echo value in site views ### Expected result Being able to echo the global field params in site views ### Actual result If I do something like this: $val = $input->get(param_name, default_value, filter) I get a null value, Quick question about fields set in the component configuration ->Global tab. Are this global params? Example if the field is called "one_site" and the value is set to "New York", How can I php echo that in a site view (I know how to do the tag) I just do not know where to find the global variable name? ### System information (as much as possible) OS Name & Version: Linux lamp302.cloudaccess.net 3.10.0-962.3.2.lve1.5.85.el6h.x86_64 #1 SMP Thu Apr 18 09:46:51 UTC 2024 x86_64 MySql Version: 8.0.34-cll-lve Apache Version: PHP Version: 8.2.23 Joomla Version: Joomla! 5.1.4 Stable [ Kudumisha ] 27-August-2024 16:00 GM JCB Version: 5.0.4-beta1 Browser: Microsoft Edge Version 130.0.2849.46 (Official build) (64-bit) ### Additional comments This is not an issue; I just could not find anything in the documentation. Gave one example of where I am setting since I want to be able to install my component in my sites, I would like to just to change the value according to the site rather the change the site view and recompile the component every time. Perhaps there is better way to do this, but I thought that the config was the best place. I just do not where and how to pick up the value.
Owner

Guidance on Using Global Component Parameters in Joomla

I understand that this topic is documented somewhere, and there is a Wiki page that allows you to search through video tutorials by text. If you’re unsure about where to start, here's a step-by-step approach to help you find the information and resolve your issue efficiently:

  1. Search the Wiki Page:

    • Visit the relevant Wiki page with the video tutorials.
    • Look through the titles of the tutorials to identify which one might discuss this topic.
    • Use the text search feature provided to locate the specific part of the tutorial that covers this aspect.
  2. Understanding Global Component Parameters:

    • To use Global Component Parameters anywhere, you must call the Component Helper class to retrieve the parameters.
    • Keep in mind that this process isn’t explicitly documented in JCB (Joomla Component Builder) itself; it’s a part of Joomla’s broader framework knowledge.
  3. Exploring an Example in the Code:

  4. Next Steps:

    • Review the code to see how the parameters are accessed and utilized.
    • If you’re still unable to resolve the issue, feel free to reach out again. While I’m not currently in the office and unable to assist you directly at this moment, I can allocate time later if needed.
  5. Final Note:

    • Be proactive in examining the compiled component’s structure—it’s an invaluable resource for understanding and implementing Joomla’s features.
    • If you’re unable to move forward on your own, let me know, and I’ll assist further when I have more time.

All the best with your implementation!

### Guidance on Using Global Component Parameters in Joomla I understand that this topic is documented somewhere, and there is a **[Wiki page](https://git.vdm.dev/joomla/Component-Builder/wiki)** that allows you to search through video tutorials by text. If you’re unsure about where to start, here's a step-by-step approach to help you find the information and resolve your issue efficiently: 1. **Search the Wiki Page**: - Visit the relevant Wiki page with the video tutorials. - Look through the **titles of the tutorials** to identify which one might discuss this topic. - Use the text search feature provided to locate the specific part of the tutorial that covers this aspect. 2. **Understanding Global Component Parameters**: - To use **Global Component Parameters** anywhere, you must call the **Component Helper class** to retrieve the parameters. - Keep in mind that this process isn’t explicitly documented in JCB (Joomla Component Builder) itself; it’s a part of Joomla’s broader framework knowledge. 3. **Exploring an Example in the Code**: - A practical way to see how this works is by inspecting the code of a compiled component: - Open the **view** of a **side view** within your component. - Examine the calls made and the data being retrieved. - Pay [particular attention to how the **Component Parameters** are pulled into a class variable](https://git.vdm.dev/getBible/joomla-component/src/commit/68cd37f0bdc976203183c10531eed3569e0179ee/site/src/View/App/HtmlView.php#L95). This might offer a reusable pattern or insight into accessing the parameters in your context. 4. **Next Steps**: - Review the code to see how the parameters are accessed and utilized. - If you’re still unable to resolve the issue, feel free to reach out again. While I’m not currently in the office and unable to assist you directly at this moment, I can allocate time later if needed. 5. **Final Note**: - Be proactive in examining the compiled component’s structure—it’s an invaluable resource for understanding and implementing Joomla’s features. - If you’re unable to move forward on your own, let me know, and I’ll assist further when I have more time. **All the best with your implementation!**
Author

Thank you Llewellyn.

Thank you Llewellyn.
Author

Thank you!

Thank you!
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#1189
No description provided.