You are here

function asset_wizard_get_config in Asset 6

Same name and namespace in other branches
  1. 5.2 asset_wizard.module \asset_wizard_get_config()

Load the current asset wizard config array, passed in throught $_GET['config'] Options for config are 'macro' (default), 'id', or the name of a cck field

3 calls to asset_wizard_get_config()
asset_wizard_browse in ./asset_wizard.module
Step 1: Display a browsable list of assets
asset_wizard_main in ./asset_wizard.module
asset_wizard_textfield2 in ./asset_wizard.module
The #process callback function for the textfield

File

./asset_wizard.module, line 351
Wizard-style interface for Asset.

Code

function asset_wizard_get_config($cfg_name = NULL) {
  static $configs = array();
  $cfg_name = $cfg_name ? $cfg_name : ($_GET['config'] ? $_GET['config'] : 'default');
  $config = array();
  if (!isset($config[$cfg_name])) {

    // build an array of asset cck fields
    $asset_fields = array();
    if (module_exists('content')) {
      $fields = content_fields();
      foreach ($fields as $name => $field) {
        if ($field['type'] == 'asset') {
          $asset_fields[$name] = $field;
        }
      }
    }

    // asset field config
    if ($asset_fields[$cfg_name]) {
      $config = $asset_fields[$cfg_name];
      $config['return type'] = 'id';
    }
    elseif ($cfg_name == 'id') {
      $config = array(
        'return type' => 'id',
      );
    }
    else {
      $config = array(
        'return type' => 'macro',
      );
    }
    $configs[$cfg_name] = $config;
  }
  return $configs[$cfg_name];
}