Created
July 17, 2012 16:43
-
-
Save damiankloip/3130514 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class views_handler_filter_entity_type extends views_handler_filter_in_operator { | |
function get_value_options() { | |
if (!isset($this->value_options)) { | |
$table_data = views_fetch_data($this->view->base_table); | |
$this->entity_type = $table_data['table']['entity type']; | |
$info = entity_get_info($this->entity_type); | |
$types = $info['bundles']; | |
$this->value_title = t('@entity types', array('@entity' => $info['label'])); | |
$options = array(); | |
foreach ($types as $type => $info) { | |
$options[$type] = t($info['label']); | |
} | |
asort($options); | |
$this->value_options = $options; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment