You are here

function asset_asset_type in Asset 5.2

Same name and namespace in other branches
  1. 5 asset.module \asset_asset_type()
  2. 6 inc/asset.api.inc \asset_asset_type()

Implementation of hook_asset_type().

Related topics

File

./asset.module, line 913
Main module.

Code

function asset_asset_type($op = 'info', &$asset = NULL) {
  static $loaded = FALSE;
  if (!$loaded) {
    include_once drupal_get_path('module', 'asset') . '/asset.types.inc';
    $loaded = TRUE;
  }
  switch ($op) {
    case 'info':
      return array(
        'directory' => array(
          'name' => t('Directory'),
          'module' => 'asset',
          'description' => t('Create a new directory to hold assets.'),
          'icon' => drupal_get_path('module', 'asset') . '/icons/folder.add.png',
        ),
        'file' => array(
          'name' => t('File'),
          'module' => 'asset',
          'description' => t('Upload a file to the server.'),
          'icon' => drupal_get_path('module', 'asset') . '/icons/file.add.png',
        ),
      );
      break;
    default:
      $function = 'asset_' . $asset->type . '_' . $op;
      if (function_exists($function)) {
        return $function($asset);
      }
      break;
  }
}