Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions gyro/core/model/base/dbfiltergroup.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class DBFilterGroup implements IDBQueryModifier {
protected $group_key = '';
protected $key_default_filter = '';
protected $key_current_filter = '';
protected $template_name = 'core::widgets/filter';
protected $template_meta_name = 'core::widgets/filter.meta';

/**
* Constructor
Expand Down Expand Up @@ -140,4 +142,32 @@ public function get_current_filter() {
public function apply($query) {
$query->apply_modifier($this->get_current_filter());
}

/**
* Change template name
*/
public function set_template_name($template_name) {
$this->template_name = $template_name;
}

/**
* Change meta template name
*/
public function set_meta_template_name($template_meta_name) {
$this->template_meta_name = $template_meta_name;
}

/**
* @return string : template name
*/
public function get_template_name() {
return $this->template_name;
}

/**
* @return string : meta template name
*/
public function get_meta_template_name() {
return $this->template_meta_name;
}
}
4 changes: 2 additions & 2 deletions gyro/core/view/widgets/filter.widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ public function render($policy = self::NONE) {
$groups = Arr::force(Arr::get_item($this->data, 'filter_groups', array()));
$ret = '';
foreach($groups as $group) {
$view = ViewFactory::create_view(IViewFactory::MESSAGE, 'core::widgets/filter.meta');
$view = ViewFactory::create_view(IViewFactory::MESSAGE, $group->get_meta_template_name());
$view->assign('filter_group', $group);
$view->assign('page_data', $page_data);
$view->assign('policy', $policy);
$view->render(); // No output!

$view = ViewFactory::create_view(IViewFactory::MESSAGE, 'core::widgets/filter');
$view = ViewFactory::create_view(IViewFactory::MESSAGE, $group->get_template_name());
$view->assign('filter_group', $group);
$view->assign('filter_url_builder', $builder);
$view->assign('page_data', $page_data);
Expand Down