acf
This commit is contained in:
54
plugins/fields/acfdownloadbutton/acfdownloadbutton.php
Normal file
54
plugins/fields/acfdownloadbutton/acfdownloadbutton.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?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 PlgFieldsACFDownloadButton extends ACF_Field
|
||||
{
|
||||
/**
|
||||
* Transforms the field into a DOM XML element and appends it as a child on the given parent.
|
||||
*
|
||||
* @param stdClass $field The field.
|
||||
* @param DOMElement $parent The field node parent.
|
||||
* @param Form $form The form.
|
||||
*
|
||||
* @return DOMElement
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
public function onCustomFieldsPrepareDom($field, DOMElement $parent, Joomla\CMS\Form\Form $form)
|
||||
{
|
||||
if (!$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form))
|
||||
{
|
||||
return $fieldNode;
|
||||
}
|
||||
|
||||
$fieldNode->setAttribute('type', 'filelist');
|
||||
$fieldNode->setAttribute('hide_default', true);
|
||||
$fieldNode->setAttribute('directory', $field->fieldparams->get('directory', 'images'));
|
||||
$fieldNode->setAttribute('filter', $field->fieldparams->get('filter', ''));
|
||||
$fieldNode->setAttribute('exclude', $field->fieldparams->get('exclude', ''));
|
||||
$fieldNode->setAttribute('class', '');
|
||||
|
||||
return $fieldNode;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user