public function EntityReferenceEntityFormatter::settingsForm in Entity reference 8
Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::settingsForm().
File
- lib/
Drupal/ entityreference/ Plugin/ field/ formatter/ EntityReferenceEntityFormatter.php, line 39 - Definition of Drupal\entityreference\Plugin\field\formatter\EntityReferenceEntityFormatter.
Class
- EntityReferenceEntityFormatter
- Plugin implementation of the 'entity-reference rendered entity' formatter.
Namespace
Drupal\entityreference\Plugin\field\formatterCode
public function settingsForm(array $form, array &$form_state) {
$entity_info = entity_get_info($this->field['settings']['target_type']);
$options = array();
if (!empty($entity_info['view modes'])) {
foreach ($entity_info['view modes'] as $view_mode => $view_mode_settings) {
$options[$view_mode] = $view_mode_settings['label'];
}
}
$elements['view_mode'] = array(
'#type' => 'select',
'#options' => $options,
'#title' => t('View mode'),
'#default_value' => $this
->getSetting('view_mode'),
'#required' => TRUE,
);
$elements['links'] = array(
'#type' => 'checkbox',
'#title' => t('Show links'),
'#default_value' => $this
->getSetting('links'),
);
return $elements;
}