Adding Fieldset #1023
Replies: 4 comments 1 reply
|
Hi @mehdisabbagh, Thank you for the suggestion. Yes, as I understand it, the proposed FIELDSET option is intended to provide more control over the appearance and grouping of fields within an administrator edit view. The idea would be to define a fieldset label, assign Bootstrap grid classes such as This would certainly provide a convenient interface for creating more structured and visually appealing administrator forms. However, JCB already includes a more flexible mechanism for achieving this through administrator layout overrides. As has been explained in this issue directly related to overriding the Admin Tab layouts, JCB allows you to create a custom layout and override an existing administrator view layout by following a specific naming convention:
This means that layouts such as Using this approach, you are not limited to predefined fieldset options. You can create any structure required, including:
The layout override system therefore already supports the requested result while also providing considerably more control than a dedicated FIELDSET configuration interface would provide. For that reason, adding a separate FIELDSET feature similar to Admin Tabs is unlikely to be prioritised in the near future. It would introduce another configuration layer for functionality that can already be implemented more comprehensively through layouts. The recommended approach is therefore to use JCB's custom layout functionality and override the relevant administrator layout at the appropriate scope. So here is the basic introduction to this idea: Please keep in mind that layout overrides are very powerful. A broadly named layout can affect multiple views or components, so it is generally safer to use the most specific naming convention required for the intended override. Please read more on this in the related issue #880 to be sure you get a full understanding of exactly how to use this feature. |
|
Hi @lemuelvdm, I am using the latest JCB version on Joomla 6. But all the tutorials are with sooner versions. therefore I am a little confused. I did as you said. And it was a wonerful solution. very easy. for example in com_content:
Can this be changed in JCB? |
|
Thanks for your detailed explanation. That means a lot to me. Its wonderful that you support fast and helpfully with all details you have. Let me explain this according to my project:
But the problem that I was talking about in my seccond Comment in this conversation is this: But Look at this tree and the for example, it compiles the content tab as below: and gives a So my question is:
|
|
At this point, there is no simple mechanism for overriding an entire generated template in JCB. These templates contain a significant amount of complexity, and we have never considered replacing a complete template to be the optimal approach. In practical terms, if you intend to override most or all of the generated template, you are increasing your maintaining responsibility. One of JCB’s primary purposes is to help move your project forward as Joomla evolves. It provides long-term maintainability by keeping generated code aligned with changes in Joomla. When large portions of the generated templates are replaced, much of that benefit is lost. You are effectively taking responsibility for maintaining that code yourself. In my opinion, modifying or replacing complete generated templates can have a significant long-term maintenance impact. That does not mean overriding the output is impossible. You have several options. Joomla Template OverridesYou can use Joomla’s normal template override system where applicable. This allows you to override layouts at the Joomla template level using Joomla’s standard mechanisms. Persistent File Overrides in JCBYou can also use JCB’s Custom Code system, including persistent file overrides with hash automation: This mechanism allows you to override generated files while enabling JCB to track and preserve those changes. However, overriding an entire template is usually unnecessary. In most cases, what developers actually need is control over a specific tab or section of the template. You can with the Custom-Codes approach target only that section you want to change, minimizing your maintenance window. You can also take full control of a singe tab. Taking Full Control of a TabJCB already provides a practical way to take control of an individual tab. When adding fields to the tab, place all of the fields in the Full Width in Tab position. Do not assign any fields to the left or right positions. When JCB builds the tab, it will then generate only one layout for that tab: the full-width layout. You can open that layout and arrange the fields however you need. You can place fields on the left or right, create responsive columns, adjust the layout for different screen sizes, or implement any other presentation logic required for that tab. The important point is this:
Using this approach gives you control over the entire tab without requiring you to replace the complete template. The way JCB adds these layouts through Joomla’s tabbing engine follows Joomla’s standard layout architecture. It is the default and recommended approach. When the Standard JCB Layout Is Not EnoughIf you do not want to use the standard generated layout override structure, then you can use JCB’s Custom Code systems to override any thing you like, as already mentioned. At that point, you are intentionally taking control of the generated output. JCB’s persistent override system is designed to let you override virtually any generated file. The documentation explains the different override mechanisms available: https://github.com/joomengine/jcb-documentation/blob/master/english/JCB-Custom-Codes.md You should also review the documentation on insert and replace placeholders: These tools allow you to modify generated output in a controlled and persistent way. It is important to understand that choosing this route increases your maintenance responsibility. Once you take control of generated code, you are also committing to maintaining that code as Joomla and JCB continue to change. Round-Trip DevelopmentThe above insert and replace placeholders in JCB is often called round-trip development. The general workflow is:
There is also a video demonstrating this workflow and how JCB brings modified generated code back into the database. This approach is how JCB handles requirements that fall outside its normal generated-code path. It ensures that the code you take control of is stored and managed as Custom Code. That distinction is intentional:
This allows JCB to preserve its primary benefit—keeping the generated component aligned with Joomla—while still giving you complete control where that control is genuinely required. My recommendation would be to first use the Full Width in Tab approach when the requirement is limited to a particular tab. It is usually the cleanest solution and avoids unnecessary maintenance. If the requirement truly cannot be implemented through the standard layout system, then use the persistent override or Custom Code mechanisms. Review the documentation, test the available override methods, and use the one that best matches the level of control you need. If you follow the documentation and still cannot get the override working, let us know where you are getting stuck, and we can look at that specific implementation. Just to help improve a little bit of the overriding power of JCB on the layout level, there is this powerful way to, since you're adding all these fields to the full width layout, there's this powerful way to have those fields added still dynamically with a placeholder that you place in the custom script tab, at PHP custom script tab, and it looks something like this. // get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
###LAYOUTITEMS###
);
$hiddenFields = $displayData->get('hidden_fields') ?: array();Note the |

Uh oh!
There was an error while loading. Please reload this page.
I am thinking a way to add FIELDSET to JCB.
I think a simple way to add FIELDSET would be just like "Admin Tabs" in Admin Fields.
We can set the label of the FIELDSET and the width of it by assigning classes sush as "col-12 col-lg-6" or other classes.
Then we can assign the fieldset to any TAB we want.
This can prettify the admin view of the component.
It would be wonderful if the JCB development team adds this option to JCB.
@TLWebdesign
All reactions