You are here

function ad_get_types in Advertisement 7

Same name and namespace in other branches
  1. 6.3 ad.module \ad_get_types()
  2. 6 ad.module \ad_get_types()
  3. 6.2 ad.module \ad_get_types()

Returns ad types data.

Parameters

$op: If set to 'name', will only return array of type names ($type => $name). If set to 'data', will return all of the type's data

$type: If not specified, will return array of all available types, else will return specific type's name or data.

4 calls to ad_get_types()
ad_filters in ./ad.admin.inc
List ad administration filters that can be applied.
ad_form in ./ad.module
Implementation of hook_form().
ad_menu_add_global_settings in ./ad.module
Load settings for all ad modules. Those modules, who don't have their settings form, will get a standard one.
ad_owners_form_alter in owners/ad_owners.module
Implementation of hook_form_alter().

File

./ad.module, line 1502

Code

function ad_get_types($op = 'name', $type = NULL) {
  $adtypes = module_invoke_all('adapi', 'type', array());
  switch ($op) {
    case 'name':
      if (isset($type)) {
        return $adtypes[$type]['name'];
      }
      else {
        foreach ($adtypes as $type => $data) {
          $adtypes[$type] = $data['name'];
        }
        return $adtypes;
      }
    case 'data':
      if (isset($type)) {
        return $adtypes[$type];
      }
      else {
        return $adtypes;
      }
  }
}