<?php
/**
 * @package         Advanced Module Manager
 * @version         9.5.6
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://regularlabs.com
 * @copyright       Copyright © 2023 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

namespace RegularLabs\Plugin\System\AdvancedModules;

defined('_JEXEC') or die;

use Joomla\CMS\Form\Form as JForm;
use RegularLabs\Library\Document as RL_Document;

class ModuleForm
{
    public static function cleanup($form)
    {
        if ( ! ($form instanceof JForm))
        {
            return;
        }

        if ( ! RL_Document::isClient('site'))
        {
            return;
        }

        // Check we are manipulating a valid form.
        if ($form->getName() !== 'com_config.modules')
        {
            return;
        }

        $form->removeField('ordering');
        $form->removeField('publish_up');
        $form->removeField('publish_down');
        $form->removeField('language');
        $form->setFieldAttribute('note', 'label', 'JGLOBAL_DESCRIPTION');
    }
}
