Issue #2073075 by vanilla-bear, joshi.rohit100, swentel, marcingy, er.pushpinderrana, ACF, roderik: Don't call the t() function in OO code in the field_ui module
parent
a9f9c0316d
commit
76ca5b08cc
|
@ -60,7 +60,7 @@ class EntityDisplayModeListBuilder extends ConfigEntityListBuilder {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildHeader() {
|
||||
$header['label'] = t('Name');
|
||||
$header['label'] = $this->t('Name');
|
||||
return $header + parent::buildHeader();
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ class EntityDisplayModeListBuilder extends ConfigEntityListBuilder {
|
|||
'data' => array(
|
||||
'#type' => 'link',
|
||||
'#url' => Url::fromRoute($short_type == 'view' ? 'entity.entity_view_mode.add_form' : 'entity.entity_form_mode.add_form', ['entity_type_id' => $entity_type]),
|
||||
'#title' => t('Add new %label @entity-type', array('%label' => $this->entityTypes[$entity_type]->getLabel(), '@entity-type' => $this->entityType->getLowercaseLabel())),
|
||||
'#title' => $this->t('Add new %label @entity-type', array('%label' => $this->entityTypes[$entity_type]->getLabel(), '@entity-type' => $this->entityType->getLowercaseLabel())),
|
||||
),
|
||||
'colspan' => count($table['#header']),
|
||||
);
|
||||
|
|
|
@ -85,12 +85,12 @@ class FieldStorageConfigListBuilder extends ConfigEntityListBuilder {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildHeader() {
|
||||
$header['id'] = t('Field name');
|
||||
$header['id'] = $this->t('Field name');
|
||||
$header['type'] = array(
|
||||
'data' => t('Field type'),
|
||||
'data' => $this->t('Field type'),
|
||||
'class' => array(RESPONSIVE_PRIORITY_MEDIUM),
|
||||
);
|
||||
$header['usage'] = t('Used in');
|
||||
$header['usage'] = $this->t('Used in');
|
||||
return $header;
|
||||
}
|
||||
|
||||
|
@ -100,14 +100,14 @@ class FieldStorageConfigListBuilder extends ConfigEntityListBuilder {
|
|||
public function buildRow(EntityInterface $field_storage) {
|
||||
if ($field_storage->isLocked()) {
|
||||
$row['class'] = array('menu-disabled');
|
||||
$row['data']['id'] = t('@field_name (Locked)', array('@field_name' => $field_storage->getName()));
|
||||
$row['data']['id'] = $this->t('@field_name (Locked)', array('@field_name' => $field_storage->getName()));
|
||||
}
|
||||
else {
|
||||
$row['data']['id'] = $field_storage->getName();
|
||||
}
|
||||
|
||||
$field_type = $this->fieldTypes[$field_storage->getType()];
|
||||
$row['data']['type'] = t('@type (module: @module)', array('@type' => $field_type['label'], '@module' => $field_type['provider']));
|
||||
$row['data']['type'] = $this->t('@type (module: @module)', array('@type' => $field_type['label'], '@module' => $field_type['provider']));
|
||||
|
||||
$usage = array();
|
||||
foreach ($field_storage->getBundles() as $bundle) {
|
||||
|
|
|
@ -19,7 +19,7 @@ class EntityDisplayModeDeleteForm extends EntityDeleteForm {
|
|||
*/
|
||||
public function getDescription() {
|
||||
$entity_type = $this->entity->getEntityType();
|
||||
return t('Deleting a @entity-type will cause any output still requesting to use that @entity-type to use the default display settings.', array('@entity-type' => $entity_type->getLowercaseLabel()));
|
||||
return $this->t('Deleting a @entity-type will cause any output still requesting to use that @entity-type to use the default display settings.', array('@entity-type' => $entity_type->getLowercaseLabel()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -76,14 +76,14 @@ abstract class EntityDisplayModeFormBase extends EntityForm {
|
|||
public function form(array $form, FormStateInterface $form_state) {
|
||||
$form['label'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Name'),
|
||||
'#title' => $this->t('Name'),
|
||||
'#maxlength' => 100,
|
||||
'#default_value' => $this->entity->label(),
|
||||
);
|
||||
|
||||
$form['id'] = array(
|
||||
'#type' => 'machine_name',
|
||||
'#description' => t('A unique machine-readable name. Can only contain lowercase letters, numbers, and underscores.'),
|
||||
'#description' => $this->t('A unique machine-readable name. Can only contain lowercase letters, numbers, and underscores.'),
|
||||
'#disabled' => !$this->entity->isNew(),
|
||||
'#default_value' => $this->entity->id(),
|
||||
'#field_prefix' => $this->entity->isNew() ? $this->entity->getTargetType() . '.' : '',
|
||||
|
@ -122,7 +122,7 @@ abstract class EntityDisplayModeFormBase extends EntityForm {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function save(array $form, FormStateInterface $form_state) {
|
||||
drupal_set_message(t('Saved the %label @entity-type.', array('%label' => $this->entity->label(), '@entity-type' => $this->entityType->getLowercaseLabel())));
|
||||
drupal_set_message($this->t('Saved the %label @entity-type.', array('%label' => $this->entity->label(), '@entity-type' => $this->entityType->getLowercaseLabel())));
|
||||
$this->entity->save();
|
||||
\Drupal::entityManager()->clearCachedFieldDefinitions();
|
||||
$form_state->setRedirectUrl($this->entity->urlInfo('collection'));
|
||||
|
|
Loading…
Reference in New Issue