class ModuleUpdateRequirementsHooks

Hook implementations for module_update_requirements.

Hierarchy

Expanded class hierarchy of ModuleUpdateRequirementsHooks

File

core/modules/system/tests/modules/module_update_requirements/src/Hook/ModuleUpdateRequirementsHooks.php, line 14

Namespace

Drupal\module_update_requirements\Hook
View source
class ModuleUpdateRequirementsHooks {
  use StringTranslationTrait;
  
  /**
   * Implements hook_update_requirements().
   */
  public function updateRequirements() : array {
    return [
      'test.update.error' => [
        'title' => $this->t('UpdateError'),
        'value' => $this->t('None'),
        'description' => $this->t('Update Error.'),
        'severity' => RequirementSeverity::Error,
      ],
      'test.update.error.alter' => [
        'title' => $this->t('UpdateError'),
        'value' => $this->t('None'),
        'description' => $this->t('Update Error.'),
        'severity' => RequirementSeverity::Error,
      ],
    ];
  }
  
  /**
   * Implements hook_update_requirements_alter().
   */
  public function updateRequirementsAlter(array &$requirements) : void {
    $requirements['test.update.error.alter'] = [
      'title' => $this->t('UpdateWarning'),
      'value' => $this->t('None'),
      'description' => $this->t('Update Warning.'),
      'severity' => RequirementSeverity::Warning,
    ];
  }

}

Members

Title Sort descending Modifiers Object type Summary Overrides
ModuleUpdateRequirementsHooks::updateRequirements public function Implements hook_update_requirements().
ModuleUpdateRequirementsHooks::updateRequirementsAlter public function Implements hook_update_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.