You are here

class ExampleArticle in Extra Field 8

Same name and namespace in other branches
  1. 8.2 modules/extra_field_example/src/Plugin/ExtraField/Display/ExampleArticle.php \Drupal\extra_field_example\Plugin\ExtraField\Display\ExampleArticle

Example Extra field Display.

Plugin annotation


@ExtraFieldDisplay(
  id = "article_only",
  label = @Translation("Only for articles"),
  bundles = {
    "node.article",
  }
)

Hierarchy

Expanded class hierarchy of ExampleArticle

File

modules/extra_field_example/src/Plugin/ExtraField/Display/ExampleArticle.php, line 19

Namespace

Drupal\extra_field_example\Plugin\ExtraField\Display
View source
class ExampleArticle extends ExtraFieldDisplayBase {

  /**
   * {@inheritdoc}
   */
  public function view(ContentEntityInterface $entity) {
    $elements = [
      '#markup' => 'This is output from ExampleArticle',
    ];
    return $elements;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ExampleArticle::view public function Builds a renderable array for the field. Overrides ExtraFieldDisplayInterface::view
ExtraFieldDisplayBase::$entity protected property The field's parent entity.
ExtraFieldDisplayBase::$entityViewDisplay protected property The entity view display.
ExtraFieldDisplayBase::$viewMode protected property The view mode the entity is rendered in.
ExtraFieldDisplayBase::getEntity public function Returns the field's parent entity. Overrides ExtraFieldDisplayInterface::getEntity
ExtraFieldDisplayBase::getEntityViewDisplay public function Returns the entity view display object of the field's host entity. Overrides ExtraFieldDisplayInterface::getEntityViewDisplay
ExtraFieldDisplayBase::getViewMode public function Returns the entity view mode object of the field's host entity. Overrides ExtraFieldDisplayInterface::getViewMode
ExtraFieldDisplayBase::setEntity public function Stores the field's parent entity. Overrides ExtraFieldDisplayInterface::setEntity
ExtraFieldDisplayBase::setEntityViewDisplay public function Stores the entity view display. Overrides ExtraFieldDisplayInterface::setEntityViewDisplay
ExtraFieldDisplayBase::setViewMode public function Stores the entity view mode. Overrides ExtraFieldDisplayInterface::setViewMode
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. 92