createRenameName example

    // Node type is a good example of a configuration entity that renames other     // configuration when it is renamed.     // @see \Drupal\node\Entity\NodeType::postSave()     foreach ($this->targetNames[$collection] as $name) {
      $data = $this->getTargetStorage($collection)->read($name);
      if (isset($data['uuid']) && isset($create_uuids[$data['uuid']])) {
        // Remove the item from the create list.         $this->removeFromChangelist($collection, 'create', $create_uuids[$data['uuid']]);
        // Remove the item from the delete list.         $this->removeFromChangelist($collection, 'delete', $name);
        // Create the rename name.         $renames[] = $this->createRenameName($name$create_uuids[$data['uuid']]);
      }
    }

    $this->addChangeList($collection, 'rename', $renames);
  }

  /** * Removes the entry from the given operation changelist for the given name. * * @param string $collection * The storage collection to operate on. * @param string $op * The changelist to act on. Either delete, create, rename or update. * @param string $name * The name of the configuration to remove. */
Home | Imprint | This part of the site doesn't use cookies.