_menu_helper_blocks_append_configuration_to_form

custom/menu_helper/menu_helper_blocks/menu_helper_blocks.module, line 918

Versions
6
_menu_helper_blocks_append_configuration_to_form(&$form, $delta)

Add append block configuration settings to form or fieldset.

This allows elements to be reused on the 'Add content' and 'Add path' block configuration and the admin page (admin/build/menu/helper/blocks).

▾ 2 functions call _menu_helper_blocks_append_configuration_to_form()

menu_helper_blocks_admin_form in custom/menu_helper/menu_helper_blocks/menu_helper_blocks.admin.inc
Administration form for 'Menu helper submenu'
menu_helper_blocks_block in custom/menu_helper/menu_helper_blocks/menu_helper_blocks.module
Implementation of hook_block().

Code

<?php
function _menu_helper_blocks_append_configuration_to_form(&$form, $delta) {

  // Max depth
  $depth_options = _menu_helper_get_depth_titles();
  $depth_options[0] = 'no limit';
  $form['menu_helper_blocks_'. $delta .'_max_menu_depth'] = array(
    '#type' => 'select',
    '#title' => t('Display block for active menu items below the nth level'),
    '#options' => $depth_options,
    '#default_value' => variable_get('menu_helper_blocks_'. $delta .'_max_menu_depth', ''),
  );

  // Get menu names options.
  $result = db_query("SELECT menu_name, title FROM {menu_custom} ORDER BY title");
  while ($menu = db_fetch_array($result)) {
    $blocks_menus_options[ $menu['menu_name'] ] = $menu['title'];
  }

  // Menus
  $form['menu_helper_blocks_'. $delta .'_menus'] = array(
    '#type' => 'checkboxes',
    '#title' => t("Display 'Add @delta to menu' block for only these selected menus", array('@delta' => t($delta))),
    '#options' => $blocks_menus_options ,
    '#default_value' => variable_get('menu_helper_blocks_'. $delta .'_menus', array('primary-links', 'secondary-links')),
    '#description' => t("Leave blank to display block for all menus."),
  );

  return $form;
}
?>