acf
This commit is contained in:
66
plugins/fields/acfcurrency/acfcurrency.php
Normal file
66
plugins/fields/acfcurrency/acfcurrency.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Advanced Custom Fields
|
||||
* @version 2.8.8 Pro
|
||||
*
|
||||
* @author Tassos Marinos <info@tassos.gr>
|
||||
* @link http://www.tassos.gr
|
||||
* @copyright Copyright © 2020 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 PlgFieldsACFCurrency extends ACF_Field
|
||||
{
|
||||
/**
|
||||
* Override the field type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $overrideType = 'NR_Currencies';
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
require_once JPATH_PLUGINS . '/system/nrframework/fields/currencies.php';
|
||||
|
||||
$class = new \JFormFieldNR_Currencies();
|
||||
$currencies = $class->currencies;
|
||||
|
||||
foreach ($options as $option)
|
||||
{
|
||||
if (!isset($currencies[$option->getValue()]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$option->setLabel($currencies[$option->getValue()]);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user