You are here

class Standalone in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/EntityBrowser/Display/Standalone.php \Drupal\entity_browser\Plugin\EntityBrowser\Display\Standalone

Presents entity browser as a standalone form.

Plugin annotation


@EntityBrowserDisplay(
  id = "standalone",
  label = @Translation("Standalone form"),
  description = @Translation("Displays the entity browser as a standalone form. Only intended for testing or very specific use cases."),
  uses_route = TRUE
)

Hierarchy

Expanded class hierarchy of Standalone

File

src/Plugin/EntityBrowser/Display/Standalone.php, line 19

Namespace

Drupal\entity_browser\Plugin\EntityBrowser\Display
View source
class Standalone extends DisplayBase implements DisplayRouterInterface {

  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form['path'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Path'),
      '#required' => TRUE,
      '#description' => $this
        ->t('The path at which the browser will be accessible. Must begin with a forward slash.'),
      '#default_value' => $this->configuration['path'],
    ];
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    return [
      'path' => '',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function displayEntityBrowser(array $element, FormStateInterface $form_state, array &$complete_form, array $persistent_data = []) {
    parent::displayEntityBrowser($element, $form_state, $complete_form, $persistent_data);

    // @TODO Implement it.
  }

  /**
   * {@inheritdoc}
   */
  public function selectionCompleted(array $entities) {

    // @TODO Implement it.
  }

  /**
   * {@inheritdoc}
   */
  public function path() {
    return $this->configuration['path'];
  }

  /**
   * {@inheritdoc}
   */
  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
    $path = $form_state
      ->getValue('path');
    if ($path[0] != '/') {
      $form_state
        ->setError($form['path'], $this
        ->t('The Path field must begin with a forward slash.'));
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
DisplayBase::$entities protected property Selected entities.
DisplayBase::$eventDispatcher protected property Event dispatcher service.
DisplayBase::$label protected property Plugin label.
DisplayBase::$selectionStorage protected property The selection storage.
DisplayBase::$uuid protected property Instance UUID string.
DisplayBase::$uuidGenerator protected property UUID generator interface.
DisplayBase::calculateDependencies public function Calculates dependencies for the configured plugin. Overrides DependentPluginInterface::calculateDependencies
DisplayBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create 1
DisplayBase::getConfiguration public function Gets this plugin's configuration. Overrides ConfigurableInterface::getConfiguration
DisplayBase::getUuid public function Gets the uuid for this display. Overrides DisplayInterface::getUuid
DisplayBase::label public function Returns the display label. Overrides DisplayInterface::label
DisplayBase::setConfiguration public function Sets the configuration for this plugin instance. Overrides ConfigurableInterface::setConfiguration
DisplayBase::setUuid public function Sets the uuid for this display. Overrides DisplayInterface::setUuid
DisplayBase::__construct public function Constructs display plugin. Overrides PluginBase::__construct 1
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
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.
PluginConfigurationFormTrait::submitConfigurationForm public function Implements PluginFormInterface::submitConfigurationForm(). 3
Standalone::buildConfigurationForm public function Implements PluginFormInterface::buildConfigurationForm(). Overrides PluginConfigurationFormTrait::buildConfigurationForm
Standalone::defaultConfiguration public function Gets default configuration for this plugin. Overrides DisplayBase::defaultConfiguration
Standalone::displayEntityBrowser public function Displays entity browser. Overrides DisplayBase::displayEntityBrowser
Standalone::path public function Gets page path. Overrides DisplayRouterInterface::path
Standalone::selectionCompleted public function Indicates completed selection. Overrides DisplayBase::selectionCompleted
Standalone::validateConfigurationForm public function Implements PluginFormInterface::validateConfigurationForm(). Overrides PluginConfigurationFormTrait::validateConfigurationForm
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.