public function Random::optionsForm in Openlayers 7.3
Same name in this branch
- 7.3 modules/openlayers_library/src/Plugin/Style/Random/Random.php \Drupal\openlayers_library\Plugin\Style\Random\Random::optionsForm()
- 7.3 modules/openlayers_library/src/Plugin/Source/Random/Random.php \Drupal\openlayers_library\Plugin\Source\Random\Random::optionsForm()
@TODO What is this return? If it is the form, why is form by reference?
Overrides Base::optionsForm
File
- modules/
openlayers_library/ src/ Plugin/ Source/ Random/ Random.php, line 22 - Source: Random.
Class
- Random
- Class Random.
Namespace
Drupal\openlayers_library\Plugin\Source\RandomCode
public function optionsForm(array &$form, array &$form_state) {
foreach (Openlayers::getGeometryTypes() as $geometry_type => $geometry) {
if (!in_array($geometry_type, array(
'Point',
'LineString',
'Polygon',
))) {
continue;
}
$enabled = (bool) $this
->getOption(array(
$geometry_type,
'count',
), FALSE);
$form['options'][$geometry_type] = array(
'#type' => 'fieldset',
'#title' => t('Geometry @geometry', array(
'@geometry' => $geometry,
)),
'#collapsible' => TRUE,
'#collapsed' => !$enabled,
);
$form['options'][$geometry_type]['count'] = array(
'#type' => 'textfield',
'#title' => t('Number of features'),
'#default_value' => $this
->getOption(array(
$geometry_type,
'count',
), 0),
'#required' => TRUE,
);
$form['options'][$geometry_type]['setRandomStyle'] = array(
'#type' => 'checkbox',
'#title' => t('Set random style on features ?'),
'#default_value' => $this
->getOption(array(
$geometry_type,
'setRandomStyle',
), 0),
);
$form['options'][$geometry_type]['styles'] = array(
'#type' => 'select',
'#title' => t('Styles'),
'#empty_option' => t('- Select the Styles -'),
'#default_value' => $this
->getOption(array(
$geometry_type,
'styles',
), array()),
'#description' => t('Select the styles.'),
'#options' => Openlayers::loadAllAsOptions('Style'),
'#multiple' => TRUE,
'#states' => array(
'visible' => array(
'input[name="options[' . $geometry_type . '][setRandomStyle]"' => array(
'checked' => TRUE,
),
),
),
);
}
}