CoreFiles by mySites.guru
url.php50 lines, 1,137 bytes, from Joomla_3.7.2-Stable-Full_Package.zip
Raw History Compare with 3.7.1
md5
53ee1476dfd23ab125089289b21a6ab8
sha1
dd4fa0c730bbbf74053b2882225190035df9ebb5
sha256
f762bb4663f396d71a9464dde9c638b2ec1070973083d5c5ed3125ac74ec3407
<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.URL
 *
 * @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 URL Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsUrl extends FieldsPlugin
{
	/**
	 * 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   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;
		}

		$fieldNode->setAttribute('validate', 'url');

		if (! $fieldNode->getAttribute('relative'))
		{
			$fieldNode->removeAttribute('relative');
		}

		return $fieldNode;
	}
}

The same content is in 29 releases, Joomla 3.7.0-rc1 to 3.8.3. See them all, or every version of this file.