function PlaceholdProvider::settingsForm in Devel images provider 7
Same name and namespace in other branches
- 8 plugins/devel_image_provider/provider/PlaceholdProvider.class.php \PlaceholdProvider::settingsForm()
Generates a settings form for this handler.
Overrides DevelImagesProviderBase::settingsForm
File
- plugins/
devel_image_provider/ provider/ PlaceholdProvider.class.php, line 24 - Placehold support class.
Class
- PlaceholdProvider
- Add support for placehold.it.
Code
function settingsForm() {
$form = parent::settingsForm();
// No gray option for this provider.
unset($form['devel_image_provider_' . $this->plugin['name']]['devel_image_provider_gray']);
// Provider specific settings.
$form['devel_image_provider_' . $this->plugin['name']]['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_' . $this->plugin['name']]['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_' . $this->plugin['name']]['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_' . $this->plugin['name']]['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_' . $this->plugin['name'] . '][devel_image_provider_include_text]"]' => array(
'value' => 'custom',
),
),
),
);
return $form;
}