public function QtabsContent::optionsForm in Quick Tabs 8.3
Return form elements used on the edit/add from.
Parameters
array $tab: The array tab for display.
Return value
array The options used for displaying tabs.
Overrides TabTypeBase::optionsForm
File
- src/
Plugin/ TabType/ QtabsContent.php, line 23
Class
- QtabsContent
- Provides a 'qtabs content' tab type.
Namespace
Drupal\quicktabs\Plugin\TabTypeCode
public function optionsForm(array $tab) {
$plugin_id = $this
->getPluginDefinition()['id'];
$form = [];
$tab_options = [];
foreach (\Drupal::entityTypeManager()
->getStorage('quicktabs_instance')
->loadMultiple() as $machine_name => $entity) {
// Do not offer the option to put a tab inside itself.
if (!isset($tab['entity_id']) || $machine_name != $tab['entity_id']) {
$tab_options[$machine_name] = $entity
->label();
}
}
$form['machine_name'] = [
'#type' => 'select',
'#title' => $this
->t('QuickTabs instance'),
'#description' => $this
->t('The QuickTabs instance to put inside this tab.'),
'#options' => $tab_options,
'#default_value' => isset($tab['content'][$plugin_id]['options']['machine_name']) ? $tab['content'][$plugin_id]['options']['machine_name'] : '',
];
return $form;
}