function block_patterns_build in Patterns 7
File
- patterns_components/
components/ block.inc, line 233
Code
function block_patterns_build($action, $form_id, &$data, &$a) {
$status = PATTERNS_SUCCESS;
$msg = '';
$result = NULL;
module_load_include('inc', 'block', 'block.admin');
// TODO: is this needed?
// Fetch and sort blocks
$blocks = _block_rehash();
usort($blocks, '_block_compare');
if ($form_id == 'block_custom_block_delete') {
$data['op'] = t('Delete');
$data['confirm'] = 1;
}
elseif ($form_id == 'block_admin_display_form') {
if (isset($data['status']) && $data['status'] == 0) {
$data['region'] = -1;
// BLOCK_REGION_NONE, modules/block/block.module
}
// Make sure delta is defined even for blocks that have just been created within the same action.
if ($data['module'] == 'block' && empty($data['delta'])) {
// We can do this because block descriptions are always unique.
$data['delta'] = db_query('SELECT bid FROM {block_custom} WHERE info = :info', array(
'info' => $data['info'],
))
->fetchField();
}
$data = array(
$data['module'] . '_' . $data['delta'] => $data,
);
}
$result = $data;
return patterns_results($status, $msg, $result);
}