EmptyFormattedFieldTest.php in Extra Field 8
File
tests/extra_field_test/src/Plugin/ExtraField/Display/EmptyFormattedFieldTest.php
View source
<?php
namespace Drupal\extra_field_test\Plugin\ExtraField\Display;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\extra_field\Plugin\ExtraFieldDisplayFormattedBase;
class EmptyFormattedFieldTest extends ExtraFieldDisplayFormattedBase {
public function getLabel() {
return 'Empty field';
}
public function getLabelDisplay() {
return 'inline';
}
public function viewElements(ContentEntityInterface $entity) {
$elements = [
'#cache' => [
'max-age' => 0,
],
];
$this->isEmpty = TRUE;
return $elements;
}
}