protected function beforeRender() { $this->template->addFilter('time', function ($seconds) { return Base::getSecondsToString($seconds); }); $this->template->addFilter('bool2string', function ($bool) { return Base::getBooleanToString($bool); }); $this->template->addFilter('respondentWebsitePeriod', function ($period) { return Respondent::getRespondentWebsitePeriodLabel($period); }); $this->template->addFilter('respondentAgeLabel', function ($age) { return Respondent::getAgeLabel($age); }); $this->template->addFilter('respondentGenderLabel', function ($gender) { return Respondent::getGenderLabel($gender); }); $this->template->addFilter('respondentCategoryPeriodLabel', function ($period) { return Respondent::getRespondentCategoryPeriodLabel($period); }); }
protected function createTemplate($class = NULL) { $template = parent::createTemplate($class); $template->addFilter('time', function ($seconds) { return Base::getSecondsToString($seconds); }); $template->addFilter('bool2string', function ($bool) { return Base::getBooleanToString($bool); }); $template->addFilter('respondentWebsitePeriod', function ($period) { return Respondent::getRespondentWebsitePeriodLabel($period); }); $template->addFilter('respondentAgeLabel', function ($age) { return Respondent::getAgeLabel($age); }); $template->addFilter('respondentGenderLabel', function ($gender) { return Respondent::getGenderLabel($gender); }); $template->addFilter('respondentCategoryPeriodLabel', function ($period) { return Respondent::getRespondentCategoryPeriodLabel($period); }); return $template; }