function ConfigEntityMapper::setType

Same name and namespace in other branches
  1. 9 core/modules/config_translation/src/ConfigEntityMapper.php \Drupal\config_translation\ConfigEntityMapper::setType()
  2. 8.9.x core/modules/config_translation/src/ConfigEntityMapper.php \Drupal\config_translation\ConfigEntityMapper::setType()
  3. 10 core/modules/config_translation/src/ConfigEntityMapper.php \Drupal\config_translation\ConfigEntityMapper::setType()

Set entity type for this mapper.

This should be set in initialization. A mapper that knows its type but not yet its names is still useful for router item and tab generation. The concrete entity only turns out later with actual controller invocations, when the setEntity() method is invoked before the rest of the methods are used.

Parameters

string $entity_type_id: The entity type ID to set.

Return value

bool TRUE if the entity type ID was set correctly; FALSE otherwise.

Overrides ConfigEntityMapperInterface::setType

1 call to ConfigEntityMapper::setType()
ConfigEntityMapper::__construct in core/modules/config_translation/src/ConfigEntityMapper.php
Constructs a ConfigEntityMapper.

File

core/modules/config_translation/src/ConfigEntityMapper.php, line 163

Class

ConfigEntityMapper
Configuration mapper for configuration entities.

Namespace

Drupal\config_translation

Code

public function setType(string $entity_type_id) : bool {
  if (isset($this->entityType)) {
    return FALSE;
  }
  $this->entityType = $entity_type_id;
  return TRUE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.