CoreFiles by mySites.guru
url.php53 lines, 1,354 bytes, from Joomla_4.2.4-Stable-Full_Package.zip
Raw History Compare with 4.2.3
md5
e5116bce6e7da830ee5740990c2948ba
sha1
79d4ce349b70ad5a2c4c436a5da2ad4d68acbb2f
sha256
6b812d1726c7c0990aab4d38a69a015cd2023649b1d06ecc1374a01037262023
<?php

/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.URL
 *
 * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt

 * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
 */

use Joomla\CMS\Form\Form;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Fields URL Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsUrl extends \Joomla\Component\Fields\Administrator\Plugin\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   Form        $form    The form.
     *
     * @return  DOMElement
     *
     * @since   3.7.0
     */
    public function onCustomFieldsPrepareDom($field, DOMElement $parent, Form $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 17 releases, Joomla 4.2.1 to 4.3.0-alpha3. See them all, or every version of this file.