You are here

function eck_language_property_views_data_alter in Entity Construction Kit (ECK) 7.3

Same name and namespace in other branches
  1. 7.2 plugins/property_behavior/language.inc \eck_language_property_views_data_alter()

Informing views that this property contains language information.

1 string reference to 'eck_language_property_views_data_alter'
language.inc in plugins/property_behavior/language.inc

File

plugins/property_behavior/language.inc, line 99

Code

function eck_language_property_views_data_alter($property, $vars) {
  $entity_type = $vars['entity_type'];
  if (module_exists('locale')) {
    $property_info = $entity_type->properties[$property];
    $vars['data']["eck_{$entity_type->name}"][$property] = array(
      'title' => $property_info['label'],
      'help' => t('Entity language'),
      'field' => array(
        'handler' => 'views_handler_field_locale_language',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_locale_language',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_locale_language',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
    );
  }
  else {
    unset($vars['data']["eck_{$entity_type->name}"][$property]);
  }
  return $vars;
}