You are here

function tb_megamenu_export_convert_mlids in The Better Mega Menu 7

Converts the "mlid" fields to system-independent identifiers.

Recursively convert the "mlid" fields of the given menu configuration array or subarray to system-independent identifiers.

Parameters

array $config: Menu configuration array or subarray.

int $mlid: mlid for the item represented by the given config. Set this if there is none set in the config itself.

1 call to tb_megamenu_export_convert_mlids()
tb_megamenu_features_export_render in ./tb_megamenu.features.inc
Implements hook_features_export_render().

File

./tb_megamenu.features.inc, line 150
Features related functions.

Code

function tb_megamenu_export_convert_mlids(&$config, $mlid = NULL) {
  if (is_array($config)) {
    foreach ($config as $key => $value) {
      if ($key === 'mlid') {
        $config['identifier'] = tb_megamenu_export_mlid_to_identifier($value);
        unset($config['mlid']);
      }
      elseif (is_array($value)) {
        tb_megamenu_export_convert_mlids($config[$key]);
      }
    }
    if ($mlid && !array_key_exists('identifier', $config)) {
      $config['identifier'] = tb_megamenu_export_mlid_to_identifier($mlid);
    }
  }
}