function ds_switch_view_mode_entity_base_field_info in Display Suite 8.2
Same name and namespace in other branches
- 8.4 modules/ds_switch_view_mode/ds_switch_view_mode.module \ds_switch_view_mode_entity_base_field_info()
- 8.3 modules/ds_switch_view_mode/ds_switch_view_mode.module \ds_switch_view_mode_entity_base_field_info()
Implements hook_entity_base_field_info().
File
- modules/
ds_switch_view_mode/ ds_switch_view_mode.module, line 18 - Display Suite Switch View mode.
Code
function ds_switch_view_mode_entity_base_field_info(EntityTypeInterface $entity_type) {
if ($entity_type
->id() == 'node') {
// Add the switch field as a base field.
$fields = array();
$fields['ds_switch'] = BaseFieldDefinition::create('string')
->setLabel(t('DS switch'))
->setName('ds_switch')
->setRevisionable(TRUE)
->setDescription(t('Holds the DS view mode of the node.'))
->setSetting('default_value', '')
->setPropertyConstraints('value', array(
'Length' => array(
'max' => 60,
),
));
return $fields;
}
}