1 block.hero.inc | BlockHero::form(&$form, &$form_state) |
Builds the block's configuration form.
Overrides BlockText::form
File
- core/
modules/ layout/ includes/ block.hero.inc, line 52
Class
- BlockHero
- BlockHero extends BlockText
Code
function form(&$form, &$form_state) {
parent::form($form, $form_state);
$supported_extensions = image_get_supported_extensions();
$upload_validators = array(
'file_validate_extensions' => array(implode(' ', $supported_extensions)),
'file_validate_image_resolution' => array('3200x1600', '1200x300'),
);
$upload_description = theme('file_upload_help', array(
'upload_validators' => $upload_validators,
));
// Add an image field at the top of the settings form.
$form['image'] = array(
'#type' => 'managed_file',
'#title' => t('Background image'),
'#description' => $upload_description,
'#default_value' => $this->settings['image'],
'#upload_location' => 'public://hero/',
'#upload_validators' => $upload_validators,
'#weight' => -10,
);
// Store the image path separately.
$form['image_path'] = array(
'#type' => 'value',
'#value' => $this->settings['image_path'],
);
// Disable reusable until a later date.
$form['convert']['#access'] = FALSE;
}