function views_handler_field_block::options_form in Views block area 7
Default options form that provides the label widget that all fields should have.
Overrides views_handler_field::options_form
File
- views/
handlers/ views_handler_field_block.inc, line 25 - Block area handlers. Insert a block inside of an area.
Class
- views_handler_field_block
- @file Block area handlers. Insert a block inside of an area.
Code
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$query = db_select('block', 'b');
$query
->leftJoin('block_custom', 'c', 'b.delta = c.bid AND b.module = :module', array(
':module' => 'block',
));
$result = $query
->fields('b')
->fields('c', array(
'info',
))
->orderBy('b.module')
->condition('b.module', 'views', '!=')
->addTag('block_load')
->addTag('translatable')
->execute();
$block_info = $result
->fetchAllAssoc('bid');
// Allow modules to modify the block list.
drupal_alter('block_list', $block_info);
$options = array();
foreach ($block_info as $block) {
$options["{$block->module}:{$block->delta}"] = t('@module:@delta@title', array(
'@module' => $block->module,
'@delta' => $block->delta,
'@title' => !empty($block->info) ? ' (' . $block->info . ')' : ($block->title == '<none>' || $block->title == '' ? '' : ' (' . $block->title . ')'),
));
}
$form['block_to_insert'] = array(
'#type' => 'select',
'#title' => t('Block to insert'),
'#default_value' => $this->options['block_to_insert'],
'#description' => t('The block to insert into this area.'),
'#options' => $options,
);
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Block title'),
'#default_value' => $this->options['title'],
'#description' => t('Override the title for the block. Use <none> to display no title, or leave blank to use the block title from block settings.'),
);
}