abstract class DevelImagesProviderBase in Devel images provider 8
Same name and namespace in other branches
- 7 plugins/devel_image_provider/provider/base.inc \DevelImagesProviderBase
An abstract implementation of DevelImagesProviderInterface.
Hierarchy
- class \DevelImagesProviderBase implements DevelImagesProviderInterface
Expanded class hierarchy of DevelImagesProviderBase
File
- plugins/
devel_image_provider/ provider/ base.inc, line 41 - Base devel image providers plugin class.
View source
abstract class DevelImagesProviderBase implements DevelImagesProviderInterface {
/**
* The provider url.
*
* @var string
*/
protected $provider_base_url;
/**
* Defined settings for the method.
*
* @var string
*/
protected $settings;
public function __construct($plugin) {
$this->plugin = $plugin;
$this->settings = variable_get('devel_image_provider_settings_' . $this->plugin['name'], array());
}
public function availableMethods() {
return drupal_map_assoc(array(
'curl',
'gd',
'file_get_contents',
));
}
public function settingsForm() {
$form['devel_image_provider_' . $this->plugin['name']] = array(
'#type' => 'fieldset',
'#title' => t('Provider settings'),
'#states' => array(
'visible' => array(
':input[name="available_providers[devel_image_provider_method_selected]"]' => array(
'value' => $this->plugin['name'],
),
),
),
);
$methods = $this
->availableMethods();
if (!empty($methods)) {
$form['devel_image_provider_' . $this->plugin['name']]['devel_image_provider_get_method'] = array(
'#type' => 'radios',
'#title' => t('Method to get files'),
'#default_value' => isset($this->settings['devel_image_provider_get_method']) ? $this->settings['devel_image_provider_get_method'] : 'file_get_contents',
'#options' => $this
->availableMethods(),
);
}
$form['devel_image_provider_' . $this->plugin['name']]['devel_image_provider_gray'] = array(
'#type' => 'checkbox',
'#title' => t('Gray version'),
'#default_value' => isset($this->settings['devel_image_provider_gray']) ? $this->settings['devel_image_provider_gray'] : NULL,
);
return $form;
}
public function settingsFormValidate(&$form, &$form_state) {
}
public function settingsFormSubmit(&$form, &$form_state) {
$values = $form_state['values']['config_providers']['devel_image_provider_' . $this->plugin['name']];
variable_set('devel_image_provider_settings_' . $this->plugin['name'], $values);
}
public function generateImage($object, $field, $instance, $bundle) {
}
}