You are here

function asset_wizard_toolbar in Asset 6

Same name in this branch
  1. 6 asset_wizard.inc \asset_wizard_toolbar()
  2. 6 inc/asset_wizard.inc \asset_wizard_toolbar()
Same name and namespace in other branches
  1. 5 asset_wizard.inc \asset_wizard_toolbar()

Build a list of available asset_types that can be used.

2 calls to asset_wizard_toolbar()
theme_asset_wizard_form in ./asset_wizard.inc
Main theme function for asset_wizard_form.
theme_asset_wizard_form in inc/asset_wizard.themes.inc
Main theme function for asset_wizard_form.

File

inc/asset_wizard.inc, line 961

Code

function asset_wizard_toolbar($dir = '') {
  $qarray = $_GET;
  $qarray['dir'] = $dir;
  $buttons = array();

  // Create Choose button
  $choose = t('Choose');
  $html = theme('image', drupal_get_path('module', 'asset') . '/misc/icon.png', $choose, $choose, NULL, FALSE) . '<br/>' . $choose;
  $qstring = drupal_query_string_encode($qarray, array(
    'q',
    'aid',
    'op',
  ));
  $buttons[] = l($html, 'asset/wizard/' . arg(2), array(
    'query' => $qstring,
    'html' => true,
  ));

  // Create other buttons
  foreach (module_implements('asset_type') as $module) {
    $types = module_invoke($module, 'asset_type', 'info');
    foreach ($types as $delta => $type) {
      if (user_access('create ' . $delta . ' assets') || user_access('administer assets')) {
        if ($type['src']) {
          $html = theme('image', $type['src'], $type['value'], $type['value'], NULL, FALSE) . '<br/>' . $type['value'];
        }
        else {
          $html = $type['value'];
        }
        $qarray['op'] = $type['value'];
        $qstring = drupal_query_string_encode($qarray, array(
          'q',
          'aid',
        ));
        $buttons[] = l($html, 'asset/wizard/' . arg(2), array(
          'query' => $qstring,
          'html' => true,
        ));
      }
    }

    // add class to last button from each module
    $i = count($buttons) - 1;
    if (!is_array($buttons[$i])) {
      $buttons[$i] = array(
        'data' => $buttons[$i],
        'class' => 'last',
      );
    }
  }
  return theme('item_list', $buttons);
}