CoreFiles by mySites.guru
gallery.php55 lines, 1,378 bytes, from Joomla_3.7.0-beta2-Beta-Full_Package.zip
Raw History Compare with 3.7.0-beta1
md5
a189eb86810b4b2fffdec60c4aaaac5f
sha1
103a67b39a3634b574dea092250e098785ca22d8
sha256
7307477c3f108f4e5c3015ac1d502cad78155e9575ab48fe6f4245faa74e0851
<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Gallery
 *
 * @copyright   Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Gallery Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsGallery extends FieldsPlugin
{
	/**
	 * Transforms the field into an XML element and appends it as child on the given parent. This
	 * is the default implementation of a field. Form fields which do support to be transformed into
	 * an XML Element must implement the JFormDomfieldinterface.
	 *
	 * @param   stdClass    $field   The field.
	 * @param   DOMElement  $parent  The field node parent.
	 * @param   JForm       $form    The form.
	 *
	 * @return  DOMElement
	 *
	 * @since   3.7.0
	 */
	public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
	{
		$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);

		if (!$fieldNode)
		{
			return $fieldNode;
		}

		$directory = $fieldNode->getAttribute('directory');

		// Can be empty when the plugin doesn't get saved.
		if (!$directory)
		{
			$directory = 'images';
		}

		$fieldNode->setAttribute('directory', $directory);

		return $fieldNode;
	}
}

The same content is in 3 releases, Joomla 3.7.0-beta1 to 3.7.0-beta3. See them all, or every version of this file.