class ManyAssetsTestHooks

Hook implementations for many_assets_test.

Hierarchy

Expanded class hierarchy of ManyAssetsTestHooks

File

core/modules/system/tests/modules/many_assets_test/src/Hook/ManyAssetsTestHooks.php, line 12

Namespace

Drupal\many_assets_test\Hook
View source
class ManyAssetsTestHooks {
    
    /**
     * Implements hook_library_info_build().
     */
    public function libraryInfoBuild() {
        $libraries = [];
        // Load the local javascript as an "external" asset varied by query string.
        $base_javascript = \Drupal::request()->getBasePath() . '/' . \Drupal::service('extension.list.module')->getPath('many_assets_test') . '/js/noop.js';
        $base_css = \Drupal::request()->getBasePath() . '/' . \Drupal::service('extension.list.module')->getPath('many_assets_test') . '/css/noop.css';
        // Build a library dependency containing 100 javascript assets.
        for ($i = 1; $i <= 150; $i++) {
            $libraries['many-dependencies']['js'][$base_javascript . '?dep' . $i] = [
                'type' => 'external',
            ];
            $libraries['many-dependencies']['css']['component'][$base_css . '?dep' . $i] = [
                'type' => 'external',
            ];
        }
        return $libraries;
    }

}

Members

Title Sort descending Modifiers Object type Summary
ManyAssetsTestHooks::libraryInfoBuild public function Implements hook_library_info_build().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.