You are here

NodeTypeMapper.php in Zircon Profile 8

Same filename and directory in other branches
  1. 8.0 core/modules/node/src/ConfigTranslation/NodeTypeMapper.php

File

core/modules/node/src/ConfigTranslation/NodeTypeMapper.php
View source
<?php

/**
 * @file
 * Contains \Drupal\node\ConfigTranslation\NodeTypeMapper.
 */
namespace Drupal\node\ConfigTranslation;

use Drupal\config_translation\ConfigEntityMapper;
use Drupal\Core\Config\Entity\ConfigEntityInterface;

/**
 * Provides a configuration mapper for node types.
 */
class NodeTypeMapper extends ConfigEntityMapper {

  /**
   * {@inheritdoc}
   */
  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());
    }
  }

}

Classes

Namesort descending Description
NodeTypeMapper Provides a configuration mapper for node types.