Skip to content

Drupal\helper\Element\EntitySelect

Provides a element for a entity select menu.

Implements:

Drupal\Component\Plugin\DerivativeInspectionInterface, Drupal\Component\Plugin\PluginInspectionInterface, Drupal\Core\Render\Element\ElementInterface, Drupal\Core\Render\Element\RenderCallbackInterface, Drupal\Core\Render\Element\FormElementInterface

Extend:

Drupal\Core\Render\Element\Select

Methods

Name Description
setEntityOptions Set referenceable entities as options for an element.

Inherited methods

Name Description
__construct Constructs a \Drupal\Component\Plugin\PluginBase object.
__sleep {@inheritdoc}
__wakeup {@inheritdoc}
create Instantiates a new instance of the implementing class using autowiring.
createInstanceAutowired Instantiates a new instance of the implementing class using autowiring.
getBaseId {@inheritdoc}
getDerivativeId {@inheritdoc}
getInfo {@inheritdoc}
getPluginDefinition {@inheritdoc}
getPluginId {@inheritdoc}
isConfigurable Determines if the plugin is configurable.
messenger Gets the messenger.
preRenderAjaxForm Adds Ajax information about an element to communicate with JavaScript.
preRenderGroup Adds members of this group as actual elements for rendering.
preRenderSelect Prepares a select render element.
processAjaxForm Form element processing handler for the #ajax form property.
processAutocomplete Adds autocomplete functionality to elements.
processGroup Arranges elements into groups.
processPattern Render API callback: Handles the #pattern form element property.
processSelect Processes a select list form element.
setAttributes {@inheritdoc}
setMessenger Sets the messenger.
setStringTranslation Sets the string translation service to use.
validatePattern Render API callback: Handles the #pattern form element property.
valueCallback {@inheritdoc}

EntitySelect::setEntityOptions

Description

public static setEntityOptions (array $element, array $settings)

Set referenceable entities as options for an element.

Parameters

  • (array) $element :
    An element.
  • (array) $settings :
    An array of settings used to limit and randomize options.

Return Values

void

Throws Exceptions

\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException

Thrown when the current user doesn't have access to the specified entity.