function om_maximenu_blocks_attach in OM Maximenu 6
Same name and namespace in other branches
- 8 inc/om_maximenu.blocks.inc \om_maximenu_blocks_attach()
- 7 inc/om_maximenu.blocks.inc \om_maximenu_blocks_attach()
Block list in table format
1 call to om_maximenu_blocks_attach()
- om_maximenu_blocks_get in inc/
om_maximenu.blocks.inc - Adding Blocks
File
- inc/
om_maximenu.blocks.inc, line 171 - OM Maximenu Blocks.
Code
function om_maximenu_blocks_attach($module = NULL, $blocks = array()) {
$out = array();
foreach ($blocks as $delta => $value) {
$block_title = trim($value['title']) != '<none>' ? t(om_string_name($value['title'], FALSE)) : t(ucwords(t($module . ' ' . $delta)));
$out['module'] = array(
'#type' => 'hidden',
'#default_value' => $module,
);
$out['om_blocks'][$module . '___' . $delta] = array(
'#type' => 'fieldset',
'#title' => t($block_title),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$out['om_blocks'][$module . '___' . $delta]['checked'] = array(
'#type' => 'checkbox',
'#title' => t('Enabled'),
'#default_value' => isset($value['checked']) ? $value['checked'] : 0,
);
$out['om_blocks'][$module . '___' . $delta]['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => isset($value['title']) ? trim(stripslashes($value['title'])) : '',
'#description' => t('Put <none> for no title. You can add inline styling or other attributes, <br />
ex. <span class="special-link" style="font-weight: normal;">My Title</span>'),
);
$out['om_blocks'][$module . '___' . $delta]['title_path'] = array(
'#type' => 'textfield',
'#title' => t('Path'),
'#default_value' => trim($value['title_path']),
'#autocomplete_path' => module_exists('mpac') ? 'mpac/autocomplete' : '',
'#description' => t('You can make the title clickable by adding a path. Ex. <front>, somepath, node/1'),
);
$out['om_blocks'][$module . '___' . $delta]['title_path_query'] = array(
'#type' => 'textfield',
'#title' => t('Path Query'),
'#default_value' => trim($value['title_path_query']),
'#description' => t('Ex. ?destination=node&me=you, but DO NOT include \'?\'.'),
);
$out['om_blocks'][$module . '___' . $delta]['title_path_fragment'] = array(
'#type' => 'textfield',
'#title' => t('Anchor'),
'#default_value' => trim($value['title_path_fragment']),
'#description' => t('Ex. #section-1, but DO NOT include \'#\'. This can correspond to the id name of a tag, ex. <div id="section-1",<br />
so you can now target this section by doing "about#section-1", and the page will automatically scroll to that section.'),
);
$out['om_blocks'][$module . '___' . $delta]['module'] = array(
'#type' => 'hidden',
'#default_value' => $module,
);
$out['om_blocks'][$module . '___' . $delta]['delta'] = array(
'#type' => 'hidden',
'#default_value' => $delta,
);
$out['om_blocks'][$module . '___' . $delta]['weight'] = array(
'#type' => 'weight',
'#title' => t('Weight'),
'#delta' => 20,
'#default_value' => $value['weight'],
'#description' => t('Negative values have the highest position in the order, so -1 comes first before 0 then 1, ...'),
);
$out['om_blocks'][$module . '___' . $delta]['visibility'] = array(
'#type' => 'checkbox',
'#title' => t('Use Drupal\'s block visibility settings'),
'#default_value' => $value['visibility'],
'#description' => t('You can set visibility in ') . om_maximenu_block_edit($module, $delta, $block_title),
);
}
return $out;
}