NodeTypeMapper::setEntity

public NodeTypeMapper::setEntity(ConfigEntityInterface $entity)

Sets the entity instance for this mapper.

This method can only be invoked when the concrete entity is known, that is in a request for an entity translation path. After this method is called, the mapper is fully populated with the proper display title and configuration names to use to check permissions or display a translation screen.

Parameters

\Drupal\Core\Config\Entity\ConfigEntityInterface $entity: The configuration entity to set.

Return value

bool TRUE, if the entity was set successfully; FALSE otherwise.

Overrides ConfigEntityMapper::setEntity

File

core/modules/node/src/ConfigTranslation/NodeTypeMapper.php, line 16

Class

NodeTypeMapper
Provides a configuration mapper for node types.

Namespace

Drupal\node\ConfigTranslation

Code

public function setEntity(ConfigEntityInterface $entity) {
  parent::setEntity($entity);

  // Adds the title label to the translation form.
  $node_type = $entity->id();
  $config = $this->configFactory->get("core.base_field_override.node.$node_type.title");
  if (!$config->isNew()) {
    $this->addConfigName($config->getName());
  }
}
doc_Drupal
2016-10-29 09:31:46
Comments
Leave a Comment

Please login to continue.