function eck_property_info_widget_types in Entity Construction Kit (ECK) 7.3
Returns information of property widgets from hook_eck_property_widget_info.
Parameters
string $widget_type: (optional) A widget type name. If omitted, all widget types will be returned.
bool $reset: Forces rebuild of the property widget cache.
Return value
array Either a single widget type description, as provided by hook_eck_property_widget_info(), or an array of all existing widget types, keyed by widget type name.
8 calls to eck_property_info_widget_types()
- eck_flush_caches in ./
eck.module - Implements hook_flush_caches().
- eck_form_field_ui_field_overview_form_alter in ./
eck.module - Adds a manage properties section.
- eck_form_field_ui_field_overview_form_submit in ./
eck.module - Form submission handler for ECK's additions to field_ui_field_overview_form.
- eck_property_widget_type_options in ./
eck.module - Returns an array of widget type options for an ECK property type.
- eck__entity__form in ./
eck.entity.inc - Sets up an entities form.
File
- ./
eck.module, line 655
Code
function eck_property_info_widget_types($widget_type = NULL, $reset = FALSE) {
global $language;
static $widget_types;
// The _info() hooks invoked below include translated strings, so each
// language is cached separately.
$langcode = $language->language;
if ($reset) {
$widget_types = NULL;
// Clear all languages.
cache_clear_all('property_widget_types:', 'cache_eck', TRUE);
}
if (!isset($widget_types)) {
if ($cached = cache_get("property_widget_types:{$langcode}", 'cache_eck')) {
$widget_types = $cached->data;
}
else {
$widget_types = array();
// Populate property widget types.
foreach (module_implements('eck_property_widget_info') as $module) {
$module_widget_types = (array) module_invoke($module, 'eck_property_widget_info');
foreach ($module_widget_types as $name => $widget_info) {
// Provide defaults.
$widget_info += array(
'type' => $name,
'label' => t("@name", array(
'@name' => $name,
)),
'settings' => array(),
'property types' => array(),
'file' => FALSE,
'file type' => 'inc',
'description' => '',
'value callback' => '',
);
$widget_types[$name] = $widget_info;
$widget_types[$name]['module'] = $module;
}
}
drupal_alter('eck_property_widget_info', $widget_types);
uasort($widget_types, 'drupal_sort_weight');
cache_set("property_widget_types:{$langcode}", $widget_types, 'cache_eck');
}
}
if (isset($widget_type) && isset($widget_types[$widget_type])) {
return $widget_types[$widget_type];
}
return $widget_types;
}