public function getImportFilterJsOptions($dc) { $options = array(); $filterChain = FilterChainModel::findBy('type', 'js', array('order' => 'type')); while ($filterChain->next()) { $label = '['; $label .= $GLOBALS['TL_LANG']['tl_assetic_filter_chain']['types'][$filterChain->type] ?: $filterChain->type; $label .= '] '; $label .= $filterChain->name; $GLOBALS['TL_LANG']['assetic']['chain:' . $filterChain->id] = $label; $options['chain'][] = 'chain:' . $filterChain->id; } $filter = \Database::getInstance()->prepare('SELECT * FROM tl_assetic_filter WHERE id!=? ORDER BY type')->execute($dc->id); while ($filter->next()) { if (!in_array($filter->type, $GLOBALS['ASSETIC']['css'])) { continue; } $label = $GLOBALS['TL_LANG']['assetic'][$filter->type] ?: $filter->type; if ($filter->note) { $label .= ' [' . $filter->note . ']'; } $GLOBALS['TL_LANG']['assetic']['filter:' . $filter->id] = $label; $options['filter'][] = 'filter:' . $filter->id; } return $options; }
/** * @param int $id * * @return \Assetic\Filter\FilterCollection|null */ public function createFilterChainById($id, $debug = null) { $chain = FilterChainModel::findActiveByPk($id); if ($chain) { return static::createFilterChain($chain->row(), $debug); } return null; }
protected function buildAsseticFilterOptions($type) { $this->loadLanguageFile('assetic'); $options = []; $filterChain = FilterChainModel::findBy('type', $type, ['order' => 'type']); if ($filterChain) { while ($filterChain->next()) { $label = '['; $label .= $GLOBALS['TL_LANG']['tl_assetic_filter_chain']['types'][$filterChain->type] ?: $filterChain->type; $label .= '] '; $label .= $filterChain->name; $GLOBALS['TL_LANG']['assetic']['chain:' . $filterChain->id] = $label; $options['chain'][] = 'chain:' . $filterChain->id; } } $filter = FilterModel::findAll(['order' => 'type']); if ($filter) { while ($filter->next()) { if (!in_array($filter->type, $GLOBALS['ASSETIC'][$type])) { continue; } $label = $GLOBALS['TL_LANG']['assetic'][$filter->type] ?: $filter->type; if ($filter->note) { $label .= ' [' . $filter->note . ']'; } $GLOBALS['TL_LANG']['assetic']['filter:' . $filter->id] = $label; $options['filter'][] = 'filter:' . $filter->id; } } return $options; }