You are here

function _hs_menu_apply_config in Hierarchical Select 7.3

Same name and namespace in other branches
  1. 6.3 modules/hs_menu.module \_hs_menu_apply_config()

Helper function to apply the HS config to a form item.

2 calls to _hs_menu_apply_config()
hs_menu_form_menu_edit_item_alter in modules/hs_menu.module
Implements hook_form_BASE_FORMID_alter().
hs_menu_form_node_form_alter in modules/hs_menu.module
Implements hook_form_FORMID_alter().

File

modules/hs_menu.module, line 290
Implementation of the Hierarchical Select API for the Menu module.

Code

function _hs_menu_apply_config(&$form, $params) {

  // The following is to ensure via javascript self is not listed.
  if (!empty($params['exclude'])) {
    $params['exclude'] = $params['exclude'][0] . ':' . $params['exclude'][1];
    drupal_add_js('jQuery(document).ready(function () {
        jQuery("[value*=\\"' . $params['exclude'] . '\\"]").hide();
    });', 'inline');
  }
  $form['#config'] = array(
    'module' => 'hs_menu',
    'params' => array(
      'exclude' => isset($params['exclude']) ? $params['exclude'] : NULL,
      'type' => isset($params['type']) ? $params['type'] : NULL,
    ),
    'save_lineage' => 0,
    'enforce_deepest' => 0,
    'resizable' => variable_get('hs_menu_resizable', 1),
    'level_labels' => array(
      'status' => 0,
    ),
    'dropbox' => array(
      'status' => 0,
    ),
    'editability' => array(
      'status' => 0,
    ),
    'entity_count' => array(
      'enabled' => 0,
      'require_entity' => 0,
      'settings' => array(
        'count_children' => 0,
        'entity_types' => array(),
      ),
    ),
    'render_flat_select' => 0,
  );
}