public function NodeTypeMapper::setEntity in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/node/src/ConfigTranslation/NodeTypeMapper.php \Drupal\node\ConfigTranslation\NodeTypeMapper::setEntity()
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 21 - Contains \Drupal\node\ConfigTranslation\NodeTypeMapper.
Class
- NodeTypeMapper
- Provides a configuration mapper for node types.
Namespace
Drupal\node\ConfigTranslationCode
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());
}
}