function openlayers_source_form_type in Openlayers 7.3
Source type config form handler.
1 string reference to 'openlayers_source_form_type'
- openlayers_ui_OpenlayersSources_ctools_export_ui in modules/
openlayers_ui/ src/ Plugin/ export_ui/ OpenlayersSources.inc - CTools Export UI plugin definition.
File
- modules/
openlayers_ui/ src/ Plugin/ export_ui/ OpenlayersSources.inc, line 119 - CTools Export UI plugin definition for sources.
Code
function openlayers_source_form_type($form, &$form_state) {
$form['factory_service'] = array(
'#type' => 'select',
'#title' => t('Source Type'),
'#empty_option' => t('- Select a @plugin type -', array(
'@plugin' => 'Source',
)),
'#default_value' => isset($form_state['item']->factory_service) ? $form_state['item']->factory_service : '',
'#description' => t('Select the type of source.'),
'#options' => \Drupal\openlayers\Openlayers::getOLObjectsOptions('Source'),
'#required' => TRUE,
);
$form['options'] = array(
'#tree' => TRUE,
);
$form['options']['attributions'] = array(
'#type' => 'fieldset',
'#title' => t('Attributions options'),
);
$form['options']['attributions']['enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enable attributions'),
'#default_value' => isset($form_state['item']->options['attributions']) ? TRUE : FALSE,
'#description' => t('Enable attributions ?'),
);
$form['options']['attributions']['data'] = array(
'#type' => 'textfield',
'#title' => t('Attributions'),
'#default_value' => isset($form_state['item']->options['attributions']) ? $form_state['item']->options['attributions'] : '',
'#description' => t('Attributions HTML text. Empty to disable.'),
'#states' => array(
'visible' => array(
':input[name="options[attributions][enabled]"]' => array(
'checked' => TRUE,
),
),
),
);
return $form;
}