Skip to content

Commit

Permalink
Merge pull request drupal-media#9 from slashrsm/2318503
Browse files Browse the repository at this point in the history
Define basic functions on interfaces
  • Loading branch information
slashrsm committed Aug 18, 2014
2 parents bd32d94 + 7e3c423 commit 4225bb1
Show file tree
Hide file tree
Showing 10 changed files with 189 additions and 1 deletion.
58 changes: 58 additions & 0 deletions src/Entity/EntityBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Entity\EntityWithPluginBagsInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\DefaultPluginBag;
use Drupal\Core\Plugin\DefaultSinglePluginBag;
use Drupal\entity_browser\EntityBrowserInterface;
Expand Down Expand Up @@ -251,4 +252,61 @@ public function getWidgetSelector() {
return $this->widgetSelectorPluginBag()->get($this->widget_selector);
}


/**
* {@inheritdoc}
*/
public function getSelectedEntities() {
// @TODO Implement it.
}

/**
* {@inheritdoc}
*/
public function setSelectedEntities(array $entities) {
// @TODO Implement it.
}

/**
* {@inheritdoc}
*/
public function addSelectedEntities(array $entities) {
// @TODO Implement it.
}

/**
* {@inheritdoc}
*/
public function selectionCompleted() {
// @TODO Implement it.
}

/**
* {@inheritdoc}
*/
public function getFormId() {
// @TODO Implement it.
}

/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
// @TODO Implement it.
}

/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
// @TODO Implement it.
}

/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// @TODO Implement it.
}

}
21 changes: 21 additions & 0 deletions src/EntityBrowserDisplayInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,25 @@ interface EntityBrowserDisplayInterface extends PluginInspectionInterface {
*/
public function label();

/**
* Displays entity browser.
*
* This is the "entry point" for every non-entity browser code to interact
* with it. It will take care about displaying entity browser in one way or
* another.
*
* @return array
* An array suitable for drupal_render().
*/
public function displayEntityBrowser();

/**
* Indicates completed selection.
*
* Entity browser will call this function when selection is done. Display
* plugin is responsible for fetching selected entities and sending them to
* the initiating code.
*/
public function selectionCompleted();

}
35 changes: 34 additions & 1 deletion src/EntityBrowserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
namespace Drupal\entity_browser;

use Drupal\Core\Config\Entity\ConfigEntityInterface;
use Drupal\Core\Form\FormInterface;

/**
* Provides an interface defining an entity browser entity.
*/
interface EntityBrowserInterface extends ConfigEntityInterface {
interface EntityBrowserInterface extends ConfigEntityInterface, FormInterface {

/**
* Returns the entity browser name.
Expand Down Expand Up @@ -97,4 +98,36 @@ public function getSelectionDisplay();
*/
public function getWidgetSelector();

/**
* Returns currently selected entities.
*
* @return array
* Array of currently selected entities.
*/
public function getSelectedEntities();

/**
* Sets currently selected entities.
*
* @param array $entities
* Entities that are currently selected.
*/
public function setSelectedEntities(array $entities);

/**
* Adds entities to currently selected entities.
*
* @param array $entities
* Entities to be added to the list of currently selected entities.
*/
public function addSelectedEntities(array $entities);

/**
* Indicates completed selection.
*
* Selection process is done and currently selected entities are sent to the
* initiating code.
*/
public function selectionCompleted();

}
8 changes: 8 additions & 0 deletions src/EntityBrowserSelectionDisplayInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ interface EntityBrowserSelectionDisplayInterface extends PluginInspectionInterfa
*/
public function label();

/**
* Returns selection display form.
*
* @return array
* Form structure.
*/
public function getForm();

}
8 changes: 8 additions & 0 deletions src/EntityBrowserWidgetInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,12 @@ public function label();
*/
public function getWeight();

/**
* Returns widget form.
*
* @return array
* Form structure.
*/
public function getForm();

}
16 changes: 16 additions & 0 deletions src/EntityBrowserWidgetSelectorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,20 @@ interface EntityBrowserWidgetSelectorInterface extends PluginInspectionInterface
*/
public function label();

/**
* Returns widget selector form.
*
* @return array
* Form structure.
*/
public function getForm();

/**
* Returns ID of the widget that is currently selected.
*
* @return string
* ID of the currently selected widget.
*/
public function getCurrentWidget();

}
15 changes: 15 additions & 0 deletions src/Plugin/EntityBrowser/Display/Standalone.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,19 @@ class Standalone extends PluginBase implements EntityBrowserDisplayInterface {
public function label() {
return $this->label;
}

/**
* {@inheritdoc}
*/
public function displayEntityBrowser() {
// @TODO Implement it.
}

/**
* {@inheritdoc}
*/
public function selectionCompleted() {
// @TODO Implement it.
}

}
7 changes: 7 additions & 0 deletions src/Plugin/EntityBrowser/SelectionDisplay/NoDisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,11 @@ public function label() {
$this->label;
}

/**
* {@inheritdoc}
*/
public function getForm() {
// @TODO Implement it.
}

}
7 changes: 7 additions & 0 deletions src/Plugin/EntityBrowser/Widget/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,11 @@ public function getWeight() {
return $this->weight;
}

/**
* {@inheritdoc}
*/
public function getForm() {
// @TODO Implement it.
}

}
15 changes: 15 additions & 0 deletions src/Plugin/EntityBrowser/WidgetSelector/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,19 @@ class Tabs extends PluginBase implements EntityBrowserWidgetSelectorInterface {
public function label() {
return $this->label;
}

/**
* {@inheritdoc}
*/
public function getForm() {
// @TODO Implement it.
}

/**
* {@inheritdoc}
*/
public function getCurrentWidget() {
// @TODO Implement it.
}

}

0 comments on commit 4225bb1

Please sign in to comment.