function DummyImageProvider::settingsForm in Devel images provider 8
Same name in this branch
- 8 plugins/devel_image_provider/provider/DummyImageProvider.class.php \DummyImageProvider::settingsForm()
- 8 lib/Drupal/devel_image_provider/Plugin/devel_image_provider/provider/DummyImageProvider.php \Drupal\devel_image_provider\Plugin\devel_image_provider\provider\DummyImageProvider::settingsForm()
Generates a settings form for this handler.
Overrides DevelImageProviderPluginBase::settingsForm
File
- lib/
Drupal/ devel_image_provider/ Plugin/ devel_image_provider/ provider/ DummyImageProvider.php, line 28 - Contains \Drupal\devel_image_provider\Plugin\devel_image_provider\provider\DummyImageProvider.
Class
- DummyImageProvider
- Dummy image provider plugin.
Namespace
Drupal\devel_image_provider\Plugin\devel_image_provider\providerCode
function settingsForm() {
$info = $this
->getDefinition();
$form = parent::settingsForm();
$form['devel_image_provider_' . $info['id']]['devel_image_provider_background_color'] = array(
'#type' => 'textfield',
'#title' => t('Custom Background Color'),
'#description' => t('Optional: Enter a background color in hex notation (e.g. #BADA55).'),
'#default_value' => isset($this->settings['devel_image_provider_background_color']) ? $this->settings['devel_image_provider_background_color'] : NULL,
);
$form['devel_image_provider_' . $info['id']]['devel_image_provider_text_color'] = array(
'#type' => 'textfield',
'#title' => t('Custom Text Color'),
'#description' => t('Optional: Enter a text color in hex notation (e.g. #B00B00). Note that text color requires a background color to be specified as well.'),
'#default_value' => isset($this->settings['devel_image_provider_text_color']) ? $this->settings['devel_image_provider_text_color'] : NULL,
);
$form['devel_image_provider_' . $info['id']]['devel_image_provider_include_text'] = array(
'#type' => 'radios',
'#title' => t('Choose the text added inside the generated image'),
'#default_value' => isset($this->settings['devel_image_provider_include_text']) ? $this->settings['devel_image_provider_include_text'] : 'default',
'#options' => array(
'default' => t('Default (image dimensions)'),
'random' => t('Random text'),
'custom' => t('Custom text'),
),
);
$form['devel_image_provider_' . $info['id']]['devel_image_provider_custom_text'] = array(
'#type' => 'textfield',
'#title' => t('Custom Text'),
'#maxlength' => 255,
'#description' => t('Enter some custom text to be rendered instead of the default image dimensions.'),
'#default_value' => isset($this->settings['devel_image_provider_custom_text']) ? $this->settings['devel_image_provider_custom_text'] : NULL,
'#states' => array(
'visible' => array(
':input[name="config_providers[devel_image_provider_' . $info['id'] . '][devel_image_provider_include_text]"]' => array(
'value' => 'custom',
),
),
),
);
return $form;
}