class ModuleRuntimeRequirementsHooks

Hook implementations for module_runtime_requirements.

Hierarchy

Expanded class hierarchy of ModuleRuntimeRequirementsHooks

File

core/modules/system/tests/modules/module_runtime_requirements/src/Hook/ModuleRuntimeRequirementsHooks.php, line 13

Namespace

Drupal\module_runtime_requirements\Hook
View source
class ModuleRuntimeRequirementsHooks {
    use StringTranslationTrait;
    
    /**
     * Implements hook_runtime_requirements().
     */
    public function runtimeRequirements() : array {
        return [
            'test.runtime.error' => [
                'title' => $this->t('RuntimeError'),
                'value' => $this->t('None'),
                'description' => $this->t('Runtime Error.'),
                'severity' => REQUIREMENT_ERROR,
            ],
            'test.runtime.error.alter' => [
                'title' => $this->t('RuntimeError'),
                'value' => $this->t('None'),
                'description' => $this->t('Runtime Error.'),
                'severity' => REQUIREMENT_ERROR,
            ],
        ];
    }
    
    /**
     * Implements hook_runtime_requirements_alter().
     */
    public function runtimeRequirementsAlter(array &$requirements) : void {
        $requirements['test.runtime.error.alter'] = [
            'title' => $this->t('RuntimeWarning'),
            'value' => $this->t('None'),
            'description' => $this->t('Runtime Warning.'),
            'severity' => REQUIREMENT_WARNING,
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overrides
ModuleRuntimeRequirementsHooks::runtimeRequirements public function Implements hook_runtime_requirements().
ModuleRuntimeRequirementsHooks::runtimeRequirementsAlter public function Implements hook_runtime_requirements_alter().
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language. 1

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