You are here

function menu_block_get_config in Menu Block 7.2

Same name and namespace in other branches
  1. 6.2 menu_block.module \menu_block_get_config()
  2. 7.3 menu_block.module \menu_block_get_config()

Returns the configuration for the requested block delta.

Parameters

string $delta: The delta that uniquely identifies the block in the block system. If not specified, the default configuration will be returned. This is deprecated. Use menu_block_default_config() instead.

Return value

array An associated array of configuration options.

See also

menu_block_default_config()

9 calls to menu_block_get_config()
menu_block_block_view in ./menu_block.module
Implements hook_block_view().
menu_block_delete in ./menu_block.module
Delete a menu block.
menu_block_delete_form in ./menu_block.admin.inc
Menu callback: confirm deletion of menu blocks.
menu_block_export_form_submit in ./menu_block_export.admin.inc
Submit callback for menu_block_export_form().
menu_block_menu_delete in ./menu_block.module
Implements hook_menu_delete().

... See full list

File

./menu_block.module, line 284
Provides configurable blocks of menu items.

Code

function menu_block_get_config($delta = NULL) {
  static $defaults, $exported;
  if (!isset($defaults)) {
    $defaults = menu_block_default_config();
  }
  if (!isset($delta)) {
    return $defaults;
  }
  if (!isset($exported)) {
    $exported = menu_block_get_exported_blocks();
  }
  $configs =& drupal_static(__FUNCTION__, array());
  if (!isset($configs[$delta])) {
    $config = array();

    // Check if this an exported menu block.
    if (isset($exported[$delta])) {
      $config += $exported[$delta];
      $config['exported_to_code'] = TRUE;

      // Exported blocks generally have 'menu_name' and 'parent_mlid' defined
      // but not 'parent'
      if (!isset($config['parent'])) {
        $config['parent'] = $config['menu_name'] . ':' . $config['parent_mlid'];
      }
    }

    // Add in variable overrides and defaults.
    foreach ($defaults as $key => $default) {
      $override = variable_get("menu_block_{$delta}_{$key}");
      if (isset($override)) {
        $config[$key] = $override;
      }
      elseif (!isset($config[$key])) {
        $config[$key] = $default;
      }
    }

    // Split out the 'parent' item into 'menu_name' and 'parent_mlid'.
    if (!isset($config['menu_name']) && !isset($config['parent_mlid'])) {
      list($config['menu_name'], $config['parent_mlid']) = explode(':', $config['parent']);
    }
    $config['delta'] = $delta;
    $configs[$delta] = $config;
  }
  return $configs[$delta];
}