Commit 76ca5b08 authored by xjm's avatar xjm

Issue #2073075 by vanilla-bear, joshi.rohit100, swentel, marcingy,...

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 a9f9c031
......@@ -60,7 +60,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
* {@inheritdoc}
*/
public function buildHeader() {
$header['label'] = t('Name');
$header['label'] = $this->t('Name');
return $header + parent::buildHeader();
}
......@@ -120,7 +120,7 @@ public function render() {
'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 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
* {@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 @@ public function buildHeader() {
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 @@ protected function init(FormStateInterface $form_state) {
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 @@ public function exists($entity_id, array $element) {
* {@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'));
......
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