This commit is contained in:
2024-12-31 11:07:09 +01:00
parent df7915205d
commit e089172b15
1916 changed files with 165422 additions and 271 deletions

View File

@ -0,0 +1,64 @@
<?php
/**
* @package Advanced Custom Fields
* @version 2.8.8 Pro
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2019 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
JLoader::register('ACF_Field', JPATH_PLUGINS . '/system/acf/helper/plugin.php');
if (!class_exists('ACF_Field'))
{
Factory::getApplication()->enqueueMessage('Advanced Custom Fields System Plugin is missing', 'error');
return;
}
class PlgFieldsACFAddress extends ACF_Field
{
/**
* Update the label of the field in filters.
*
* @param \Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection $options
*
* @return \Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection
*/
public function onJFiltersOptionsAfterCreation(\Bluecoder\Component\Jfilters\Administrator\Model\Filter\Option\Collection $options)
{
// Make sure it is a field of that type
if ($options->getFilterItem()->getAttributes()->get('type') !== $this->_name)
{
return $options;
}
foreach ($options as $option)
{
$data = $option->getData();
$data = is_string($data->value) && json_decode($data->value, true) ? json_decode($data->value, true) : false;
if (!$data)
{
continue;
}
$address = isset($data['address']['address']) ? $data['address']['address'] : '';
if (!$address)
{
continue;
}
$option->setLabel($address);
}
return $options;
}
}