Skip to content
Snippets Groups Projects
Commit ee26b4b8 authored by catch's avatar catch
Browse files

Issue #2409591 by pguillard, mayurjadhav, Artusamak, marcoscano, chris_h,...

Issue #2409591 by pguillard, mayurjadhav, Artusamak, marcoscano, chris_h, ifrik, amateescu: Increase discoverability of view modes
parent 5e86905f
No related branches found
No related tags found
No related merge requests found
......@@ -205,10 +205,12 @@ public function form(array $form, FormStateInterface $form_state) {
}
$form['modes']['display_modes_custom'] = array(
'#type' => 'checkboxes',
'#title' => $this->t('Use custom display settings for the following modes'),
'#title' => $this->t('Use custom display settings for the following @display_context modes', ['@display_context' => $this->displayContext]),
'#options' => $display_mode_options,
'#default_value' => $default,
);
// Provide link to manage display modes.
$form['modes']['display_modes_link'] = $this->getDisplayModesLink();
}
}
......@@ -790,6 +792,14 @@ abstract protected function getDisplayModes();
*/
abstract protected function getDisplayModeOptions();
/**
* Returns a link to the form or view mode admin page.
*
* @return array
* An array of a form element to be rendered as a link.
*/
abstract protected function getDisplayModesLink();
/**
* Returns the region to which a row in the display overview belongs.
*
......
......@@ -6,6 +6,7 @@
use Drupal\Core\Field\PluginSettingsInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\Core\Link;
use Drupal\field_ui\FieldUI;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -75,6 +76,17 @@ protected function getDisplayModeOptions() {
return $this->entityManager->getFormModeOptions($this->entity->getTargetEntityTypeId());
}
/**
* {@inheritdoc}
*/
protected function getDisplayModesLink() {
return [
'#type' => 'link',
'#title' => t('Manage form modes'),
'#url' => Url::fromRoute('entity.entity_form_mode.collection'),
];
}
/**
* {@inheritdoc}
*/
......
......@@ -6,6 +6,7 @@
use Drupal\Core\Field\PluginSettingsInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\Core\Link;
use Drupal\field_ui\FieldUI;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -108,6 +109,17 @@ protected function getDisplayModeOptions() {
return $this->entityManager->getViewModeOptions($this->entity->getTargetEntityTypeId());
}
/**
* {@inheritdoc}
*/
protected function getDisplayModesLink() {;
return [
'#type' => 'link',
'#title' => t('Manage view modes'),
'#url' => Url::fromRoute('entity.entity_view_mode.collection'),
];
}
/**
* {@inheritdoc}
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment