You are here

class party_handler_filter_party_attached_entity_bundle in Party 8.2

Same name and namespace in other branches
  1. 7 includes/views/party_handler_filter_party_attached_entity_bundle.inc \party_handler_filter_party_attached_entity_bundle

@filer Filter by attached entity bundle.

Hierarchy

Expanded class hierarchy of party_handler_filter_party_attached_entity_bundle

1 string reference to 'party_handler_filter_party_attached_entity_bundle'
party_views_data in includes/views/party.views.inc
Implements hook_views_data().

File

includes/views/party_handler_filter_party_attached_entity_bundle.inc, line 6
r Filter by attached entity bundle.

View source
class party_handler_filter_party_attached_entity_bundle extends views_handler_filter_in_operator {
  function get_value_options() {
    if (!isset($this->value_options)) {
      $this->value_title = t('Attached entity bundles');
      $data_sets = party_get_data_set_info();
      $entity_info = entity_get_info();

      // Get the data types from the entity type filter that should also be
      // on this display if it's been set up to make sense.
      // @todo: probably add validation, including checking the table of the filter.
      $entity_types = $this->view->display_handler->handlers['filter']['entity_type']->options['value'];

      //dsm($this->view);

      //dsm($this->view->display_handler->options['filters']);
      $options = array();
      $options = array();
      foreach ($data_sets as $data_set => $info) {
        if (in_array($info['entity type'], $entity_types)) {
          $this_entity_info = $entity_info[$info['entity type']];
          $bundle_label = $this_entity_info['bundles'][$info['entity bundle']]['label'];
          $label = t('@bundle (type @type)', array(
            '@bundle' => $bundle_label,
            '@type' => $this_entity_info['label'],
          ));
          $options[$info['entity bundle']] = $label;
        }
      }
      asort($options);
      $this->value_options = $options;
    }
  }

}

Members