Add required CSS and Javascript requirements for managing documents

@return $this
334688
protected function addRequirements()
    {
        // Javascript to customize the grid field for the DMS document (overriding entwine
        // in FRAMEWORK_DIR.'/javascript/GridField.js'
        Requirements::javascript(DMS_DIR . '/javascript/DMSGridField.js');
        Requirements::css(DMS_DIR . '/dist/css/dmsbundle.css');

        // Javascript for the link editor pop-up in TinyMCE
        Requirements::javascript(DMS_DIR . '/javascript/DocumentHtmlEditorFieldToolbar.js');

        return $this;
    }
1156833
public function disDocumentFiles()
    {
        $properties     = $this->getProperties();
        $acceptedFiles  = $properties['acceptedFiles'];
        $docsExt        = $this->getDocumentExtensionConstant();
        $acceptedFiles  = $this->rmAcceptedFiles($acceptedFiles, $docsExt);
        $properties['acceptedFiles']    = $acceptedFiles;
        $this->setProperties($properties);
        return $this;
    }
1227195
public function appendRequiredFields($requiredFields)
    {
        $this->required = $this->required + ArrayLib::valuekey(
            $requiredFields->getRequired()
        );

        return $this;
    }
1317910
public function addRule()
    {
        foreach ($this->rules as $field => $rule) {
            $this->validation->addRule($field, $rule);
        }

        return $this;
    }
66983
public function setRequirements()
    {
        if (!isset($this->options['requirements']) || $this->options['requirements'] === null) {
            return $this;
        }

        $requirements = $this->options['requirements'];

        if (!is_array($requirements)) {
            $requirements = [$requirements];
        }

        foreach ($requirements as $constraint) {
            $this->requirements[] = $constraint;
        }

        unset($this->options['requirements']);

        return $this;
    }
522087
protected function minifyJs()
    {
        $minifier = new Minify\JS();

        // Components
        $this->addJsToMinifier($minifier, 'dropdowns', 'dropdown');

        // Components w/ JavaScript
        $this->addJsToMinifier($minifier, 'modals', 'modal');
        $this->addJsToMinifier($minifier, 'tooltip');
        $this->addJsToMinifier($minifier, 'popovers', 'popover');
        $this->addJsToMinifier($minifier, 'carousel');

        // Pure JavaScript components
        $this->addJsToMinifier($minifier, 'affix');
        $this->addJsToMinifier($minifier, 'alert');
        $this->addJsToMinifier($minifier, 'button');
        $this->addJsToMinifier($minifier, 'collapse');
        $this->addJsToMinifier($minifier, 'scrollspy');
        $this->addJsToMinifier($minifier, 'tab');
        $this->addJsToMinifier($minifier, 'transition');

        return $minifier->minify();
    }
805590
public function required($fields = [])
    {
        $fields = $fields ?: $this->fields();

        foreach ($fields as $field) {
            if (is_string($field)) {
                $this->field($field)->required();
                continue;
            }

            /* @var Field $field */
            $field->required();
        }

        return $this;
    }
554293
public function enableAutofocus()
    {
        static $enabled = false;
        
        if (!$enabled) {
            $script = "$(document).ready(function(){"
                    . "\$(this).find('[autofocus]:first').focus();"
                    . "});";
            $this->registerScript($script);
            $enabled = true;
        }
        
        return $this;
    }
156596
public function attachScripts()
    {
        if ($this->isScriptsAttached())
            return $this;

        $view = $this->getView();
        $view->inlineScript()
            // we can change target of js files with static_uri_helper config key
            ->appendFile($view->staticsUri('Yima.Widgetator.JS.Jquery.Json'))
            ->appendFile($view->staticsUri('Yima.Widgetator.JS.Jquery.Ajaxq'))
            ->appendFile($view->staticsUri('Yima.Widgetator.JS.Jquery.WidgetAjaxy'))

            /*
            ->appendScript(
                str_replace(
                    '{{url}}',
                    $view->url('yimaWidgetator_restLoadWidget'),
                    file_get_contents(__DIR__.DS.'WidgetAjaxy.js')
                )
            )
            */
        ;

        $this->isScriptAttached = true;

        return $this;
    }
712777
public function validateRequired()
    {
        $this->validator_attributes[] = 'data-parsley-required';

        $this->field_required = true;

        $this->validator_checks['required'] = true;

        return $this;
    }
646377
public function addRequire($require, $version = '*', $overwrite = false)
    {
        if (!isset($this->getRequire()->$require) || $overwrite) {
            $this->getRequire()->$require = $version;
        }

        return $this;
    }
581756
public function addThemeSupports()
    {
        load_theme_textdomain('novusopress', $this->paths->getBaseLanguageDir());

        add_theme_support('title-tag');
        add_theme_support('automatic-feed-links');
        add_theme_support('post-thumbnails');
        add_theme_support('html5', ['search-form', 'comment-form', 'comment-list', 'gallery', 'caption']);

        register_nav_menus(['main-menu' => __('Main Menu', 'novusopress')]);

        if ($this->getThemeOption('clean_document_head')) {
            $this->cleanDocumentHead();
        }

        if (file_exists(sprintf('%s/css/editor-style.css', $this->paths->getThemeAssetsDir()))) {
            add_editor_style('assets/css/editor-style.css');
        }
    }
738502
protected function applyRules()
    {
        // Check if there are rules for this field
        $rules_key = 'images.' . ($this->name ?: 'default');
        if (!$rules = Former::getRules($rules_key)) {
            return;
        }

        // If there already is an image, drop the forced requirement
        if ($this->hasImage() && array_key_exists('required', $rules)) {
            unset($rules['required']);
            $this->addClass('required'); // So the icon shows up
        }

        // Apply rules using Former's LiveValidation
        $live = new LiveValidation($this);
        $live->apply($rules);
    }
1000153
public static function setupTheme()
    {
        /*
         * Enable plugins to manage the document title
         * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Title_Tag
         * */
        add_theme_support('title-tag');

        /*
         * Register wp_nav_menus() menus
         * @link    http://codex.wordpress.org/Function_Reference/register_nav_menus
         * */
        register_nav_menus([
          'primary_navigation' => __('Navigation principale', 'quai10'),
          'footer1'            => __('Pied de page – colonne 1', 'quai10'),
          'footer2'            => __('Pied de page – colonne 2', 'quai10'),
          'footer3'            => __('Pied de page – colonne 3', 'quai10'),
        ]);

        /*
         * Add post thumnails
         * @link http://codex.wordpress.org/Post_Thumbnails
         * */
        add_theme_support('post-thumbnails');
        set_post_thumbnail_size(250, 250);

        /*
         * Add post formats
         * @link http://codex.wordpress.org/Post_Formats
         * */
        add_theme_support('post-formats', ['image']);

        /*
         * Add HTML5 Markup for captions
         * @link http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5
         * */
        add_theme_support('html5', ['caption', 'comment-form', 'comment-list']);
    }
1011879
function add_css()
    {
        if ($this->css_loaded) {
            return;
        }

        $skin_path = $this->enigma->local_skin_path();
        $this->enigma->include_stylesheet("$skin_path/enigma.css");
        $this->css_loaded = true;
    }
908625
public function addAssets()
    {
        if ($this->enabled()) {

            // Only add assets if Page is HTML
            $page = $this->grav['page'];
            if ($page->templateFormat() !== 'html') {
                return $this;
            }

            /** @var Assets $assets */
            $assets = $this->grav['assets'];

            // Add jquery library
            $assets->add('jquery', 101);

            $this->renderer = $this->debugbar->getJavascriptRenderer();
            $this->renderer->setIncludeVendors(false);

            // Get the required CSS files
            list($css_files, $js_files) = $this->renderer->getAssets(null, JavascriptRenderer::RELATIVE_URL);
            foreach ((array)$css_files as $css) {
                $assets->addCss($css);
            }

            $assets->addCss('/system/assets/debugger.css');

            foreach ((array)$js_files as $js) {
                $assets->addJs($js);
            }
        }

        return $this;
    }
325241
public function addCss($css)
    {
        $this->addHook(function($document) use ($css) {
            $document->addCss('/'.$css);
        });

        return $this;
    }