Loading src/Plugin/entity_embed/EntityEmbedDisplay/Easychart.php +7 −6 Changes for src/Plugin/entity_embed/EntityEmbedDisplay/Easychart.php: 7 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\easychart\Plugin\entity_embed\EntityEmbedDisplay; use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Form\FormStateInterface; use Drupal\easychart\EasychartHelper; use Drupal\entity_embed\EntityEmbedDisplay\EntityEmbedDisplayBase; Loading Loading @@ -41,14 +42,18 @@ class Easychart extends EntityEmbedDisplayBase { $route_match = \Drupal::routeMatch(); $entity = $this->getEntityFromContext(); $values = $entity->get('easychart')->getValue(); if ($entity instanceof ContentEntityBase) { $translation = $entity->getTranslation($this->getLangcode()); $values = $translation->get('easychart')->getValue(); } // We are in preview. if ($route_match->getRouteName() == 'embed.preview') { $show_placeholder = TRUE; // Try to render preview in the editor. if (!is_null($entity)) { $values = $entity->get('easychart')->getValue(); if (!empty($values[0]['config'])) { $http_client = \Drupal::httpClient(); $options = []; Loading @@ -67,7 +72,6 @@ class Easychart extends EntityEmbedDisplayBase { } } } } // Show placeholder. if ($show_placeholder) { Loading @@ -78,10 +82,8 @@ class Easychart extends EntityEmbedDisplayBase { } // Otherwise, render the chart. else { if (!is_null($entity)) { $delta = 0; $entity_id = $entity->id(); $values = $entity->get('easychart')->getValue(); $output = EasychartHelper::easychartPrintChart($values[0], $entity_id, $delta); if (!empty($output)) { $element[$delta] = ['#markup' => $output['markup']]; Loading @@ -90,7 +92,6 @@ class Easychart extends EntityEmbedDisplayBase { 'csv' => $output['csv'], ]; } } if (!empty($element)) { EasychartHelper::addRenderLibraries($element); Loading Loading
src/Plugin/entity_embed/EntityEmbedDisplay/Easychart.php +7 −6 Changes for src/Plugin/entity_embed/EntityEmbedDisplay/Easychart.php: 7 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\easychart\Plugin\entity_embed\EntityEmbedDisplay; use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Form\FormStateInterface; use Drupal\easychart\EasychartHelper; use Drupal\entity_embed\EntityEmbedDisplay\EntityEmbedDisplayBase; Loading Loading @@ -41,14 +42,18 @@ class Easychart extends EntityEmbedDisplayBase { $route_match = \Drupal::routeMatch(); $entity = $this->getEntityFromContext(); $values = $entity->get('easychart')->getValue(); if ($entity instanceof ContentEntityBase) { $translation = $entity->getTranslation($this->getLangcode()); $values = $translation->get('easychart')->getValue(); } // We are in preview. if ($route_match->getRouteName() == 'embed.preview') { $show_placeholder = TRUE; // Try to render preview in the editor. if (!is_null($entity)) { $values = $entity->get('easychart')->getValue(); if (!empty($values[0]['config'])) { $http_client = \Drupal::httpClient(); $options = []; Loading @@ -67,7 +72,6 @@ class Easychart extends EntityEmbedDisplayBase { } } } } // Show placeholder. if ($show_placeholder) { Loading @@ -78,10 +82,8 @@ class Easychart extends EntityEmbedDisplayBase { } // Otherwise, render the chart. else { if (!is_null($entity)) { $delta = 0; $entity_id = $entity->id(); $values = $entity->get('easychart')->getValue(); $output = EasychartHelper::easychartPrintChart($values[0], $entity_id, $delta); if (!empty($output)) { $element[$delta] = ['#markup' => $output['markup']]; Loading @@ -90,7 +92,6 @@ class Easychart extends EntityEmbedDisplayBase { 'csv' => $output['csv'], ]; } } if (!empty($element)) { EasychartHelper::addRenderLibraries($element); Loading