55 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?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;
 | |
| 	}
 | |
| }
 |