summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2013-07-15 22:07:02 (GMT)
committerAlex Pott2013-07-15 22:07:02 (GMT)
commit6023052c773b7ce112a7405d30170614b4f15b08 (patch)
tree6b0b665bfe1d6c3802f7bcdb1c3e35819bb732c7
parent9e4991d66f60dc46a15543828f77a5e7066edac5 (diff)
Issue #2035697 by Dave Reid: Fixed Entity reference formatter should default to the 'Default' view mode.
-rw-r--r--core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceEntityFormatter.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceEntityFormatter.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceEntityFormatter.php
index 51d48b9..4b8df9c 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceEntityFormatter.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceEntityFormatter.php
@@ -25,7 +25,7 @@ use Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase;
* "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 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase {
$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');