Commit 81e675a5 authored by alexpott's avatar alexpott
Browse files

Issue #2341313 by dawehner: Convert all t() calls to $this->t() in views.

parent c303b2ce
......@@ -48,7 +48,7 @@ protected function defineOptions() {
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['display_as_link'] = array(
'#title' => t('Display as link'),
'#title' => $this->t('Display as link'),
'#type' => 'checkbox',
'#default_value' => !empty($this->options['display_as_link']),
);
......
......@@ -55,12 +55,12 @@ protected function defineOptions() {
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['view_mode'] = array(
'#type' => 'select',
'#title' => t('Display type'),
'#title' => $this->t('Display type'),
'#options' => array(
'fulltext' => t('Full text'),
'teaser' => t('Title plus teaser'),
'title' => t('Title only'),
'default' => t('Use default RSS settings'),
'fulltext' => $this->t('Full text'),
'teaser' => $this->t('Title plus teaser'),
'title' => $this->t('Title only'),
'default' => $this->t('Use default RSS settings'),
),
'#default_value' => $this->options['view_mode'],
);
......
......@@ -62,7 +62,7 @@ function title() {
$title = $this->database->query('SELECT name FROM {users_field_data} WHERE uid = :uid AND default_langcode = 1', array(':uid' => $this->argument))->fetchField();
}
if (empty($title)) {
return t('No user');
return $this->t('No user');
}
return String::checkPlain($title);
......@@ -108,7 +108,7 @@ public function query($group_by = FALSE) {
* {@inheritdoc}
*/
public function getSortName() {
return t('Numerical', array(), array('context' => 'Sort order'));
return $this->t('Numerical', array(), array('context' => 'Sort order'));
}
}
......@@ -63,13 +63,13 @@ protected function defineOptions() {
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['link_to_comment'] = array(
'#title' => t('Link this field to its comment'),
'#description' => t("Enable to override this field's links."),
'#title' => $this->t('Link this field to its comment'),
'#description' => $this->t("Enable to override this field's links."),
'#type' => 'checkbox',
'#default_value' => $this->options['link_to_comment'],
);
$form['link_to_entity'] = array(
'#title' => t('Link field to the entity if there is no comment'),
'#title' => $this->t('Link field to the entity if there is no comment'),
'#type' => 'checkbox',
'#default_value' => $this->options['link_to_entity'],
);
......
......@@ -36,9 +36,9 @@ protected function defineOptions() {
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['teaser'] = array(
'#type' => 'checkbox',
'#title' => t('Show teaser-style link'),
'#title' => $this->t('Show teaser-style link'),
'#default_value' => $this->options['teaser'],
'#description' => t('Show the comment link in the form used on standard entity teasers, rather than the full entity form.'),
'#description' => $this->t('Show the comment link in the form used on standard entity teasers, rather than the full entity form.'),
);
parent::buildOptionsForm($form, $form_state);
......
......@@ -73,7 +73,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#default_value' => $this->options['text'],
);
$form['link_to_entity'] = array(
'#title' => t('Link field to the entity if there is no comment'),
'#title' => $this->t('Link field to the entity if there is no comment'),
'#type' => 'checkbox',
'#default_value' => $this->options['link_to_entity'],
);
......@@ -102,7 +102,7 @@ public function render(ResultRow $values) {
* Returns a string for the link text.
*/
protected function renderLink($data, ResultRow $values) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('View');
$text = !empty($this->options['text']) ? $this->options['text'] : $this->t('View');
/** @var \Drupal\comment\CommentInterface $comment */
$comment = $data;
$cid = $comment->id();
......
......@@ -47,7 +47,7 @@ protected function renderLink($data, ResultRow $values) {
return;
}
$text = !empty($this->options['text']) ? $this->options['text'] : t('Approve');
$text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Approve');
$comment = $this->get_entity($values);
$this->options['alter']['make_link'] = TRUE;
......
......@@ -39,7 +39,7 @@ public function access(AccountInterface $account) {
* Returns a string for the link text.
*/
protected function renderLink($data, ResultRow $values) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('Delete');
$text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Delete');
$comment = $this->getEntity($values);
$this->options['alter']['make_link'] = TRUE;
......
......@@ -31,8 +31,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['destination'] = array(
'#type' => 'checkbox',
'#title' => t('Use destination'),
'#description' => t('Add destination to the link'),
'#title' => $this->t('Use destination'),
'#description' => $this->t('Add destination to the link'),
'#default_value' => $this->options['destination'],
);
}
......@@ -56,7 +56,7 @@ protected function renderLink($data, ResultRow $values) {
return;
}
$text = !empty($this->options['text']) ? $this->options['text'] : t('Edit');
$text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Edit');
unset($this->options['alter']['fragment']);
if (!empty($this->options['destination'])) {
......
......@@ -39,7 +39,7 @@ public function access(AccountInterface $account) {
* Returns a string for the link text.
*/
protected function renderLink($data, ResultRow $values) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('Reply');
$text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Reply');
$comment = $this->getEntity($values);
$this->options['alter']['make_link'] = TRUE;
......
......@@ -28,11 +28,11 @@ public function render(ResultRow $values) {
switch ($value) {
case CommentItemInterface::HIDDEN:
default:
return t('Hidden');
return $this->t('Hidden');
case CommentItemInterface::CLOSED:
return t('Closed');
return $this->t('Closed');
case CommentItemInterface::OPEN:
return t('Open');
return $this->t('Open');
}
}
......
......@@ -85,8 +85,8 @@ protected function defineOptions() {
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['link_to_comment'] = array(
'#title' => t('Link this field to new comments'),
'#description' => t("Enable to override this field's links."),
'#title' => $this->t('Link this field to new comments'),
'#description' => $this->t("Enable to override this field's links."),
'#type' => 'checkbox',
'#default_value' => $this->options['link_to_comment'],
);
......
......@@ -42,7 +42,7 @@ protected function defineOptions() {
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['link_to_user'] = array(
'#title' => t("Link this field to its user or an author's homepage"),
'#title' => $this->t("Link this field to its user or an author's homepage"),
'#type' => 'checkbox',
'#default_value' => $this->options['link_to_user'],
);
......
......@@ -21,9 +21,9 @@ class NodeComment extends InOperator {
public function getValueOptions() {
$this->value_options = array(
CommentItemInterface::HIDDEN => t('Hidden'),
CommentItemInterface::CLOSED => t('Closed'),
CommentItemInterface::OPEN => t('Open'),
CommentItemInterface::HIDDEN => $this->t('Hidden'),
CommentItemInterface::CLOSED => $this->t('Closed'),
CommentItemInterface::OPEN => $this->t('Open'),
);
}
......
......@@ -41,7 +41,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['view_mode'] = array(
'#type' => 'select',
'#title' => t('Display type'),
'#title' => $this->t('Display type'),
'#options' => $this->options_form_summary_options(),
'#default_value' => $this->options['view_mode'],
);
......@@ -74,8 +74,8 @@ function options_form_summary_options() {
foreach ($view_modes as $mode => $settings) {
$options[$mode] = $settings['label'];
}
$options['title'] = t('Title only');
$options['default'] = t('Use site default RSS settings');
$options['title'] = $this->t('Title only');
$options['default'] = $this->t('Use site default RSS settings');
return $options;
}
......
......@@ -69,8 +69,8 @@ class Comment extends WizardPluginBase {
*/
protected function rowStyleOptions() {
$options = array();
$options['comment'] = t('comments');
$options['fields'] = t('fields');
$options['comment'] = $this->t('comments');
$options['fields'] = $this->t('fields');
return $options;
}
......@@ -87,11 +87,11 @@ protected function buildFormStyle(array &$form, FormStateInterface $form_state,
case 'comment':
$style_form['row_options']['links'] = array(
'#type' => 'select',
'#title' => t('Should links be displayed below each comment'),
'#title' => $this->t('Should links be displayed below each comment'),
'#title_display' => 'invisible',
'#options' => array(
1 => t('with links (allow users to reply to the comment, etc.)'),
0 => t('without links'),
1 => $this->t('with links (allow users to reply to the comment, etc.)'),
0 => $this->t('without links'),
),
'#default_value' => 1,
);
......
......@@ -87,9 +87,9 @@ public static function create(ContainerInterface $container, array $configuratio
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['text']['#title'] = t('Link label');
$form['text']['#title'] = $this->t('Link label');
$form['text']['#required'] = TRUE;
$form['text']['#default_value'] = empty($this->options['text']) ? t('contact') : $this->options['text'];
$form['text']['#default_value'] = empty($this->options['text']) ? $this->t('contact') : $this->options['text'];
}
/**
......@@ -119,7 +119,7 @@ protected function renderLink(EntityInterface $entity, ResultRow $values) {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = "user/{$entity->id()}/contact";
$title = t('Contact %user', array('%user' => $entity->name->value));
$title = $this->t('Contact %user', array('%user' => $entity->name->value));
$this->options['alter']['attributes'] = array('title' => $title);
if (!empty($this->options['text'])) {
......
......@@ -36,7 +36,7 @@ protected function defineOptions() {
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['text'] = array(
'#type' => 'textfield',
'#title' => t('Text to display'),
'#title' => $this->t('Text to display'),
'#default_value' => $this->options['text'],
);
parent::buildOptionsForm($form, $form_state);
......@@ -62,7 +62,7 @@ public function render(ResultRow $values) {
*/
protected function renderLink(EntityInterface $entity, ResultRow $values) {
if (content_translation_translate_access($entity)->isAllowed()) {
$text = !empty($this->options['text']) ? $this->options['text'] : t('Translate');
$text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Translate');
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = $entity->getSystemPath('drupal:content-translation-overview');
......
......@@ -44,18 +44,18 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$field_options = array_slice($all_fields, 0, array_search($this->options['id'], array_keys($all_fields)));
$form['fields'] = array(
'#type' => 'checkboxes',
'#title' => t('Fields'),
'#description' => t('Fields to be included as contextual links.'),
'#title' => $this->t('Fields'),
'#description' => $this->t('Fields to be included as contextual links.'),
'#options' => $field_options,
'#default_value' => $this->options['fields'],
);
$form['destination'] = array(
'#type' => 'select',
'#title' => t('Include destination'),
'#description' => t('Include a "destination" parameter in the link to return the user to the original view upon completing the contextual action.'),
'#title' => $this->t('Include destination'),
'#description' => $this->t('Include a "destination" parameter in the link to return the user to the original view upon completing the contextual action.'),
'#options' => array(
'0' => t('No'),
'1' => t('Yes'),
'0' => $this->t('No'),
'1' => $this->t('Yes'),
),
'#default_value' => $this->options['destination'],
);
......
......@@ -51,7 +51,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['replace_variables'] = array(
'#title' => t('Replace variables'),
'#title' => $this->t('Replace variables'),
'#type' => 'checkbox',
'#default_value' => $this->options['replace_variables'],
);
......
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