Loading src/Element/ComponentElement.php +7 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ namespace Drupal\cl_components\Element; use Drupal\Component\Serialization\Json; use Drupal\Component\Utility\Xss; use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Render\BubbleableMetadata; Loading Loading @@ -111,9 +110,15 @@ class ComponentElement extends RenderElement { if (is_callable($context_alter_callback)) { $context = call_user_func($context_alter_callback, $context, $bubbleable_metadata); } try { $serialized_context = json_encode($context, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); } catch (\JsonException $e) { $serialized_context = ''; } $template .= empty($context) ? sprintf('{%% embed \'%s\' %%}', $embed_id) : sprintf('{%% embed \'%s\' with %s %%}', $embed_id, Json::encode($context)); : sprintf('{%% embed \'%s\' with %s %%}', $embed_id, $serialized_context); $template .= PHP_EOL; foreach ($twig_blocks as $block_name => $block_value) { $bl_val = is_callable($blocks_alter_callback) Loading Loading
src/Element/ComponentElement.php +7 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ namespace Drupal\cl_components\Element; use Drupal\Component\Serialization\Json; use Drupal\Component\Utility\Xss; use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Render\BubbleableMetadata; Loading Loading @@ -111,9 +110,15 @@ class ComponentElement extends RenderElement { if (is_callable($context_alter_callback)) { $context = call_user_func($context_alter_callback, $context, $bubbleable_metadata); } try { $serialized_context = json_encode($context, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); } catch (\JsonException $e) { $serialized_context = ''; } $template .= empty($context) ? sprintf('{%% embed \'%s\' %%}', $embed_id) : sprintf('{%% embed \'%s\' with %s %%}', $embed_id, Json::encode($context)); : sprintf('{%% embed \'%s\' with %s %%}', $embed_id, $serialized_context); $template .= PHP_EOL; foreach ($twig_blocks as $block_name => $block_value) { $bl_val = is_callable($blocks_alter_callback) Loading