Commit 99257010 authored by catch's avatar catch

Issue #2102447 by disasm, vijaycs85, ACF: Remove drupal_set_title() in entity module controllers.

parent 8b6fdb56
......@@ -16,6 +16,7 @@ entity.view_mode_add:
path: '/admin/structure/display-modes/view/add'
defaults:
_content: '\Drupal\entity\Controller\EntityDisplayModeController::viewModeTypeSelection'
_title: 'Choose view mode entity type'
requirements:
_permission: 'administer display modes'
......@@ -51,6 +52,7 @@ entity.form_mode_add:
path: '/admin/structure/display-modes/form/add'
defaults:
_content: '\Drupal\entity\Controller\EntityDisplayModeController::formModeTypeSelection'
_title: 'Choose form mode entity type'
requirements:
_permission: 'administer display modes'
......
......@@ -49,7 +49,6 @@ public static function create(ContainerInterface $container) {
* A list of entity types to add a view mode for.
*/
public function viewModeTypeSelection() {
drupal_set_title(t('Choose view mode entity type'));
$entity_types = array();
foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) {
if ($entity_info['fieldable'] && isset($entity_info['controllers']['view_builder'])) {
......@@ -73,7 +72,6 @@ public function viewModeTypeSelection() {
* A list of entity types to add a form mode for.
*/
public function formModeTypeSelection() {
drupal_set_title(t('Choose form mode entity type'));
$entity_types = array();
foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) {
if ($entity_info['fieldable'] && isset($entity_info['controllers']['form'])) {
......
......@@ -24,7 +24,10 @@ class EntityDisplayModeAddForm extends EntityDisplayModeFormBase {
*/
public function buildForm(array $form, array &$form_state, $entity_type = NULL) {
$this->entityType = $entity_type;
return parent::buildForm($form, $form_state);
$form = parent::buildForm($form, $form_state);
$definition = $this->entityManager->getDefinition($this->entityType);
$form['#title'] = $this->t('Add new %label @entity-type', array('%label' => $definition['label'], '@entity-type' => strtolower($this->entityInfo['label'])));
return $form;
}
/**
......@@ -45,7 +48,6 @@ protected function prepareEntity() {
throw new NotFoundHttpException();
}
drupal_set_title(t('Add new %label @entity-type', array('%label' => $definition['label'], '@entity-type' => strtolower($this->entityInfo['label']))), PASS_THROUGH);
$this->entity->targetEntityType = $this->entityType;
}
......
......@@ -23,7 +23,6 @@ protected function prepareEntity() {
throw new NotFoundHttpException();
}
drupal_set_title(t('Add new %label @entity-type', array('%label' => $definition['label'], '@entity-type' => strtolower($this->entityInfo['label']))), PASS_THROUGH);
$this->entity->targetEntityType = $this->entityType;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment