Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ConfigEntityUpdater.php

function ConfigEntityUpdater::doOne

Apply the callback an entity and save it if the callback makes changes.

Parameters

\Drupal\Core\Config\Entity\ConfigEntityInterface $entity: The entity to potentially update.

callable $callback: The callback to apply.

1 call to ConfigEntityUpdater::doOne()
ConfigEntityUpdater::update in core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php
Updates configuration entities as part of a Drupal update.

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php, line 189

Class

ConfigEntityUpdater
A utility class to make updating configuration entities simple.

Namespace

Drupal\Core\Config\Entity

Code

protected function doOne(ConfigEntityInterface $entity, callable $callback) {
    if (call_user_func($callback, $entity)) {
        $entity->trustData();
        $entity->save();
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal