You are here

function eck_get_property_types in Entity Construction Kit (ECK) 7.3

Get property types.

5 calls to eck_get_property_types()
eck_flush_caches in ./eck.module
Implements hook_flush_caches().
eck_get_property_type in ./eck.property_type.inc
Get property type.
eck_get_property_type_class in ./eck.property_type.inc
Get the class for a specific property type.
eck_property_widget_type_options in ./eck.module
Returns an array of widget type options for an ECK property type.
eck__property_add__form in ./eck.properties.inc
Add property form.

File

./eck.property_type.inc, line 10
Property types.

Code

function eck_get_property_types($property_type = '', $reset = FALSE) {
  global $language;
  static $property_types;

  // The _info() hooks invoked below include translated strings, so each
  // language is cached separately.
  $langcode = $language->language;
  if ($reset) {
    $property_types = NULL;

    // Clear all languages.
    cache_clear_all('property_types:', 'cache_eck', TRUE);
  }
  if (!$property_types) {
    if ($cached = cache_get("property_types:{$langcode}", 'cache_eck')) {
      $property_types = $cached->data;
    }
    else {
      $property_types = array();

      // Populate property widget types.
      foreach (module_implements('eck_property_types') as $module) {
        $module_property_types = (array) module_invoke($module, 'eck_property_types');
        foreach ($module_property_types as $name => $property_type_info) {

          // Provide defaults.
          $property_type_info += array(
            'type' => $name,
            'label' => t("@name", array(
              "@name" => $name,
            )),
            'settings' => array(),
            'class' => FALSE,
            'file' => FALSE,
            'file type' => 'inc',
            'description' => '',
          );
          $property_types[$name] = $property_type_info;
          $property_types[$name]['module'] = $module;
        }
      }
      drupal_alter('eck_property_types', $property_types);
      cache_set("property_types:{$langcode}", $property_types, 'cache_eck');
    }
  }
  if (!$property_type) {
    return $property_types;
  }
  if (isset($property_types[$property_type])) {
    return $property_types[$property_type];
  }
}