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

Breadcrumb

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

function EntityMethod::apply

Overrides ConfigActionPluginInterface::apply

File

core/lib/Drupal/Core/Config/Action/Plugin/ConfigAction/EntityMethod.php, line 89

Class

EntityMethod
Makes config entity methods with the ActionMethod attribute into actions.

Namespace

Drupal\Core\Config\Action\Plugin\ConfigAction

Code

public function apply(string $configName, mixed $value) : void {
    
    /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface|null $entity */
    $entity = $this->configManager
        ->loadConfigEntityByName($configName);
    if ($this->exists
        ->returnEarly($configName, $entity)) {
        return;
    }
    $entity = $this->pluralized ? $this->applyPluralized($entity, $value) : $this->applySingle($entity, $value);
    $entity->save();
}

API Navigation

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