function hook_updater_info

Same name in other branches
  1. 7.x modules/system/system.api.php \hook_updater_info()
  2. 9 core/lib/Drupal/Core/Extension/module.api.php \hook_updater_info()
  3. 10 core/lib/Drupal/Core/Extension/module.api.php \hook_updater_info()
  4. 11.x core/lib/Drupal/Core/Extension/module.api.php \hook_updater_info()

Provide information on Updaters (classes that can update Drupal).

Drupal\Core\Updater\Updater is a class that knows how to update various parts of the Drupal file system, for example to update modules that have newer releases, or to install a new theme.

Return value

An associative array of information about the updater(s) being provided. This array is keyed by a unique identifier for each updater, and the values are subarrays that can contain the following keys:

  • class: The name of the PHP class which implements this updater.
  • name: Human-readable name of this updater.
  • weight: Controls what order the Updater classes are consulted to decide which one should handle a given task. When an update task is being run, the system will loop through all the Updater classes defined in this registry in weight order and let each class respond to the task and decide if each Updater wants to handle the task. In general, this doesn't matter, but if you need to override an existing Updater, make sure your Updater has a lighter weight so that it comes first.

See also

drupal_get_updaters()

hook_updater_info_alter()

Related topics

1 function implements hook_updater_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

system_updater_info in core/modules/system/system.module
Implements hook_updater_info().
1 invocation of hook_updater_info()
drupal_get_updaters in core/includes/common.inc
Assembles the Drupal Updater registry.

File

core/lib/Drupal/Core/Extension/module.api.php, line 899

Code

function hook_updater_info() {
    return [
        'module' => [
            'class' => 'Drupal\\Core\\Updater\\Module',
            'name' => t('Update modules'),
            'weight' => 0,
        ],
        'theme' => [
            'class' => 'Drupal\\Core\\Updater\\Theme',
            'name' => t('Update themes'),
            'weight' => 0,
        ],
    ];
}

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