Commit bc21a51e authored by Janez Urevc's avatar Janez Urevc
Browse files

Issue #2291239 by slashrsm: Basic implementation of widget plugin.

parent 54b176aa
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -22,14 +22,6 @@ interface EntityBrowserWidgetInterface extends PluginInspectionInterface {
   */
  public function label();

  /**
   * Returns the unique ID representing the widget.
   *
   * @return string
   *   The widget ID.
   */
  public function getUuid();

  /**
   * Returns the widget's weight.
   *
+51 −0
Original line number Diff line number Diff line
<?php

/**
 * Contains \Drupal\entity_browser\Plugin\EntityBrowser\Widget\View.
 */

namespace Drupal\entity_browser\Plugin\EntityBrowser\Widget;

use Drupal\Component\Plugin\PluginBase;
use Drupal\entity_browser\EntityBrowserWidgetInterface;

/**
 * Uses a view to provide entity listing in a browser's widget.
 *
 * @EntityBrowserWidget(
 *   id = "view",
 *   label = @Translation("View"),
 *   description = @Translation("Uses a view to provide entity listing in a browser's widget.")
 * )
 */
class View extends PluginBase implements EntityBrowserWidgetInterface {

  /**
   * Plugin label.
   *
   * @var string
   */
  protected $label;

  /**
   * Plugin weight.
   *
   * @var int
   */
  protected $weight;

  /**
   * {@inheritdoc}
   */
  public function label() {
    return $this->label;
  }

  /**
   * {@inheritdoc}
   */
  public function getWeight() {
    return $this->weight;
  }

}