Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
PWK-241 expand category field with different options in CF search views
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnswaanen committed Jul 3, 2015
1 parent fce7929 commit 3cc3c58
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class views_handler_field_cdb_item_category extends views_handler_field {
function option_definition() {
$options = parent::option_definition();

$options['type'] = array('default' => 'eventtype');
$options['link'] = array('default' => FALSE);

return $options;
Expand All @@ -21,6 +22,24 @@ class views_handler_field_cdb_item_category extends views_handler_field {
*/
function options_form(&$form, &$form_state) {

$form['type'] = array(
'#type' => 'radios',
'#title' => t('Type'),
'#description' => t('What kind of categories do you want to show?'),
'#options' => array(
'theme' => t('Theme'),
'publicscope' => t('Public scope'),
'targetaudience' => t('Target audience'),
'eventtype' => t('Event type'),
'actortype' => t('Actor type'),
'educationfield' => t('Education field'),
'educationlevel' => t('Education Level'),
'facility' => t('Facility'),
'flandersregion' => t('Flanders region'),
),
'#default_value' => isset($this->options['format']) ? $this->options['format'] : 'image',
);

$form['link'] = array(
'#type' => 'checkbox',
'#title' => t('Link the category to the category result page'),
Expand All @@ -40,7 +59,7 @@ class views_handler_field_cdb_item_category extends views_handler_field {
return;
}

$categories = culturefeed_agenda_get_category_list_of_item('eventtype', $extended_entity->getEntity());
$categories = culturefeed_agenda_get_category_list_of_item($this->options['type'], $extended_entity->getEntity());

if (!$categories) {
return;
Expand Down

0 comments on commit 3cc3c58

Please sign in to comment.