Loading src/Twig/TwigComponentLoader.php +6 −20 Original line number Diff line number Diff line Loading @@ -117,18 +117,13 @@ class TwigComponentLoader implements LoaderInterface { } $plugin_id = $component->getPluginId(); $code = file_get_contents($path); $lib_build = ['#attached' => ['library' => [$component->getLibraryName()]]]; try { // This is the main reason for the loader (other than finding the Twig // template). This will eventually add the auto-generated library into the // page. $this->renderer->render($lib_build); } catch (\Exception $e) { // Off-band library render failed. } $code = "{{ cl_components_additional_context('" . addcslashes($component->getId(), "'") . "', '" . addcslashes($variant ?: '', "'") . "', " . (int) ($this->twigDebug && $component->isDebugMode()) . ") }}" $library_name = $component->getLibraryName(); $code = "{{ attach_library('$library_name') }}" . PHP_EOL . "{{ cl_components_additional_context('" . addcslashes($component->getId(), "'") . "', '" . addcslashes($variant ?: '', "'") . "', " . (int) ($this->twigDebug && $component->isDebugMode()) . ") }}" . PHP_EOL . $code; if ($component->isDebugMode()) { $code = "{{ attach_library('cl_components/cl_debug') }}" . PHP_EOL . $code; } if ($this->twigDebug) { $code = "{# start cl_component $plugin_id #}" . PHP_EOL . "<!-- start cl_component $plugin_id -->" . PHP_EOL Loading @@ -136,15 +131,6 @@ class TwigComponentLoader implements LoaderInterface { . "<!-- end cl_component $plugin_id -->" . PHP_EOL . "{# end cl_component $plugin_id #}" . PHP_EOL; } if ($component->isDebugMode()) { $debug_lib_build = ['#attached' => ['library' => ['cl_components/cl_debug']]]; try { $this->renderer->render($debug_lib_build); } catch (\Exception $e) { // Off-band library render failed. } } return new Source($code, $name, $path); } Loading Loading
src/Twig/TwigComponentLoader.php +6 −20 Original line number Diff line number Diff line Loading @@ -117,18 +117,13 @@ class TwigComponentLoader implements LoaderInterface { } $plugin_id = $component->getPluginId(); $code = file_get_contents($path); $lib_build = ['#attached' => ['library' => [$component->getLibraryName()]]]; try { // This is the main reason for the loader (other than finding the Twig // template). This will eventually add the auto-generated library into the // page. $this->renderer->render($lib_build); } catch (\Exception $e) { // Off-band library render failed. } $code = "{{ cl_components_additional_context('" . addcslashes($component->getId(), "'") . "', '" . addcslashes($variant ?: '', "'") . "', " . (int) ($this->twigDebug && $component->isDebugMode()) . ") }}" $library_name = $component->getLibraryName(); $code = "{{ attach_library('$library_name') }}" . PHP_EOL . "{{ cl_components_additional_context('" . addcslashes($component->getId(), "'") . "', '" . addcslashes($variant ?: '', "'") . "', " . (int) ($this->twigDebug && $component->isDebugMode()) . ") }}" . PHP_EOL . $code; if ($component->isDebugMode()) { $code = "{{ attach_library('cl_components/cl_debug') }}" . PHP_EOL . $code; } if ($this->twigDebug) { $code = "{# start cl_component $plugin_id #}" . PHP_EOL . "<!-- start cl_component $plugin_id -->" . PHP_EOL Loading @@ -136,15 +131,6 @@ class TwigComponentLoader implements LoaderInterface { . "<!-- end cl_component $plugin_id -->" . PHP_EOL . "{# end cl_component $plugin_id #}" . PHP_EOL; } if ($component->isDebugMode()) { $debug_lib_build = ['#attached' => ['library' => ['cl_components/cl_debug']]]; try { $this->renderer->render($debug_lib_build); } catch (\Exception $e) { // Off-band library render failed. } } return new Source($code, $name, $path); } Loading