Issue #2072303 by tim.plunkett: Modernize views_ui().module forms.
parent
af00da698e
commit
334703ac2b
|
@ -15,14 +15,14 @@ use Drupal\system\SystemConfigFormBase;
|
|||
class AdvancedSettingsForm extends SystemConfigFormBase {
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::getFormID().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormID() {
|
||||
return 'views_ui_admin_settings_advanced';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
$form = parent::buildForm($form, $form_state);
|
||||
|
@ -30,39 +30,39 @@ class AdvancedSettingsForm extends SystemConfigFormBase {
|
|||
$config = $this->configFactory->get('views.settings');
|
||||
$form['cache'] = array(
|
||||
'#type' => 'details',
|
||||
'#title' => t('Caching'),
|
||||
'#title' => $this->t('Caching'),
|
||||
);
|
||||
|
||||
$form['cache']['skip_cache'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Disable views data caching'),
|
||||
'#description' => t("Views caches data about tables, modules and views available, to increase performance. By checking this box, Views will skip this cache and always rebuild this data when needed. This can have a serious performance impact on your site."),
|
||||
'#title' => $this->t('Disable views data caching'),
|
||||
'#description' => $this->t("Views caches data about tables, modules and views available, to increase performance. By checking this box, Views will skip this cache and always rebuild this data when needed. This can have a serious performance impact on your site."),
|
||||
'#default_value' => $config->get('skip_cache'),
|
||||
);
|
||||
|
||||
$form['cache']['clear_cache'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t("Clear Views' cache"),
|
||||
'#value' => $this->t("Clear Views' cache"),
|
||||
'#submit' => array(array($this, 'cacheSubmit')),
|
||||
);
|
||||
|
||||
$form['debug'] = array(
|
||||
'#type' => 'details',
|
||||
'#title' => t('Debugging'),
|
||||
'#title' => $this->t('Debugging'),
|
||||
);
|
||||
|
||||
$form['debug']['sql_signature'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Add Views signature to all SQL queries'),
|
||||
'#description' => t("All Views-generated queries will include the name of the views and display 'view-name:display-name' as a string at the end of the SELECT clause. This makes identifying Views queries in database server logs simpler, but should only be used when troubleshooting."),
|
||||
'#title' => $this->t('Add Views signature to all SQL queries'),
|
||||
'#description' => $this->t("All Views-generated queries will include the name of the views and display 'view-name:display-name' as a string at the end of the SELECT clause. This makes identifying Views queries in database server logs simpler, but should only be used when troubleshooting."),
|
||||
|
||||
'#default_value' => $config->get('sql_signature'),
|
||||
);
|
||||
|
||||
$form['debug']['no_javascript'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Disable JavaScript with Views'),
|
||||
'#description' => t("If you are having problems with the JavaScript, you can disable it here. The Views UI should degrade and still be usable without javascript; it's just not as good."),
|
||||
'#title' => $this->t('Disable JavaScript with Views'),
|
||||
'#description' => $this->t("If you are having problems with the JavaScript, you can disable it here. The Views UI should degrade and still be usable without javascript; it's just not as good."),
|
||||
'#default_value' => $config->get('no_javascript'),
|
||||
);
|
||||
|
||||
|
@ -72,11 +72,11 @@ class AdvancedSettingsForm extends SystemConfigFormBase {
|
|||
'#type' => 'details',
|
||||
);
|
||||
$form['extenders']['display_extenders'] = array(
|
||||
'#title' => t('Display extenders'),
|
||||
'#title' => $this->t('Display extenders'),
|
||||
'#default_value' => array_filter($config->get('display_extenders')),
|
||||
'#options' => $options,
|
||||
'#type' => 'checkboxes',
|
||||
'#description' => t('Select extensions of the views interface.')
|
||||
'#description' => $this->t('Select extensions of the views interface.')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ class AdvancedSettingsForm extends SystemConfigFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::submitForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, array &$form_state) {
|
||||
$this->configFactory->get('views.settings')
|
||||
|
@ -100,7 +100,7 @@ class AdvancedSettingsForm extends SystemConfigFormBase {
|
|||
*/
|
||||
public function cacheSubmit() {
|
||||
views_invalidate_cache();
|
||||
drupal_set_message(t('The cache has been cleared.'));
|
||||
drupal_set_message($this->t('The cache has been cleared.'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,14 +24,14 @@ class AddItem extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormKey().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormKey() {
|
||||
return 'add-item';
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getForm(ViewStorageInterface $view, $display_id, $js, $type = NULL) {
|
||||
$this->setType($type);
|
||||
|
@ -39,14 +39,14 @@ class AddItem extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::getFormID().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormID() {
|
||||
return 'views_ui_add_item_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
$view = &$form_state['view'];
|
||||
|
@ -72,7 +72,7 @@ class AddItem extends ViewsFormBase {
|
|||
$type = $types[$type]['type'];
|
||||
}
|
||||
|
||||
$form['#title'] = t('Add @type', array('@type' => $ltitle));
|
||||
$form['#title'] = $this->t('Add @type', array('@type' => $ltitle));
|
||||
$form['#section'] = $display_id . 'add-item';
|
||||
|
||||
// Add the display override dropdown.
|
||||
|
@ -90,13 +90,13 @@ class AddItem extends ViewsFormBase {
|
|||
);
|
||||
$form['override']['controls']['options_search'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Search'),
|
||||
'#title' => $this->t('Search'),
|
||||
);
|
||||
|
||||
$groups = array('all' => t('- All -'));
|
||||
$groups = array('all' => $this->t('- All -'));
|
||||
$form['override']['controls']['group'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Type'),
|
||||
'#title' => $this->t('Type'),
|
||||
'#options' => array(),
|
||||
);
|
||||
|
||||
|
@ -137,7 +137,7 @@ class AddItem extends ViewsFormBase {
|
|||
$zebra_class = ($zebra % 2) ? 'odd' : 'even';
|
||||
$form['options']['name'][$key] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('!group: !field', array('!group' => $option['group'], '!field' => $option['title'])),
|
||||
'#title' => $this->t('!group: !field', array('!group' => $option['group'], '!field' => $option['title'])),
|
||||
'#description' => $option['help'],
|
||||
'#return_value' => $key,
|
||||
'#prefix' => "<div class='$zebra_class filterable-option'>",
|
||||
|
@ -161,17 +161,17 @@ class AddItem extends ViewsFormBase {
|
|||
}
|
||||
else {
|
||||
$form['options']['markup'] = array(
|
||||
'#markup' => '<div class="form-item">' . t('There are no @types available to add.', array('@types' => $ltitle)) . '</div>',
|
||||
'#markup' => '<div class="form-item">' . $this->t('There are no @types available to add.', array('@types' => $ltitle)) . '</div>',
|
||||
);
|
||||
}
|
||||
// Add a div to show the selected items
|
||||
$form['selected'] = array(
|
||||
'#type' => 'item',
|
||||
'#markup' => '<span class="views-ui-view-title">' . t('Selected:') . '</span> ' . '<div class="views-selected-options"></div>',
|
||||
'#markup' => '<span class="views-ui-view-title">' . $this->t('Selected:') . '</span> ' . '<div class="views-selected-options"></div>',
|
||||
'#theme_wrappers' => array('form_element', 'views_ui_container'),
|
||||
'#attributes' => array('class' => array('container-inline', 'views-add-form-selected')),
|
||||
);
|
||||
$view->getStandardButtons($form, $form_state, 'views_ui_add_item_form', t('Add and configure @types', array('@types' => $ltitle)));
|
||||
$view->getStandardButtons($form, $form_state, 'views_ui_add_item_form', $this->t('Add and configure @types', array('@types' => $ltitle)));
|
||||
|
||||
// Remove the default submit function.
|
||||
$form['buttons']['submit']['#submit'] = array_filter($form['buttons']['submit']['#submit'], function($var) {
|
||||
|
|
|
@ -17,26 +17,26 @@ use Drupal\views\Analyzer;
|
|||
class Analyze extends ViewsFormBase {
|
||||
|
||||
/**
|
||||
* Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormKey().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormKey() {
|
||||
return 'analyze';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::getFormID().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormID() {
|
||||
return 'views_ui_analyze_view_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
$view = &$form_state['view'];
|
||||
|
||||
$form['#title'] = t('View analysis');
|
||||
$form['#title'] = $this->t('View analysis');
|
||||
$form['#section'] = 'analyze';
|
||||
|
||||
$analyzer = Views::analyzer();
|
||||
|
@ -55,7 +55,7 @@ class Analyze extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::submitForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, array &$form_state) {
|
||||
$form_state['redirect'] = 'admin/structure/views/view/' . $form_state['view']->id() . '/edit';
|
||||
|
|
|
@ -25,14 +25,14 @@ class ConfigItem extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormKey().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormKey() {
|
||||
return 'config-item';
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getForm(ViewStorageInterface $view, $display_id, $js, $type = NULL, $id = NULL) {
|
||||
$this->setType($type);
|
||||
|
@ -41,14 +41,14 @@ class ConfigItem extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::getFormID().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormID() {
|
||||
return 'views_ui_config_item_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
$view = &$form_state['view'];
|
||||
|
@ -71,7 +71,7 @@ class ConfigItem extends ViewsFormBase {
|
|||
if ($item) {
|
||||
$handler = $executable->display_handler->getHandler($type, $id);
|
||||
if (empty($handler)) {
|
||||
$form['markup'] = array('#markup' => t("Error: handler for @table > @field doesn't exist!", array('@table' => $item['table'], '@field' => $item['field'])));
|
||||
$form['markup'] = array('#markup' => $this->t("Error: handler for @table > @field doesn't exist!", array('@table' => $item['table'], '@field' => $item['field'])));
|
||||
}
|
||||
else {
|
||||
$types = ViewExecutable::viewsHandlerTypes();
|
||||
|
@ -115,7 +115,7 @@ class ConfigItem extends ViewsFormBase {
|
|||
// it to none.
|
||||
$base_fields = Views::viewsDataHelper()->fetchFields($view->get('base_table'), $form_state['type'], $executable->display_handler->useGroupBy());
|
||||
if (isset($base_fields[$item['table'] . '.' . $item['field']])) {
|
||||
$relationship_options = array_merge(array('none' => t('Do not use a relationship')), $relationship_options);
|
||||
$relationship_options = array_merge(array('none' => $this->t('Do not use a relationship')), $relationship_options);
|
||||
}
|
||||
$rel = empty($item['relationship']) ? 'none' : $item['relationship'];
|
||||
if (empty($relationship_options[$rel])) {
|
||||
|
@ -129,7 +129,7 @@ class ConfigItem extends ViewsFormBase {
|
|||
|
||||
$form['options']['relationship'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Relationship'),
|
||||
'#title' => $this->t('Relationship'),
|
||||
'#options' => $relationship_options,
|
||||
'#default_value' => $rel,
|
||||
'#weight' => -500,
|
||||
|
@ -142,7 +142,7 @@ class ConfigItem extends ViewsFormBase {
|
|||
);
|
||||
}
|
||||
|
||||
$form['#title'] = t('Configure @type: @item', array('@type' => $types[$type]['lstitle'], '@item' => $handler->adminLabel()));
|
||||
$form['#title'] = $this->t('Configure @type: @item', array('@type' => $types[$type]['lstitle'], '@item' => $handler->adminLabel()));
|
||||
|
||||
if (!empty($handler->definition['help'])) {
|
||||
$form['options']['form_description'] = array(
|
||||
|
@ -169,7 +169,7 @@ class ConfigItem extends ViewsFormBase {
|
|||
// Add a 'remove' button.
|
||||
$form['buttons']['remove'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Remove'),
|
||||
'#value' => $this->t('Remove'),
|
||||
'#submit' => array(array($this, 'remove')),
|
||||
'#limit_validation_errors' => array(array('override')),
|
||||
);
|
||||
|
@ -183,7 +183,7 @@ class ConfigItem extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::validateForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validateForm(array &$form, array &$form_state) {
|
||||
$form_state['handler']->validateOptionsForm($form['options'], $form_state);
|
||||
|
@ -194,7 +194,7 @@ class ConfigItem extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::submitForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, array &$form_state) {
|
||||
// Run it through the handler's submit function.
|
||||
|
|
|
@ -24,14 +24,14 @@ class ConfigItemExtra extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormKey().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormKey() {
|
||||
return 'config-item-extra';
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getForm(ViewStorageInterface $view, $display_id, $js, $type = NULL, $id = NULL) {
|
||||
$this->setType($type);
|
||||
|
@ -40,14 +40,14 @@ class ConfigItemExtra extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::getFormID().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormID() {
|
||||
return 'views_ui_config_item_extra_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
$view = &$form_state['view'];
|
||||
|
@ -69,13 +69,13 @@ class ConfigItemExtra extends ViewsFormBase {
|
|||
if ($item) {
|
||||
$handler = $executable->display_handler->getHandler($type, $id);
|
||||
if (empty($handler)) {
|
||||
$form['markup'] = array('#markup' => t("Error: handler for @table > @field doesn't exist!", array('@table' => $item['table'], '@field' => $item['field'])));
|
||||
$form['markup'] = array('#markup' => $this->t("Error: handler for @table > @field doesn't exist!", array('@table' => $item['table'], '@field' => $item['field'])));
|
||||
}
|
||||
else {
|
||||
$handler->init($executable, $executable->display_handler, $item);
|
||||
$types = ViewExecutable::viewsHandlerTypes();
|
||||
|
||||
$form['#title'] = t('Configure extra settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->adminLabel()));
|
||||
$form['#title'] = $this->t('Configure extra settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->adminLabel()));
|
||||
|
||||
$form['#section'] = $display_id . '-' . $type . '-' . $id;
|
||||
|
||||
|
@ -90,14 +90,14 @@ class ConfigItemExtra extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::validateForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validateForm(array &$form, array &$form_state) {
|
||||
$form_state['handler']->validateExtraOptionsForm($form['options'], $form_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::submitForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, array &$form_state) {
|
||||
// Run it through the handler's submit function.
|
||||
|
|
|
@ -25,14 +25,14 @@ class ConfigItemGroup extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormKey().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormKey() {
|
||||
return 'config-item-group';
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getForm(ViewStorageInterface $view, $display_id, $js, $type = NULL, $id = NULL) {
|
||||
$this->setType($type);
|
||||
|
@ -41,14 +41,14 @@ class ConfigItemGroup extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::getFormID().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormID() {
|
||||
return 'views_ui_config_item_group_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
$view = &$form_state['view'];
|
||||
|
@ -65,7 +65,7 @@ class ConfigItemGroup extends ViewsFormBase {
|
|||
);
|
||||
$executable = $view->getExecutable();
|
||||
if (!$executable->setDisplay($display_id)) {
|
||||
views_ajax_render(t('Invalid display id @display', array('@display' => $display_id)));
|
||||
views_ajax_render($this->t('Invalid display id @display', array('@display' => $display_id)));
|
||||
}
|
||||
|
||||
$executable->initQuery();
|
||||
|
@ -75,13 +75,13 @@ class ConfigItemGroup extends ViewsFormBase {
|
|||
if ($item) {
|
||||
$handler = $executable->display_handler->getHandler($type, $id);
|
||||
if (empty($handler)) {
|
||||
$form['markup'] = array('#markup' => t("Error: handler for @table > @field doesn't exist!", array('@table' => $item['table'], '@field' => $item['field'])));
|
||||
$form['markup'] = array('#markup' => $this->t("Error: handler for @table > @field doesn't exist!", array('@table' => $item['table'], '@field' => $item['field'])));
|
||||
}
|
||||
else {
|
||||
$handler->init($executable, $executable->display_handler, $item);
|
||||
$types = ViewExecutable::viewsHandlerTypes();
|
||||
|
||||
$form['#title'] = t('Configure aggregation settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->adminLabel()));
|
||||
$form['#title'] = $this->t('Configure aggregation settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->adminLabel()));
|
||||
|
||||
$handler->buildGroupByForm($form['options'], $form_state);
|
||||
$form_state['handler'] = &$handler;
|
||||
|
@ -93,7 +93,7 @@ class ConfigItemGroup extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::submitForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, array &$form_state) {
|
||||
$item = &$form_state['handler']->options;
|
||||
|
|
|
@ -22,14 +22,14 @@ class Display extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormKey().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormKey() {
|
||||
return 'display';
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::getFormState().
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @todo Remove this and switch all usage of $form_state['section'] to
|
||||
* $form_state['type'].
|
||||
|
@ -41,7 +41,7 @@ class Display extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getForm(ViewStorageInterface $view, $display_id, $js, $type = NULL) {
|
||||
$this->setType($type);
|
||||
|
@ -49,14 +49,14 @@ class Display extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::getFormID().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormID() {
|
||||
return 'views_ui_edit_display_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
$view = &$form_state['view'];
|
||||
|
@ -95,7 +95,7 @@ class Display extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::validateForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validateForm(array &$form, array &$form_state) {
|
||||
$form_state['view']->getExecutable()->displayHandlers->get($form_state['display_id'])->validateOptionsForm($form['options'], $form_state);
|
||||
|
@ -106,7 +106,7 @@ class Display extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::submitForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, array &$form_state) {
|
||||
$form_state['view']->getExecutable()->displayHandlers->get($form_state['display_id'])->submitOptionsForm($form['options'], $form_state);
|
||||
|
|
|
@ -16,26 +16,26 @@ use Drupal\views_ui\ViewUI;
|
|||
class EditDetails extends ViewsFormBase {
|
||||
|
||||
/**
|
||||
* Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormKey().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormKey() {
|
||||
return 'edit-details';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::getFormID().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormID() {
|
||||
return 'views_ui_edit_details_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
$view = &$form_state['view'];
|
||||
|
||||
$form['#title'] = t('View name and description');
|
||||
$form['#title'] = $this->t('View name and description');
|
||||
$form['#section'] = 'details';
|
||||
|
||||
$form['details'] = array(
|
||||
|
@ -44,27 +44,27 @@ class EditDetails extends ViewsFormBase {
|
|||
);
|
||||
$form['details']['label'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Human-readable name'),
|
||||
'#description' => t('A descriptive human-readable name for this view. Spaces are allowed'),
|
||||
'#title' => $this->t('Human-readable name'),
|
||||
'#description' => $this->t('A descriptive human-readable name for this view. Spaces are allowed'),
|
||||
'#default_value' => $view->label(),
|
||||
);
|
||||
$form['details']['langcode'] = array(
|
||||
'#type' => 'language_select',
|
||||
'#title' => t('View language'),
|
||||
'#description' => t('Language of labels and other textual elements in this view.'),
|
||||
'#title' => $this->t('View language'),
|
||||
'#description' => $this->t('Language of labels and other textual elements in this view.'),
|
||||
'#default_value' => $view->get('langcode'),
|
||||
);
|
||||
$form['details']['tag'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('View tag'),
|
||||
'#description' => t('Optionally, enter a comma delimited list of tags for this view to use in filtering and sorting views on the administrative page.'),
|
||||
'#title' => $this->t('View tag'),
|
||||
'#description' => $this->t('Optionally, enter a comma delimited list of tags for this view to use in filtering and sorting views on the administrative page.'),
|
||||
'#default_value' => $view->get('tag'),
|
||||
'#autocomplete_path' => 'admin/views/ajax/autocomplete/tag',
|
||||
);
|
||||
$form['details']['description'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('View description'),
|
||||
'#description' => t('This description will appear on the Views administrative UI to tell you what the view is about.'),
|
||||
'#title' => $this->t('View description'),
|
||||
'#description' => $this->t('This description will appear on the Views administrative UI to tell you what the view is about.'),
|
||||
'#default_value' => $view->get('description'),
|
||||
);
|
||||
|
||||
|
@ -73,7 +73,7 @@ class EditDetails extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::submitForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, array &$form_state) {
|
||||
$view = $form_state['view'];
|
||||
|
|
|
@ -23,14 +23,14 @@ class Rearrange extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormKey().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormKey() {
|
||||
return 'rearrange';
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::getForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getForm(ViewStorageInterface $view, $display_id, $js, $type = NULL) {
|
||||
$this->setType($type);
|
||||
|
@ -38,14 +38,14 @@ class Rearrange extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::getFormID().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormID() {
|
||||
return 'views_ui_rearrange_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
$view = &$form_state['view'];
|
||||
|
@ -56,7 +56,7 @@ class Rearrange extends ViewsFormBase {
|
|||
$executable = $view->getExecutable();
|
||||
$executable->setDisplay($display_id);
|
||||
$display = &$executable->displayHandlers->get($display_id);
|
||||
$form['#title'] = t('Rearrange @type', array('@type' => $types[$type]['ltitle']));
|
||||
$form['#title'] = $this->t('Rearrange @type', array('@type' => $types[$type]['ltitle']));
|
||||
$form['#section'] = $display_id . 'rearrange-item';
|
||||
|
||||
if ($display->defaultableSections($types[$type]['plural'])) {
|
||||
|
@ -74,8 +74,8 @@ class Rearrange extends ViewsFormBase {
|
|||
|
||||
$form['fields'] = array(
|
||||
'#type' => 'table',
|
||||
'#header' => array('', t('Weight'), t('Remove')),
|
||||
'#empty' => t('No fields available.'),
|
||||
'#header' => array('', $this->t('Weight'), $this->t('Remove')),
|
||||
'#empty' => $this->t('No fields available.'),
|
||||
'#tabledrag' => array(
|
||||
array('order', 'sibling', 'weight'),
|
||||
),
|
||||
|
@ -101,7 +101,7 @@ class Rearrange extends ViewsFormBase {
|
|||
);
|
||||
}
|
||||
else {
|
||||
$form['fields'][$id]['name'] = array('#markup' => t('Broken field @id', array('@id' => $id)));
|
||||
$form['fields'][$id]['name'] = array('#markup' => $this->t('Broken field @id', array('@id' => $id)));
|
||||
}
|
||||
|
||||
$form['fields'][$id]['weight'] = array(
|
||||
|
@ -115,7 +115,7 @@ class Rearrange extends ViewsFormBase {
|
|||
'#id' => 'views-removed-' . $id,
|
||||
'#attributes' => array('class' => array('views-remove-checkbox')),
|
||||
'#default_value' => 0,
|
||||
'#suffix' => l('<span>' . t('Remove') . '</span>', 'javascript:void()', array('attributes' => array('id' => 'views-remove-link-' . $id, 'class' => array('views-hidden', 'views-button-remove', 'views-remove-link'), 'alt' => t('Remove this item'), 'title' => t('Remove this item')), 'html' => TRUE)),
|
||||
'#suffix' => l('<span>' . $this->t('Remove') . '</span>', 'javascript:void()', array('attributes' => array('id' => 'views-remove-link-' . $id, 'class' => array('views-hidden', 'views-button-remove', 'views-remove-link'), 'alt' => $this->t('Remove this item'), 'title' => $this->t('Remove this item')), 'html' => TRUE)),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ class Rearrange extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::submitForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, array &$form_state) {
|
||||
$types = ViewExecutable::viewsHandlerTypes();
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
namespace Drupal\views_ui\Form\Ajax;
|
||||
|
||||
use Drupal\Component\Utility\String;
|
||||
use Drupal\views_ui\ViewUI;
|
||||
use Drupal\views\ViewExecutable;
|
||||
|
||||
|
@ -16,21 +17,21 @@ use Drupal\views\ViewExecutable;
|
|||
class RearrangeFilter extends ViewsFormBase {
|
||||
|
||||
/**
|
||||
* Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormKey().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormKey() {
|
||||
return 'rearrange-filter';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::getFormID().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormID() {
|
||||
return 'views_ui_rearrange_filter_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
$view = &$form_state['view'];
|
||||
|
@ -40,11 +41,11 @@ class RearrangeFilter extends ViewsFormBase {
|
|||
$types = ViewExecutable::viewsHandlerTypes();
|
||||
$executable = $view->getExecutable();
|
||||
if (!$executable->setDisplay($display_id)) {
|
||||
views_ajax_render(t('Invalid display id @display', array('@display' => $display_id)));
|
||||
views_ajax_render($this->t('Invalid display id @display', array('@display' => $display_id)));
|
||||
}
|
||||
$display = $executable->displayHandlers->get($display_id);
|
||||
$form['#title'] = check_plain($display->display['display_title']) . ': ';
|
||||
$form['#title'] .= t('Rearrange @type', array('@type' => $types[$type]['ltitle']));
|
||||
$form['#title'] = String::checkPlain($display->display['display_title']) . ': ';
|
||||
$form['#title'] .= $this->t('Rearrange @type', array('@type' => $types[$type]['ltitle']));
|
||||
$form['#section'] = $display_id . 'rearrange-item';
|
||||
|
||||
if ($display->defaultableSections($types[$type]['plural'])) {
|
||||
|
@ -86,15 +87,15 @@ class RearrangeFilter extends ViewsFormBase {
|
|||
$form['filter_groups']['operator'] = array(
|
||||
'#type' => 'select',
|
||||
'#options' => array(
|
||||
'AND' => t('And'),
|
||||
'OR' => t('Or'),
|
||||
'AND' => $this->t('And'),
|
||||
'OR' => $this->t('Or'),
|
||||
),
|
||||
'#default_value' => $groups['operator'],
|
||||
'#attributes' => array(
|
||||
'class' => array('warning-on-change'),
|
||||
),
|
||||
'#title' => t('Operator to use on all groups'),
|
||||
'#description' => t('Either "group 0 AND group 1 AND group 2" or "group 0 OR group 1 OR group 2", etc'),
|
||||
'#title' => $this->t('Operator to use on all groups'),
|
||||
'#description' => $this->t('Either "group 0 AND group 1 AND group 2" or "group 0 OR group 1 OR group 2", etc'),
|
||||
'#access' => $grouping,
|
||||
);
|
||||
|
||||
|
@ -102,11 +103,11 @@ class RearrangeFilter extends ViewsFormBase {
|
|||
|
||||
foreach ($groups['groups'] as $id => $group) {
|
||||
$form['filter_groups']['groups'][$id] = array(
|
||||
'#title' => t('Operator'),
|
||||
'#title' => $this->t('Operator'),
|
||||
'#type' => 'select',
|
||||
'#options' => array(
|
||||
'AND' => t('And'),
|
||||
'OR' => t('Or'),
|
||||
'AND' => $this->t('And'),
|
||||
'OR' => $this->t('Or'),
|
||||
),
|
||||
'#default_value' => $group,
|
||||
'#attributes' => array(
|
||||
|
@ -118,7 +119,7 @@ class RearrangeFilter extends ViewsFormBase {
|
|||
if ($id != 1) {
|
||||
$form['remove_groups'][$id] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Remove group @group', array('@group' => $id)),
|
||||
'#value' => $this->t('Remove group @group', array('@group' => $id)),
|
||||
'#id' => "views-remove-group-$id",
|
||||
'#attributes' => array(
|
||||
'class' => array('views-remove-group'),
|
||||
|
@ -126,7 +127,7 @@ class RearrangeFilter extends ViewsFormBase {
|
|||
'#group' => $id,
|
||||
);
|
||||
}
|
||||
$group_options[$id] = $id == 1 ? t('Default group') : t('Group @group', array('@group' => $id));
|
||||
$group_options[$id] = $id == 1 ? $this->t('Default group') : $this->t('Group @group', array('@group' => $id));
|
||||
$form['#group_renders'][$id] = array();
|
||||
}
|
||||
|
||||
|
@ -182,7 +183,7 @@ class RearrangeFilter extends ViewsFormBase {
|
|||
);
|
||||
}
|
||||
else {
|
||||
$form['filters'][$id]['name'] = array('#markup' => t('Broken field @id', array('@id' => $id)));
|
||||
$form['filters'][$id]['name'] = array('#markup' => $this->t('Broken field @id', array('@id' => $id)));
|
||||
}
|
||||
$form['filters'][$id]['removed'] = array(
|
||||
'#type' => 'checkbox',
|
||||
|
@ -199,7 +200,7 @@ class RearrangeFilter extends ViewsFormBase {
|
|||
$view->getStandardButtons($form, $form_state, 'views_ui_rearrange_filter_form');
|
||||
$form['buttons']['add_group'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Create new filter group'),
|
||||
'#value' => $this->t('Create new filter group'),
|
||||
'#id' => 'views-add-group',
|
||||
'#group' => 'add',
|
||||
);
|
||||
|
@ -208,7 +209,7 @@ class RearrangeFilter extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::submitForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, array &$form_state) {
|
||||
$types = ViewExecutable::viewsHandlerTypes();
|
||||
|
|
|
@ -15,27 +15,27 @@ use Drupal\views_ui\ViewUI;
|
|||
class ReorderDisplays extends ViewsFormBase {
|
||||
|
||||
/**
|
||||
* Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormKey().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormKey() {
|
||||
return 'reorder-displays';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::getFormID().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormID() {
|
||||
return 'views_ui_reorder_displays_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
$view = $form_state['view'];
|
||||
$display_id = $form_state['display_id'];
|
||||
|
||||
$form['#title'] = t('Reorder displays');
|
||||
$form['#title'] = $this->t('Reorder displays');
|
||||
$form['#section'] = 'reorder';
|
||||
$form['#action'] = url('admin/structure/views/nojs/reorder-displays/' . $view->id() . '/' . $display_id);
|
||||
$form['view'] = array(
|
||||
|
@ -57,8 +57,8 @@ class ReorderDisplays extends ViewsFormBase {
|
|||
$form['displays'] = array(
|
||||
'#type' => 'table',
|
||||
'#id' => 'reorder-displays',
|
||||
'#header' => array(t('Display'), t('Weight'), t('Remove')),
|
||||
'#empty' => t('No displays available.'),
|
||||
'#header' => array($this->t('Display'), $this->t('Weight'), $this->t('Remove')),
|
||||
'#empty' => $this->t('No displays available.'),
|
||||
'#tabledrag' => array(
|
||||
array('order', 'sibling', 'weight'),
|
||||
),
|
||||
|
@ -89,7 +89,7 @@ class ReorderDisplays extends ViewsFormBase {
|
|||
'#type' => 'weight',
|
||||
'#value' => $display['position'],
|
||||
'#delta' => $count,
|
||||
'#title' => t('Weight for @display', array('@display' => $display['display_title'])),
|
||||
'#title' => $this->t('Weight for @display', array('@display' => $display['display_title'])),
|
||||
'#title_display' => 'invisible',
|
||||
'#attributes' => array(
|
||||
'class' => array('weight'),
|
||||
|
@ -107,7 +107,7 @@ class ReorderDisplays extends ViewsFormBase {
|
|||
),
|
||||
'link' => array(
|
||||
'#type' => 'link',
|
||||
'#title' => '<span>' . t('Remove') . '</span>',
|
||||
'#title' => '<span>' . $this->t('Remove') . '</span>',
|
||||
'#href' => 'javascript:void()',
|
||||
'#options' => array(
|
||||
'html' => TRUE,
|
||||
|
@ -115,8 +115,8 @@ class ReorderDisplays extends ViewsFormBase {
|
|||
'#attributes' => array(
|
||||
'id' => 'display-remove-link-' . $id,
|
||||
'class' => array('views-button-remove', 'display-remove-link'),
|
||||
'alt' => t('Remove this display'),
|
||||
'title' => t('Remove this display'),
|
||||
'alt' => $this->t('Remove this display'),
|
||||
'title' => $this->t('Remove this display'),
|
||||
),
|
||||
),
|
||||
'#access' => ($id !== 'default'),
|
||||
|
@ -139,7 +139,7 @@ class ReorderDisplays extends ViewsFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\views_ui\Form\Ajax\ViewsFormBase::submitForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, array &$form_state) {
|
||||
$view = $form_state['view'];
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
namespace Drupal\views_ui\Form\Ajax;
|
||||
|
||||
use Drupal\views_ui\ViewUI;
|
||||
use Drupal\Core\Form\FormBase;
|
||||
use Drupal\views\ViewStorageInterface;
|
||||
use Drupal\views\Ajax;
|
||||
use Drupal\Core\Ajax\AjaxResponse;
|
||||
|
@ -16,7 +16,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
|
|||
/**
|
||||
* Provides a base class for Views UI AJAX forms.
|
||||
*/
|
||||
abstract class ViewsFormBase implements ViewsFormInterface {
|
||||
abstract class ViewsFormBase extends FormBase implements ViewsFormInterface {
|
||||
|
||||
/**
|
||||
* The ID of the item this form is manipulating.
|
||||
|
@ -57,7 +57,7 @@ abstract class ViewsFormBase implements ViewsFormInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getFormState().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormState(ViewStorageInterface $view, $display_id, $js) {
|
||||
// $js may already have been converted to a Boolean.
|
||||
|
@ -79,7 +79,7 @@ abstract class ViewsFormBase implements ViewsFormInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\views_ui\Form\Ajax\ViewsFormInterface::getForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getForm(ViewStorageInterface $view, $display_id, $js) {
|
||||
$form_state = $this->getFormState($view, $display_id, $js);
|
||||
|
@ -174,13 +174,13 @@ abstract class ViewsFormBase implements ViewsFormInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::validateForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validateForm(array &$form, array &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::submitForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, array &$form_state) {
|
||||
}
|
||||
|
|
|
@ -15,14 +15,14 @@ use Drupal\system\SystemConfigFormBase;
|
|||
class BasicSettingsForm extends SystemConfigFormBase {
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::getFormID().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormID() {
|
||||
return 'views_ui_admin_settings_basic';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
$form = parent::buildForm($form, $form_state);
|
||||
|
@ -41,46 +41,46 @@ class BasicSettingsForm extends SystemConfigFormBase {
|
|||
|
||||
$form['basic']['ui_show_master_display'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Always show the master display'),
|
||||
'#description' => t('Advanced users of views may choose to see the master (i.e. default) display.'),
|
||||
'#title' => $this->t('Always show the master display'),
|
||||
'#description' => $this->t('Advanced users of views may choose to see the master (i.e. default) display.'),
|
||||
'#default_value' => $config->get('ui.show.master_display'),
|
||||
);
|
||||
|
||||
$form['basic']['ui_show_advanced_column'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Always show advanced display settings'),
|
||||
'#description' => t('Default to showing advanced display settings, such as relationships and contextual filters.'),
|
||||
'#title' => $this->t('Always show advanced display settings'),
|
||||
'#description' => $this->t('Default to showing advanced display settings, such as relationships and contextual filters.'),
|
||||
'#default_value' => $config->get('ui.show.advanced_column'),
|
||||
);
|
||||
|
||||
$form['basic']['ui_show_display_embed'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Show the embed display in the ui.'),
|
||||
'#description' => t("Allow advanced user to use the embed view display. The plugin itself works if it's not visible in the ui"),
|
||||
'#title' => $this->t('Show the embed display in the ui.'),
|
||||
'#description' => $this->t("Allow advanced user to use the embed view display. The plugin itself works if it's not visible in the ui"),
|
||||
'#default_value' => $config->get('ui.show.display_embed'),
|
||||
);
|
||||
|
||||
$form['basic']['ui_exposed_filter_any_label'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Label for "Any" value on non-required single-select exposed filters'),
|
||||
'#options' => array('old_any' => '<Any>', 'new_any' => t('- Any -')),
|
||||
'#title' => $this->t('Label for "Any" value on non-required single-select exposed filters'),
|
||||
'#options' => array('old_any' => '<Any>', 'new_any' => $this->t('- Any -')),
|
||||
'#default_value' => $config->get('ui.exposed_filter_any_label'),
|
||||
);
|
||||
|
||||
$form['live_preview'] = array(
|
||||
'#type' => 'details',
|
||||
'#title' => t('Live preview settings'),
|
||||
'#title' => $this->t('Live preview settings'),
|
||||
);
|
||||
|
||||
$form['live_preview']['ui_always_live_preview'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Automatically update preview on changes'),
|
||||
'#title' => $this->t('Automatically update preview on changes'),
|
||||
'#default_value' => $config->get('ui.always_live_preview'),
|
||||
);
|
||||
|
||||
$form['live_preview']['ui_show_preview_information'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Show information and statistics about the view during live preview'),
|
||||
'#title' => $this->t('Show information and statistics about the view during live preview'),
|
||||
'#default_value' => $config->get('ui.show.preview_information'),
|
||||
);
|
||||
|
||||
|
@ -96,27 +96,27 @@ class BasicSettingsForm extends SystemConfigFormBase {
|
|||
$form['live_preview']['options']['ui_show_sql_query_where'] = array(
|
||||
'#type' => 'radios',
|
||||
'#options' => array(
|
||||
'above' => t('Above the preview'),
|
||||
'below' => t('Below the preview'),
|
||||
'above' => $this->t('Above the preview'),
|
||||
'below' => $this->t('Below the preview'),
|
||||
),
|
||||
'#default_value' => $config->get('ui.show.sql_query.where'),
|
||||
);
|
||||
|
||||
$form['live_preview']['options']['ui_show_sql_query_enabled'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Show the SQL query'),
|
||||
'#title' => $this->t('Show the SQL query'),
|
||||
'#default_value' => $config->get('ui.show.sql_query.enabled'),
|
||||
);
|
||||
$form['live_preview']['options']['ui_show_performance_statistics'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Show performance statistics'),
|
||||
'#title' => $this->t('Show performance statistics'),
|
||||
'#default_value' => $config->get('ui.show.performance_statistics'),
|
||||
);
|
||||
|
||||
$form['live_preview']['options']['ui_show_additional_queries'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Show other queries run during render during live preview'),
|
||||
'#description' => t("Drupal has the potential to run many queries while a view is being rendered. Checking this box will display every query run during view render as part of the live preview."),
|
||||
'#title' => $this->t('Show other queries run during render during live preview'),
|
||||
'#description' => $this->t("Drupal has the potential to run many queries while a view is being rendered. Checking this box will display every query run during view render as part of the live preview."),
|
||||
'#default_value' => $config->get('ui.show.additional_queries'),
|
||||
);
|
||||
|
||||
|
@ -124,7 +124,7 @@ class BasicSettingsForm extends SystemConfigFormBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Form\FormInterface::submitForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, array &$form_state) {
|
||||
$this->configFactory->get('views.settings')
|
||||
|
|
|
@ -65,7 +65,7 @@ class BreakLockForm extends EntityConfirmFormBase {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function getQuestion() {
|
||||
return t('Do you want to break the lock on view %name?', array('%name' => $this->entity->id()));
|
||||
return $this->t('Do you want to break the lock on view %name?', array('%name' => $this->entity->id()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ class BreakLockForm extends EntityConfirmFormBase {
|
|||
'#theme' => 'username',
|
||||
'#account' => $account,
|
||||
);
|
||||
return t('By breaking this lock, any unsaved changes made by !user will be lost.', array('!user' => drupal_render($username)));
|
||||
return $this->t('By breaking this lock, any unsaved changes made by !user will be lost.', array('!user' => drupal_render($username)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,7 +92,7 @@ class BreakLockForm extends EntityConfirmFormBase {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfirmText() {
|
||||
return t('Break lock');
|
||||
return $this->t('Break lock');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,7 +100,7 @@ class BreakLockForm extends EntityConfirmFormBase {
|
|||
*/
|
||||
public function buildForm(array $form, array &$form_state) {
|
||||
if (!$this->tempStore->getMetadata($this->entity->id())) {
|
||||
$form['message']['#markup'] = t('There is no lock on view %name to break.', array('%name' => $this->entity->id()));
|
||||
$form['message']['#markup'] = $this->t('There is no lock on view %name to break.', array('%name' => $this->entity->id()));
|
||||
return $form;
|
||||
}
|
||||
return parent::buildForm($form, $form_state);
|
||||
|
@ -112,7 +112,7 @@ class BreakLockForm extends EntityConfirmFormBase {
|
|||
public function submit(array $form, array &$form_state) {
|
||||
$this->tempStore->delete($this->entity->id());
|
||||
$form_state['redirect'] = 'admin/structure/views/view/' . $this->entity->id();
|
||||
drupal_set_message(t('The lock has been broken and you may now edit this view.'));
|
||||
drupal_set_message($this->t('The lock has been broken and you may now edit this view.'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,18 +49,18 @@ class ViewAddFormController extends ViewFormControllerBase {
|
|||
public function init(array &$form_state) {
|
||||
parent::init($form_state);
|
||||
|
||||
drupal_set_title(t('Add new view'));
|
||||
drupal_set_title($this->t('Add new view'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityFormController::prepareForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function prepareEntity() {
|
||||
// Do not prepare the entity while it is being added.
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityFormController::form().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function form(array $form, array &$form_state) {
|
||||
$form['#attached']['css'] = static::getAdminCSS();
|
||||
|
@ -74,7 +74,7 @@ class ViewAddFormController extends ViewFormControllerBase {
|
|||
|
||||
$form['name']['label'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('View name'),
|
||||
'#title' => $this->t('View name'),
|
||||
'#required' => TRUE,
|
||||
'#size' => 32,
|
||||
'#default_value' => '',
|
||||
|
@ -87,16 +87,16 @@ class ViewAddFormController extends ViewFormControllerBase {
|
|||
'exists' => 'views_get_view',
|
||||
'source' => array('name', 'label'),
|
||||
),
|
||||
'#description' => t('A unique machine-readable name for this View. It must only contain lowercase letters, numbers, and underscores.'),
|
||||
'#description' => $this->t('A unique machine-readable name for this View. It must only contain lowercase letters, numbers, and underscores.'),
|
||||
);
|
||||
|
||||
$form['name']['description_enable'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Description'),
|
||||
'#title' => $this->t('Description'),
|
||||
);
|
||||
$form['name']['description'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Provide description'),
|
||||
'#title' => $this->t('Provide description'),
|
||||
'#title_display' => 'invisible',
|
||||
'#size' => 64,
|
||||
'#default_value' => '',
|
||||
|
@ -131,7 +131,7 @@ class ViewAddFormController extends ViewFormControllerBase {
|
|||
}
|
||||
$form['displays']['show']['wizard_key'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Show'),
|
||||
'#title' => $this->t('Show'),
|
||||
'#options' => $options,
|
||||
);
|
||||
$show_form = &$form['displays']['show'];
|
||||
|
@ -150,14 +150,14 @@ class ViewAddFormController extends ViewFormControllerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityFormController::actions().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function actions(array $form, array &$form_state) {
|
||||
$actions = parent::actions($form, $form_state);
|
||||
$actions['submit']['#value'] = t('Save and edit');
|
||||
$actions['submit']['#value'] = $this->t('Save and edit');
|
||||
|
||||
$actions['cancel'] = array(
|
||||
'#value' => t('Cancel'),
|
||||
'#value' => $this->t('Cancel'),
|
||||
'#submit' => array(
|
||||
array($this, 'cancel'),
|
||||
),
|
||||
|
@ -167,7 +167,7 @@ class ViewAddFormController extends ViewFormControllerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityFormController::validate().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(array $form, array &$form_state) {
|
||||
$wizard_type = $form_state['values']['show']['wizard_key'];
|
||||
|
@ -184,7 +184,7 @@ class ViewAddFormController extends ViewFormControllerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityFormController::submit().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submit(array $form, array &$form_state) {
|
||||
try {
|
||||
|
|
|
@ -18,30 +18,30 @@ class ViewCloneFormController extends ViewFormControllerBase {
|
|||
public function init(array &$form_state) {
|
||||
parent::init($form_state);
|
||||
|
||||
drupal_set_title(t('Clone of @label', array('@label' => $this->entity->label())));
|
||||
drupal_set_title($this->t('Clone of @label', array('@label' => $this->entity->label())));
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\Core\Entity\EntityFormController::prepareForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function prepareEntity() {
|
||||
// Do not prepare the entity while it is being added.
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\Core\Entity\EntityFormController::form().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function form(array $form, array &$form_state) {
|
||||
parent::form($form, $form_state);
|
||||
|
||||
$form['label'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('View name'),
|
||||
'#title' => $this->t('View name'),
|
||||
'#required' => TRUE,
|
||||
'#size' => 32,
|
||||
'#default_value' => '',
|
||||
'#maxlength' => 255,
|
||||
'#default_value' => t('Clone of @label', array('@label' => $this->entity->label())),
|
||||
'#default_value' => $this->t('Clone of @label', array('@label' => $this->entity->label())),
|
||||
);
|
||||
$form['id'] = array(
|
||||
'#type' => 'machine_name',
|
||||
|
@ -51,18 +51,18 @@ class ViewCloneFormController extends ViewFormControllerBase {
|
|||
'source' => array('label'),
|
||||
),
|
||||
'#default_value' => '',
|
||||
'#description' => t('A unique machine-readable name for this View. It must only contain lowercase letters, numbers, and underscores.'),
|
||||
'#description' => $this->t('A unique machine-readable name for this View. It must only contain lowercase letters, numbers, and underscores.'),
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\Core\Entity\EntityFormController::actions().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function actions(array $form, array &$form_state) {
|
||||
$actions['submit'] = array(
|
||||
'#value' => t('Clone'),
|
||||
'#value' => $this->t('Clone'),
|
||||
'#submit' => array(
|
||||
array($this, 'submit'),
|
||||
),
|
||||
|
@ -71,7 +71,7 @@ class ViewCloneFormController extends ViewFormControllerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\Core\Entity\EntityFormController::form().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submit(array $form, array &$form_state) {
|
||||
$original = parent::submit($form, $form_state);
|
||||
|
|
|
@ -18,7 +18,7 @@ class ViewDeleteFormController extends EntityConfirmFormBase {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function getQuestion() {
|
||||
return t('Are you sure you want to delete the %name view?', array('%name' => $this->entity->label()));
|
||||
return $this->t('Are you sure you want to delete the %name view?', array('%name' => $this->entity->label()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ class ViewDeleteFormController extends EntityConfirmFormBase {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfirmText() {
|
||||
return t('Delete');
|
||||
return $this->t('Delete');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,7 +58,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityFormController::form().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function form(array $form, array &$form_state) {
|
||||
$view = $this->entity;
|
||||
|
@ -75,7 +75,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
|
||||
if ($display_id) {
|
||||
if (!$view->getExecutable()->setDisplay($display_id)) {
|
||||
$form['#markup'] = t('Invalid display id @display', array('@display' => $display_id));
|
||||
$form['#markup'] = $this->t('Invalid display id @display', array('@display' => $display_id));
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
$form['locked'] = array(
|
||||
'#type' => 'container',
|
||||
'#attributes' => array('class' => array('view-locked', 'messages', 'messages--warning')),
|
||||
'#children' => t('This view is being edited by user !user, and is therefore locked from editing by others. This lock is !age old. Click here to <a href="!break">break this lock</a>.', $lock_message_substitutions),
|
||||
'#children' => $this->t('This view is being edited by user !user, and is therefore locked from editing by others. This lock is !age old. Click here to <a href="!break">break this lock</a>.', $lock_message_substitutions),
|
||||
'#weight' => -10,
|
||||
);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
$form['changed'] = array(
|
||||
'#type' => 'container',
|
||||
'#attributes' => array('class' => array('view-changed', 'messages', 'messages--warning')),
|
||||
'#children' => t('You have unsaved changes.'),
|
||||
'#children' => $this->t('You have unsaved changes.'),
|
||||
'#weight' => -10,
|
||||
);
|
||||
if (empty($view->changed)) {
|
||||
|
@ -144,7 +144,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
}
|
||||
|
||||
$form['displays'] = array(
|
||||
'#prefix' => '<h1 class="unit-title clearfix">' . t('Displays') . '</h1>',
|
||||
'#prefix' => '<h1 class="unit-title clearfix">' . $this->t('Displays') . '</h1>',
|
||||
'#type' => 'container',
|
||||
'#attributes' => array(
|
||||
'class' => array(
|
||||
|
@ -170,7 +170,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
// Add a text that the display is disabled.
|
||||
if ($view->getExecutable()->displayHandlers->has($display_id)) {
|
||||
if (!$view->getExecutable()->displayHandlers->get($display_id)->isEnabled()) {
|
||||
$form['displays']['settings']['disabled']['#markup'] = t('This display is disabled.');
|
||||
$form['displays']['settings']['disabled']['#markup'] = $this->t('This display is disabled.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,14 +213,14 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityFormController::actions().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function actions(array $form, array &$form_state) {
|
||||
$actions = parent::actions($form, $form_state);
|
||||
unset($actions['delete']);
|
||||
|
||||
$actions['cancel'] = array(
|
||||
'#value' => t('Cancel'),
|
||||
'#value' => $this->t('Cancel'),
|
||||
'#submit' => array(
|
||||
array($this, 'cancel'),
|
||||
),
|
||||
|
@ -229,7 +229,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityFormController::validate().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(array $form, array &$form_state) {
|
||||
parent::validate($form, $form_state);
|
||||
|
@ -243,7 +243,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityFormController::submit().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submit(array $form, array &$form_state) {
|
||||
parent::submit($form, $form_state);
|
||||
|
@ -299,7 +299,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
}
|
||||
|
||||
$view->save();
|
||||
drupal_set_message(t('The view %name has been saved.', array('%name' => $view->label())));
|
||||
drupal_set_message($this->t('The view %name has been saved.', array('%name' => $view->label())));
|
||||
|
||||
// Remove this view from cache so we can edit it properly.
|
||||
$this->tempStore->delete($view->id());
|
||||
|
@ -330,9 +330,9 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
// If the plugin doesn't exist, display an error message instead of an edit
|
||||
// page.
|
||||
if (empty($display)) {
|
||||
$title = isset($display->display['display_title']) ? $display->display['display_title'] : t('Invalid');
|
||||
$title = isset($display->display['display_title']) ? $display->display['display_title'] : $this->t('Invalid');
|
||||
// @TODO: Improved UX for the case where a plugin is missing.
|
||||
$build['#markup'] = t("Error: Display @display refers to a plugin named '@plugin', but that plugin is not available.", array('@display' => $display->display['id'], '@plugin' => $display->display['display_plugin']));
|
||||
$build['#markup'] = $this->t("Error: Display @display refers to a plugin named '@plugin', but that plugin is not available.", array('@display' => $display->display['id'], '@plugin' => $display->display['display_plugin']));
|
||||
}
|
||||
// Build the content of the edit page.
|
||||
else {
|
||||
|
@ -383,7 +383,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
if (!$is_enabled) {
|
||||
$build['top']['actions']['enable'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Enable @display_title', array('@display_title' => $display_title)),
|
||||
'#value' => $this->t('Enable @display_title', array('@display_title' => $display_title)),
|
||||
'#limit_validation_errors' => array(),
|
||||
'#submit' => array(array($this, 'submitDisplayEnable'), array($this, 'submitDelayDestination')),
|
||||
'#prefix' => '<li class="enable">',
|
||||
|
@ -397,8 +397,8 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
if ($path && (strpos($path, '%') === FALSE)) {
|
||||
$build['top']['actions']['path'] = array(
|
||||
'#type' => 'link',
|
||||
'#title' => t('View @display', array('@display' => $display['display_title'])),
|
||||
'#options' => array('alt' => array(t("Go to the real page for this display"))),
|
||||
'#title' => $this->t('View @display', array('@display' => $display['display_title'])),
|
||||
'#options' => array('alt' => array($this->t("Go to the real page for this display"))),
|
||||
'#href' => $path,
|
||||
'#prefix' => '<li class="view">',
|
||||
"#suffix" => '</li>',
|
||||
|
@ -408,7 +408,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
if (!$is_default) {
|
||||
$build['top']['actions']['duplicate'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Clone @display_title', array('@display_title' => $display_title)),
|
||||
'#value' => $this->t('Clone @display_title', array('@display_title' => $display_title)),
|
||||
'#limit_validation_errors' => array(),
|
||||
'#submit' => array(array($this, 'submitDisplayDuplicate'), array($this, 'submitDelayDestination')),
|
||||
'#prefix' => '<li class="duplicate">',
|
||||
|
@ -418,7 +418,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
// Always allow a display to be deleted.
|
||||
$build['top']['actions']['delete'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Delete @display_title', array('@display_title' => $display_title)),
|
||||
'#value' => $this->t('Delete @display_title', array('@display_title' => $display_title)),
|
||||
'#limit_validation_errors' => array(),
|
||||
'#submit' => array(array($this, 'submitDisplayDelete'), array($this, 'submitDelayDestination')),
|
||||
'#prefix' => '<li class="delete">',
|
||||
|
@ -432,7 +432,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
|
||||
$build['top']['actions']['clone_as'][$type] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Clone as @type', array('@type' => $label)),
|
||||
'#value' => $this->t('Clone as @type', array('@type' => $label)),
|
||||
'#limit_validation_errors' => array(),
|
||||
'#submit' => array(array($this, 'submitCloneDisplayAsType'), array($this, 'submitDelayDestination')),
|
||||
'#prefix' => '<li class="duplicate">',
|
||||
|
@ -443,7 +443,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
else {
|
||||
$build['top']['actions']['undo_delete'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Undo delete of @display_title', array('@display_title' => $display_title)),
|
||||
'#value' => $this->t('Undo delete of @display_title', array('@display_title' => $display_title)),
|
||||
'#limit_validation_errors' => array(),
|
||||
'#submit' => array(array($this, 'submitDisplayUndoDelete'), array($this, 'submitDelayDestination')),
|
||||
'#prefix' => '<li class="undo-delete">',
|
||||
|
@ -453,7 +453,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
if ($is_enabled) {
|
||||
$build['top']['actions']['disable'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Disable @display_title', array('@display_title' => $display_title)),
|
||||
'#value' => $this->t('Disable @display_title', array('@display_title' => $display_title)),
|
||||
'#limit_validation_errors' => array(),
|
||||
'#submit' => array(array($this, 'submitDisplayDisable'), array($this, 'submitDelayDestination')),
|
||||
'#prefix' => '<li class="disable">',
|
||||
|
@ -465,7 +465,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
// The area above the three columns.
|
||||
$build['top']['display_title'] = array(
|
||||
'#theme' => 'views_ui_display_tab_setting',
|
||||
'#description' => t('Display name'),
|
||||
'#description' => $this->t('Display name'),
|
||||
'#link' => $view->getExecutable()->displayHandlers->get($display['id'])->optionLink(check_plain($display_title), 'display_title'),
|
||||
);
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
// The third column buckets are wrapped in details.
|
||||
$build['columns']['third'] = array(
|
||||
'#type' => 'details',
|
||||
'#title' => t('Advanced'),
|
||||
'#title' => $this->t('Advanced'),
|
||||
'#collapsed' => TRUE,
|
||||
'#theme_wrappers' => array('details'),
|
||||
'#attributes' => array(
|
||||
|
@ -661,21 +661,21 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
),
|
||||
'#links' => array(
|
||||
'edit-details' => array(
|
||||
'title' => t('Edit view name/description'),
|
||||
'title' => $this->t('Edit view name/description'),
|
||||
'href' => "admin/structure/views/nojs/edit-details/{$view->id()}/$display_id",
|
||||
'attributes' => array('class' => array('views-ajax-link')),
|
||||
),
|
||||
'analyze' => array(
|
||||
'title' => t('Analyze view'),
|
||||
'title' => $this->t('Analyze view'),
|
||||
'href' => "admin/structure/views/nojs/analyze/{$view->id()}/$display_id",
|
||||
'attributes' => array('class' => array('views-ajax-link')),
|
||||
),
|
||||
'clone' => array(
|
||||
'title' => t('Clone view'),
|
||||
'title' => $this->t('Clone view'),
|
||||
'href' => "admin/structure/views/view/{$view->id()}/clone",
|
||||
),
|
||||
'reorder' => array(
|
||||
'title' => t('Reorder displays'),
|
||||
'title' => $this->t('Reorder displays'),
|
||||
'href' => "admin/structure/views/nojs/reorder-displays/{$view->id()}/$display_id",
|
||||
'attributes' => array('class' => array('views-ajax-link')),
|
||||
),
|
||||
|
@ -685,17 +685,17 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
// Let other modules add additional links here.
|
||||
\Drupal::moduleHandler()->alter('views_ui_display_top_links', $element['extra_actions']['#links'], $view, $display_id);
|
||||
|
||||
if (isset($view->type) && $view->type != t('Default')) {
|
||||
if ($view->type == t('Overridden')) {
|
||||
if (isset($view->type) && $view->type != $this->t('Default')) {
|
||||
if ($view->type == $this->t('Overridden')) {
|
||||
$element['extra_actions']['#links']['revert'] = array(
|
||||
'title' => t('Revert view'),
|
||||
'title' => $this->t('Revert view'),
|
||||
'href' => "admin/structure/views/view/{$view->id()}/revert",
|
||||
'query' => array('destination' => "admin/structure/views/view/{$view->id()}"),
|
||||
);
|
||||
}
|
||||
else {
|
||||
$element['extra_actions']['#links']['delete'] = array(
|
||||
'title' => t('Delete view'),
|
||||
'title' => $this->t('Delete view'),
|
||||
'href' => "admin/structure/views/view/{$view->id()}/delete",
|
||||
);
|
||||
}
|
||||
|
@ -706,7 +706,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
if ($display_id) {
|
||||
$tabs[$display_id]['#active'] = TRUE;
|
||||
}
|
||||
$tabs['#prefix'] = '<h2 class="visually-hidden">' . t('Secondary tabs') . '</h2><ul id = "views-display-menu-tabs" class="tabs secondary">';
|
||||
$tabs['#prefix'] = '<h2 class="visually-hidden">' . $this->t('Secondary tabs') . '</h2><ul id = "views-display-menu-tabs" class="tabs secondary">';
|
||||
$tabs['#suffix'] = '</ul>';
|
||||
$element['tabs'] = $tabs;
|
||||
}
|
||||
|
@ -715,14 +715,14 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
foreach (views_fetch_plugin_names('display', NULL, array($view->get('base_table'))) as $type => $label) {
|
||||
$element['add_display'][$type] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Add !display', array('!display' => $label)),
|
||||
'#value' => $this->t('Add !display', array('!display' => $label)),
|
||||
'#limit_validation_errors' => array(),
|
||||
'#submit' => array(array($this, 'submitDisplayAdd'), array($this, 'submitDelayDestination')),
|
||||
'#attributes' => array('class' => array('add-display')),
|
||||
// Allow JavaScript to remove the 'Add ' prefix from the button label when
|
||||
// placing the button in a "Add" dropdown menu.
|
||||
'#process' => array_merge(array('views_ui_form_button_was_clicked'), element_info_property('submit', '#process', array())),
|
||||
'#values' => array(t('Add !display', array('!display' => $label)), $label),
|
||||
'#values' => array($this->t('Add !display', array('!display' => $label)), $label),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -889,7 +889,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
$build['#name'] = $build['#title'] = $types[$type]['title'];
|
||||
|
||||
$rearrange_url = "admin/structure/views/nojs/rearrange/{$view->id()}/{$display['id']}/$type";
|
||||
$rearrange_text = t('Rearrange');
|
||||
$rearrange_text = $this->t('Rearrange');
|
||||
$class = 'icon compact rearrange';
|
||||
|
||||
// Different types now have different rearrange forms, so we use this switch
|
||||
|
@ -899,7 +899,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
// The rearrange form for filters contains the and/or UI, so override
|
||||
// the used path.
|
||||
$rearrange_url = "admin/structure/views/nojs/rearrange-filter/{$view->id()}/{$display['id']}";
|
||||
$rearrange_text = t('And/Or, Rearrange');
|
||||
$rearrange_text = $this->t('And/Or, Rearrange');
|
||||
// TODO: Add another class to have another symbol for filter rearrange.
|
||||
$class = 'icon compact rearrange';
|
||||
break;
|
||||
|
@ -909,7 +909,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
$uses_fields = $style_plugin && $style_plugin->usesFields();
|
||||
if (!$uses_fields) {
|
||||
$build['fields'][] = array(
|
||||
'#markup' => t('The selected style or row format does not utilize fields.'),
|
||||
'#markup' => $this->t('The selected style or row format does not utilize fields.'),
|
||||
'#theme_wrappers' => array('views_ui_container'),
|
||||
'#attributes' => array('class' => array('views-display-setting')),
|
||||
);
|
||||
|
@ -921,7 +921,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
case 'empty':
|
||||
if (!$executable->display_handler->usesAreas()) {
|
||||
$build[$type][] = array(
|
||||
'#markup' => t('The selected display type does not utilize @type plugins', array('@type' => $type)),
|
||||
'#markup' => $this->t('The selected display type does not utilize @type plugins', array('@type' => $type)),
|
||||
'#theme_wrappers' => array('views_ui_container'),
|
||||
'#attributes' => array('class' => array('views-display-setting')),
|
||||
);
|
||||
|
@ -935,7 +935,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
$count_handlers = count($executable->display_handler->getHandlers($type));
|
||||
|
||||
// Create the add text variable for the add action.
|
||||
$add_text = t('Add <span class="visually-hidden">@type</span>', array('@type' => $types[$type]['ltitle']));
|
||||
$add_text = $this->t('Add <span class="visually-hidden">@type</span>', array('@type' => $types[$type]['ltitle']));
|
||||
|
||||
$actions['add'] = array(
|
||||
'title' => $add_text,
|
||||
|
@ -945,7 +945,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
);
|
||||
if ($count_handlers > 0) {
|
||||
// Create the rearrange text variable for the rearrange action.
|
||||
$rearrange_text = $type == 'filter' ? t('And/Or Rearrange <span class="visually-hidden">filter criteria</span>') : t('Rearrange <span class="visually-hidden">@type</span>', array('@type' => $types[$type]['ltitle']));
|
||||
$rearrange_text = $type == 'filter' ? $this->t('And/Or Rearrange <span class="visually-hidden">filter criteria</span>') : $this->t('Rearrange <span class="visually-hidden">@type</span>', array('@type' => $types[$type]['ltitle']));
|
||||
|
||||
$actions['rearrange'] = array(
|
||||
'title' => $rearrange_text,
|
||||
|
@ -1006,7 +1006,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
$handler = $executable->display_handler->getHandler($type, $id);
|
||||
if (empty($handler)) {
|
||||
$build['fields'][$id]['#class'][] = 'broken';
|
||||
$field_name = t('Broken/missing handler: @table > @field', array('@table' => $field['table'], '@field' => $field['field']));
|
||||
$field_name = $this->t('Broken/missing handler: @table > @field', array('@table' => $field['table'], '@field' => $field['field']));
|
||||
$build['fields'][$id]['#link'] = l($field_name, "admin/structure/views/nojs/config-item/{$view->id()}/{$display['id']}/$type/$id", array('attributes' => array('class' => array('views-ajax-link')), 'html' => TRUE));
|
||||
continue;
|
||||
}
|
||||
|
@ -1022,17 +1022,17 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
if (!empty($field['exclude'])) {
|
||||
$link_attributes['class'][] = 'views-field-excluded';
|
||||
// Add a [hidden] marker, if the field is excluded.
|
||||
$link_text .= ' [' . t('hidden') . ']';
|
||||
$link_text .= ' [' . $this->t('hidden') . ']';
|
||||
}
|
||||
$build['fields'][$id]['#link'] = l($link_text, "admin/structure/views/nojs/config-item/{$view->id()}/{$display['id']}/$type/$id", array('attributes' => $link_attributes, 'html' => TRUE));
|
||||
$build['fields'][$id]['#class'][] = drupal_clean_css_identifier($display['id']. '-' . $type . '-' . $id);
|
||||
|
||||
if ($executable->display_handler->useGroupBy() && $handler->usesGroupBy()) {
|
||||
$build['fields'][$id]['#settings_links'][] = l('<span class="label">' . t('Aggregation settings') . '</span>', "admin/structure/views/nojs/config-item-group/{$view->id()}/{$display['id']}/$type/$id", array('attributes' => array('class' => 'views-button-configure views-ajax-link', 'title' => t('Aggregation settings')), 'html' => TRUE));
|
||||
$build['fields'][$id]['#settings_links'][] = l('<span class="label">' . $this->t('Aggregation settings') . '</span>', "admin/structure/views/nojs/config-item-group/{$view->id()}/{$display['id']}/$type/$id", array('attributes' => array('class' => 'views-button-configure views-ajax-link', 'title' => $this->t('Aggregation settings')), 'html' => TRUE));
|
||||
}
|
||||
|
||||
if ($handler->hasExtraOptions()) {
|
||||
$build['fields'][$id]['#settings_links'][] = l('<span class="label">' . t('Settings') . '</span>', "admin/structure/views/nojs/config-item-extra/{$view->id()}/{$display['id']}/$type/$id", array('attributes' => array('class' => array('views-button-configure', 'views-ajax-link'), 'title' => t('Settings')), 'html' => TRUE));
|
||||
$build['fields'][$id]['#settings_links'][] = l('<span class="label">' . $this->t('Settings') . '</span>', "admin/structure/views/nojs/config-item-extra/{$view->id()}/{$display['id']}/$type/$id", array('attributes' => array('class' => array('views-button-configure', 'views-ajax-link'), 'title' => $this->t('Settings')), 'html' => TRUE));
|
||||
}
|
||||
|
||||
if ($grouping) {
|
||||
|
@ -1056,7 +1056,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
$build['fields'][] = array(
|
||||
'#theme' => 'views_ui_display_tab_setting',
|
||||
'#class' => array('views-group-text'),
|
||||
'#link' => ($group_info['operator'] == 'OR' ? t('OR') : t('AND')),
|
||||
'#link' => ($group_info['operator'] == 'OR' ? $this->t('OR') : $this->t('AND')),
|
||||
);
|
||||
}
|
||||
// Display an operator between each pair of filters within the group.
|
||||
|
@ -1064,7 +1064,7 @@ class ViewEditFormController extends ViewFormControllerBase {
|
|||
$last = end($keys);
|
||||
foreach ($contents as $key => $pid) {
|
||||
if ($key != $last) {
|
||||
$store[$pid]['#link'] .= ' ' . ($group_info['groups'][$gid] == 'OR' ? t('OR') : t('AND'));
|
||||
$store[$pid]['#link'] .= ' ' . ($group_info['groups'][$gid] == 'OR' ? $this->t('OR') : $this->t('AND'));
|
||||
}
|
||||
$build['fields'][$pid] = $store[$pid];
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ abstract class ViewFormControllerBase extends EntityFormController {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityFormController::prepareForm().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function prepareEntity() {
|
||||
// Determine the displays available for editing.
|
||||
|
@ -145,7 +145,7 @@ abstract class ViewFormControllerBase extends EntityFormController {
|
|||
$tabs[$id]['#access'] = TRUE;
|
||||
// Add a class to mark the error and a title to make a hover tip.
|
||||
$tabs[$id]['#link']['localized_options']['attributes']['class'][] = 'error';
|
||||
$tabs[$id]['#link']['localized_options']['attributes']['title'] = t('This display has one or more validation errors.');
|
||||
$tabs[$id]['#link']['localized_options']['attributes']['title'] = $this->t('This display has one or more validation errors.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ abstract class ViewFormControllerBase extends EntityFormController {
|
|||
*/
|
||||
public function getDisplayLabel(ViewUI $view, $display_id, $check_changed = TRUE) {
|
||||
$display = $view->get('display');
|
||||
$title = $display_id == 'default' ? t('Master') : $display[$display_id]['display_title'];
|
||||
$title = $display_id == 'default' ? $this->t('Master') : $display[$display_id]['display_title'];
|
||||
$title = views_ui_truncate($title, 25);
|
||||
|
||||
if ($check_changed && !empty($view->changed_display[$display_id])) {
|
||||
|
|
|
@ -42,7 +42,7 @@ class ViewPreviewFormController extends ViewFormControllerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityFormController::form().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function form(array $form, array &$form_state) {
|
||||
$view = $this->entity;
|
||||
|
@ -65,15 +65,15 @@ class ViewPreviewFormController extends ViewFormControllerBase {
|
|||
$form['controls']['live_preview'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#id' => 'edit-displays-live-preview',
|
||||
'#title' => t('Auto preview'),
|
||||
'#title' => $this->t('Auto preview'),
|
||||
'#default_value' => \Drupal::config('views.settings')->get('ui.always_live_preview'),
|
||||
);
|
||||
|
||||
// Add the arguments textfield
|
||||
$form['controls']['view_args'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Preview with contextual filters:'),
|
||||
'#description' => t('Separate contextual filter values with a "/". For example, %example.', array('%example' => '40/12/10')),
|
||||
'#title' => $this->t('Preview with contextual filters:'),
|
||||
'#description' => $this->t('Separate contextual filter values with a "/". For example, %example.', array('%example' => '40/12/10')),
|
||||
'#id' => 'preview-args',
|
||||
);
|
||||
|
||||
|
@ -96,7 +96,7 @@ class ViewPreviewFormController extends ViewFormControllerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Drupal\Core\Entity\EntityFormController::actions().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function actions(array $form, array &$form_state) {
|
||||
$view = $this->entity;
|
||||
|
@ -106,7 +106,7 @@ class ViewPreviewFormController extends ViewFormControllerBase {
|
|||
),
|
||||
'button' => array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Update preview'),
|
||||
'#value' => $this->t('Update preview'),
|
||||
'#attributes' => array('class' => array('arguments-preview')),
|
||||
'#submit' => array(array($this, 'submitPreview')),
|
||||
'#id' => 'preview-submit',
|
||||
|
|
Loading…
Reference in New Issue