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. ...
user avatar
  • 19.5k
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/...
user avatar
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 ...
user avatar
  • 8,222
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 ...
user avatar
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 ...
user avatar
  • 5,527
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 ...
user avatar
  • 8,222
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 ...
user avatar
  • 19.5k
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, ...
user avatar
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 ...
user avatar
  • 3,134

Only top scored, non community-wiki answers of a minimum length are eligible