You are here

configuration_update_hook.php.twig in Update helper 8

{% block file_methods %}
{% if not file_exists %}
{% include 'module/php_tag.php.twig' %}
{% endif %}

/**
 * {{ description }}
 */
function {{ update_hook_name }}() {
  /** @var \Drupal\update_helper\Updater $updateHelper */
  $updateHelper = \Drupal::service('update_helper.updater');

  // Execute configuration update definitions with logging of success.
  $updateHelper->executeUpdate('{{ module }}', '{{ update_hook_name }}');

  // Output logged messages to related channel of update execution.
  return $updateHelper->logger()->output();
}
{% endblock %}

File

templates/console/configuration_update_hook.php.twig
View source
  1. {% block file_methods %}
  2. {% if not file_exists %}
  3. {% include 'module/php_tag.php.twig' %}
  4. {% endif %}
  5. /**
  6. * {{ description }}
  7. */
  8. function {{ update_hook_name }}() {
  9. /** @var \Drupal\update_helper\Updater $updateHelper */
  10. $updateHelper = \Drupal::service('update_helper.updater');
  11. // Execute configuration update definitions with logging of success.
  12. $updateHelper->executeUpdate('{{ module }}', '{{ update_hook_name }}');
  13. // Output logged messages to related channel of update execution.
  14. return $updateHelper->logger()->output();
  15. }
  16. {% endblock %}