New answers tagged

0

As you're probably aware, the fields are added in via the system fields plugin. When the admin form is being built the event onContentPrepareForm is triggered, and this results in the system fields plugin adding in the custom fields into the form xml structure. Later in the layout file renderField() is called, and this causes the field structures in the ...


0

Either I'm editing the wrong bit of code. This is the answer. The layout (plugins/fields/sql/tmpl/sql.php) is used for displaying the value in frontend, not for rendering the field in forms. You will need to create your own plugin. Either with a custom form field class or with custom code in onCustomFieldsPrepareDom event.


0

Try to get the user id like this: $user = JFactory::getUser(); $id= $user->id; Try to directly add it onto your sql statement: $query = $fieldParams->get('query', ''); // Run the query with a having condition because it supports aliases $db->setQuery($query . ' AND created_by =' . $db->q('.$id.' )); also check permissions and ...


0

public function onContentPrepareForm(JForm $form, $data) { if ($form->getName() !== 'com_categories.categorycom_content') { return; } JFormHelper::addFormPath(__DIR__ . '/forms'); $form->loadFile('categoryextension', false); }


0

Here is the code that finally worked for me. Thanks to @Sharky for the tips. Hopefully it is helpful to others. Example working code <?php $programs = json_decode($fields['programs']->rawvalue); $class = $fields['programs']->params->get('render_class'); ?> <div class="programs"> <?php foreach($programs as $program): ?> <...


1

$fields['programs'] is already an object. Run json_decode() only on its value. $programFields = json_decode($fields['programs']->rawvalue);


0

The fatal error is caused by $options being an object instead of an array at least some of the time. A possible fix would be to cast it to an array before using it. ie. $options = (array) $options; $o->extra_sourc->$name = JText::_($options[$extra_sourc->$name]); Without seeing the internal structure of things it is difficult to guess anything ...


1

Rename actiecode.php to actiecodes.php. Class name, filename and field type in XML form must all match.


0

Maybe instead of creating a new set of Globals (typically a Bad Idea) you drop the values directly into javascript: JFactory::getDocument()->addScriptDeclaration(' var GAFields = window.GAFields || {}; GAFields = ' . json_encode($itemCustomFields) . '; '); And then reference GAFields[name] in the javascript. Doing this in default.php I'm not ...


0

Could you use a body tag as the way to call the ga tag? As with caching on it - Joomla notices the body tag change. This template uses this: $params = $app->getParams(); $pageclass = $params->get('pageclass_sfx'); <body class="<?php echo $active->alias . ' ' . $pageclass; ?>"> Then simply call the active->alias in your js.


Top 50 recent answers are included