You are here

class SingleTextFieldTest in Extra Field 8

Same name and namespace in other branches
  1. 8.2 tests/extra_field_test/src/Plugin/ExtraField/Display/SingleTextFieldTest.php \Drupal\extra_field_test\Plugin\ExtraField\Display\SingleTextFieldTest

Extra field Display for a field with single item output.

Plugin annotation


@ExtraFieldDisplay(
  id = "single_text_test",
  label = @Translation("Extra field formatted as text field"),
  bundles = {
    "node.first_node_type",
  },
  visible = true
)

Hierarchy

Expanded class hierarchy of SingleTextFieldTest

File

tests/extra_field_test/src/Plugin/ExtraField/Display/SingleTextFieldTest.php, line 20

Namespace

Drupal\extra_field_test\Plugin\ExtraField\Display
View source
class SingleTextFieldTest extends ExtraFieldDisplayFormattedBase {

  /**
   * {@inheritdoc}
   */
  public function viewElements(ContentEntityInterface $entity) {
    $elements = [
      '#markup' => 'Output from SingleTextFieldTest',
    ];
    return $elements;
  }

  /**
   * {@inheritdoc}
   */
  public function getLabel() {
    return 'Single text';
  }

  /**
   * {@inheritdoc}
   */
  public function getLabelDisplay() {
    return 'inline';
  }

  /**
   * {@inheritdoc}
   */
  public function getFieldType() {
    return 'single_text';
  }

  /**
   * {@inheritdoc}
   */
  public function getFieldName() {
    return 'field_single_text';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
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
ExtraFieldDisplayFormattedBase::$isEmpty protected property Flag to indicate that the extra field has no content.
ExtraFieldDisplayFormattedBase::$langcode protected property The langcode of the field values.
ExtraFieldDisplayFormattedBase::$languageManager protected property The language manager.
ExtraFieldDisplayFormattedBase::getLangcode public function Gets the langcode of the field values. Overrides ExtraFieldDisplayFormattedInterface::getLangcode 1
ExtraFieldDisplayFormattedBase::isEmpty public function Check if the extra field has data. Overrides ExtraFieldDisplayFormattedInterface::isEmpty
ExtraFieldDisplayFormattedBase::isTranslatable public function The field is translatable. Overrides ExtraFieldDisplayFormattedInterface::isTranslatable 1
ExtraFieldDisplayFormattedBase::setLangcode public function
ExtraFieldDisplayFormattedBase::view public function Builds a renderable array for the field. Overrides ExtraFieldDisplayInterface::view
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
SingleTextFieldTest::getFieldName public function The machine name of the field. Overrides ExtraFieldDisplayFormattedBase::getFieldName
SingleTextFieldTest::getFieldType public function The type of field. Overrides ExtraFieldDisplayFormattedBase::getFieldType
SingleTextFieldTest::getLabel public function The label of the field. Overrides ExtraFieldDisplayFormattedBase::getLabel
SingleTextFieldTest::getLabelDisplay public function How to display the field label will be displayed. Overrides ExtraFieldDisplayFormattedBase::getLabelDisplay
SingleTextFieldTest::viewElements public function Returns the renderable array of the field item(s). Overrides ExtraFieldDisplayFormattedInterface::viewElements