8
votes
Accepted
Getting custom fields and their values (com_fields)
The key here (which I misunderstood/overlooked) is that for the FieldsHelper::getFields method, to also return the value & rawvalue of the custom fields, the $item has to be a content item object. ...
5
votes
Getting custom fields and their values (com_fields)
For getting custom fields and values for Joomla articles, you can use the following code:
<?php
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/...
3
votes
Accepted
Creating a field plug-in, need the com_content form to be enctype multipart
There really isn't a good way to do this. Your best bet is parsing the already generated HTML and making a replacement there. For the component this can be done using onAfterDispatch event. Below is a ...
2
votes
How can I call com_contact fields in an article view?
Your approach will still work, but you just need to pass a contact object as the second parameter to your call
$fields = FieldsHelper::getFields(...);
Unfortunately afaik there is no API around ...
1
vote
Reason for parameter for using custom fields in configuration
You don't necessary need it.
I think it may be a bit of a performance factor and also UI cluttering if you have custom fields enabled but not used. For core, it was decided to make it opt-in.
In my ...
1
vote
Accepted
Get values of other custom fields in field layout override
Create an override of com_fields/layouts/fields/render.php. Find this line:
$content = FieldsHelper::render($context, 'field.' . $layout, array('field' => $field));
Change it to also pass the ...
1
vote
Custom fields published state not working as expected
It's unknown what exactly is your $fields variable, what values it contains (how it has been produced), where you use this code and generally your question lacks context.
However, note that when a ...
1
vote
Accepted
Override output for repeatable custom fields
Here is the solution I came up with for my question:
$programs = $fields['programs']->rawvalue;
$class = $fields['programs']->params->get('render_class');
$items = json_decode($programs, ...
1
vote
Accepted
How could I make Joomla! fields as a function
I presume you're in a template override of com_content. In which case your $this will point to an instance of a view class, eg. ContentViewArticle or something.
PHP does allow you to declare ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
com-fields × 9custom-field × 7
fields × 4
development × 1
templates × 1
jform × 1
template-override × 1
form-fields-types × 1
com-content × 1
joomla-3.9 × 1
joomla-4.x × 1
joomla-3.7 × 1
repeatable-field × 1
com-contacts × 1