4

The above answer from @Lodder is correct, but you will also need to wrap the function with if (!function_exists('yourFunctionname')) { // ... proceed to declare your function } If you do not, you can only render this function once per page. So altogether it should look like this: $mitarbeiter = $params->get('mitarbeiter'); $json = json_decode($...


4

I was hoping someone would eventually ask this question on here. I wrote a function for my first usage of repeatable form fields and use it for every extension I make now. Here is how you do it: Firstly, get the json object for the parameter like so: $mitarbeiter = $params->get('mitarbeiter'); Then decode the json object: $json = json_decode($...


3

I recently answered a question regarding exporting the list of Joomla users to CSV - export user details from database via cron. The same code can be used for exporting data from any Joomla table. As far as invoking this PHP code from an article - look into Jumi extension - https://extensions.joomla.org/extensions/extension/core-enhancements/coding-a-scripts-...


2

This helped me to solve my problem... <?php $fieldX = json_decode($this->item->jcfields[X]->rawvalue, true); ?> where X is the Id of the subform native field A, B, C is the respective Id of the custom fields inside of the subform. NB: this solution only works for repeatable subforms. For subforms that are not repeatable, there is no need to ...


1

Since your logos and urls exist in pairs, you can use a single loop over the logos and access the urls via the shared index. Code: (Demo) foreach ($jsonPartenaires['logo'] as $i => $logo) { $html = sprintf('<img src="%s">', $logo); if ($jsonPartenaires['url_partenaire'][$i]) { $html = sprintf( '<a href="%...


1

Since PHP 7 array_column() supports passing an array of objects. You would only need to cast the data to array: $ids = array_column((array) $this->params->get('ids'), 'id'); On older PHP versions you could cast to array and use Joomla\Utilities\ArrayHelper::getColumn() which supports passing array of objects on all PHP versions: use Joomla\Utilities\...


1

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 item to field layout: $content = FieldsHelper::render($context, 'field.' . $layout, array('field' => $field, 'item' => $item)); The item with its fields is ...


1

So you would need to change it to be json and array based. Here is a rough example I setup as a default field which works as expected: {"test0":{"type":"2","Fichier":"images\/joomla_black.png","Description":"assasa"}} test0 is the in two parts, test is the name of the field and 0 is the field of the repeatable field. the rest of it you can see matches ...


1

$repeatable_fields_map = (array)$this->params->get('repeatable_fields_map'); foreach($repeatable_fields_map as $item) { $accreditationImage = $item->accreditationImage; $accreditationText = $item->accreditationText; $link = $item->link; // do stuff with these variables }


1

I don't recommend you to process this data with an SQL query. Its not bulletproof and you don't have a tools to validate the data. Why? You would have to work strictly on strings that can lead to broken data. Not to mention that creating and testing a proper query would take ages. Solution What I would recommend is to do it through CLI Joomla! application. ...


1

You could group each set of field by the key. Call the parameter and convert to array: $social_links = $params->get('social_links'); $array_links = json_decode($social_links, true); Create a function in your helper.php that will group them by key public function group_by_key($array) { $result = array(); foreach ($array as $sub) { ...


1

By default Repeatable initialised on load event, so you have time to change the value on ready event, that occurs before load event. jQuery(document).ready(function(){ jQuery('#jform_repeatable_id').val('json string of your new value'); })


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