Skip to content
Snippets Groups Projects
Commit 6023052c authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2035697 by Dave Reid: Fixed Entity reference formatter should default...

Issue #2035697 by Dave Reid: Fixed Entity reference formatter should default to the 'Default' view mode.
parent 9e4991d6
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -25,7 +25,7 @@
* "entity_reference"
* },
* settings = {
* "view_mode" = "",
* "view_mode" = "default",
* "link" = FALSE
* }
* )
......@@ -37,7 +37,7 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase {
*/
public function settingsForm(array $form, array &$form_state) {
$view_modes = entity_get_view_modes($this->getFieldSetting('target_type'));
$options = array();
$options = array('default' => t('Default'));
foreach ($view_modes as $view_mode => $view_mode_settings) {
$options[$view_mode] = $view_mode_settings['label'];
}
......@@ -67,6 +67,9 @@ public function settingsSummary() {
$view_modes = entity_get_view_modes($this->getFieldSetting('target_type'));
$view_mode = $this->getSetting('view_mode');
if ($view_mode == 'default') {
$view_mode = t('Default');
}
$summary[] = t('Rendered as @mode', array('@mode' => isset($view_modes[$view_mode]['label']) ? $view_modes[$view_mode]['label'] : $view_mode));
$summary[] = $this->getSetting('links') ? t('Display links') : t('Do not display links');
......
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