/** * render asset group * @param array $assets * @return string */ public function renderGroup($assets) { $out = array(); foreach ($assets as $asset_type => $collection) { if ($this->f3->exists('ASSETS.filter.' . $asset_type, $filters)) { if (is_string($filters)) { $filters = $this->f3->split($filters); } $filters = array_values(array_intersect_key($this->filter, array_flip($filters))); $collection = $this->f3->relay($filters, array($collection)); } foreach ($collection as $asset) { $out[] = $this->f3->call($this->formatter[$asset_type], array($asset)); } } return "\n\t" . implode("\n\t", $out) . "\n"; }
/** * render asset group * @param array $assets * @return string */ public function renderGroup($assets) { $out = array(); foreach ($assets as $asset_type => $collection) { if ($this->f3->exists('ASSETS.filter.' . $asset_type, $filters)) { if (is_string($filters)) { $filters = $this->f3->split($filters); } $flist = array_flip($filters); $filters = array_values(array_intersect_key(array_replace($flist, $this->filter), $flist)); $collection = $this->f3->relay($filters, array($collection)); } foreach ($collection as $asset) { if (isset($asset['path'])) { $path = $asset['path']; $mtime = $this->f3->get('ASSETS.timestamps') && $asset['origin'] != 'external' && is_file($path) ? '?' . filemtime($path) : ''; $base = $this->f3->get('ASSETS.prepend_base') && $asset['origin'] != 'external' && is_file($path) ? $this->f3->get('BASE') . '/' : ''; $asset['path'] = $base . $path . $mtime; } $out[] = $this->f3->call($this->formatter[$asset_type], array($asset)); } } return "\n\t" . implode("\n\t", $out) . "\n"; }