Skip to content
Snippets Groups Projects

fixed

1 file
+ 11
8
Compare changes
  • Side-by-side
  • Inline
@@ -37,17 +37,20 @@ class PHP extends FormatterTypeBase {
*/
public function viewElements(FieldItemListInterface $items, $langcode) {
ob_start();
$output = eval($this->entity->get('data'));
$data = $this->entity->get('data');
if (is_array($data) && isset($data[0])) {
$output = eval($data[0]);
} else {
$output = eval($data);
}
$output = !empty($output) ? $output : ob_get_contents();
ob_end_clean();
// Preview debugging; Show the available variables data.
// @todo Re-add when preview functionality re-added.
//if (\Drupal::moduleHandler()->moduleExists('devel') && isset($formatter->preview) && $formatter->preview['options']['dpm']['vars']) {
// dpm($variables);
//}
return empty($output) ? FALSE : $output;
}
}
}
Loading