CoreFiles by mySites.guru
Editor.php52 lines, 1,494 bytes, from Joomla_6.0.4-Stable-Full_Package.zip
Raw History Compare with 6.0.3
md5
158e8938cd199416963ca4d8c3effc15
sha1
4c9967b76dfc1543bf69a0b32cdfd1a17821e4ad
sha256
3239e8939e7763b935ee591431442d9940c27c3a84007c948061bca4d97f9e07
<?php

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

namespace Joomla\Plugin\Fields\Editor\Extension;

use Joomla\CMS\Form\Form;
use Joomla\Component\Fields\Administrator\Plugin\FieldsPlugin;
use Joomla\Event\SubscriberInterface;

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

/**
 * Fields Editor Plugin
 *
 * @since  3.7.0
 */
final class Editor extends FieldsPlugin implements SubscriberInterface
{
    /**
     * 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('buttons', $field->fieldparams->get('buttons', $this->params->get('buttons', 0)) ? 'true' : 'false');
        $fieldNode->setAttribute('hide', implode(',', $field->fieldparams->get('hide', [])));

        return $fieldNode;
    }
}

The same content is in 131 releases, Joomla 5.1.0-rc1 to 6.2.1-rc1. See them all, or every version of this file.