public function RecentlyReadRelationship::buildOptionsForm in Recently Read 8
Provide a form to edit options for this plugin.
Overrides RelationshipPluginBase::buildOptionsForm
File
- src/
Plugin/ views/ relationship/ RecentlyReadRelationship.php, line 111
Class
- RecentlyReadRelationship
- Provides a views relationship to recently read.
Namespace
Drupal\recently_read\Plugin\views\relationshipCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$entity_type = $this->definition['recently_read_type'];
$typesOptions = FALSE;
// Read the entity_type configuration and load the types.
$types = $this->cachedStorage
->read('recently_read.recently_read_type.' . $entity_type)['types'];
// If types are enabled prepare the array for checkboxes options.
if (isset($types) && !empty($types)) {
$typesOptions = array_combine($types, $types);
}
if ($typesOptions) {
$form['bundles'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Bundles'),
'#default_value' => $this->options['bundles'],
'#options' => $typesOptions,
];
}
}