/** * @param AssetBlock $assetBlock * * @return string */ public function renderBlock(AssetBlock $assetBlock) { $conditional = $assetBlock->getConditional(); $output = $this->renderCollection($assetBlock->getCollection()); if (!empty($conditional)) { $output = sprintf($this->templates['conditional'], $conditional, $output); } return $output . "\n"; }
/** * Renders an AssetBlock object * * @param AssetLib\AssetBlock $block * @param AssetRendererInterface $renderer * * @throws AssetRendererNotFoundException * @internal param null $name * @return string */ public function renderBlock(AssetBlock $block, AssetRendererInterface $renderer = null) { if (is_null($renderer)) { $renderer = $block->getRenderer(); } if (is_string($renderer)) { $renderer = $this->renderers[$renderer]; } if (!is_a($renderer, 'AssetLib\\AssetRenderer\\AssetRendererInterface')) { throw new AssetRendererNotFoundException(['renderer' => $block->getRenderer()]); } return $renderer->renderBlock($block); }
/** * @param AssetBlock $block * * @return bool */ protected function shouldIgnore(AssetBlock $block) { foreach ($block->getIgnoreTypes() as $ignoreType) { if ($this->request->is($ignoreType)) { return true; } } return false; }