Skip to content

Commit 4225bb1

Browse files
committed
Merge pull request drupal-media#9 from slashrsm/2318503
Define basic functions on interfaces
2 parents bd32d94 + 7e3c423 commit 4225bb1

File tree

10 files changed

+189
-1
lines changed

10 files changed

+189
-1
lines changed

src/Entity/EntityBrowser.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Drupal\Core\Config\Entity\ConfigEntityBase;
1111
use Drupal\Core\Entity\EntityWithPluginBagsInterface;
12+
use Drupal\Core\Form\FormStateInterface;
1213
use Drupal\Core\Plugin\DefaultPluginBag;
1314
use Drupal\Core\Plugin\DefaultSinglePluginBag;
1415
use Drupal\entity_browser\EntityBrowserInterface;
@@ -251,4 +252,61 @@ public function getWidgetSelector() {
251252
return $this->widgetSelectorPluginBag()->get($this->widget_selector);
252253
}
253254

255+
256+
/**
257+
* {@inheritdoc}
258+
*/
259+
public function getSelectedEntities() {
260+
// @TODO Implement it.
261+
}
262+
263+
/**
264+
* {@inheritdoc}
265+
*/
266+
public function setSelectedEntities(array $entities) {
267+
// @TODO Implement it.
268+
}
269+
270+
/**
271+
* {@inheritdoc}
272+
*/
273+
public function addSelectedEntities(array $entities) {
274+
// @TODO Implement it.
275+
}
276+
277+
/**
278+
* {@inheritdoc}
279+
*/
280+
public function selectionCompleted() {
281+
// @TODO Implement it.
282+
}
283+
284+
/**
285+
* {@inheritdoc}
286+
*/
287+
public function getFormId() {
288+
// @TODO Implement it.
289+
}
290+
291+
/**
292+
* {@inheritdoc}
293+
*/
294+
public function buildForm(array $form, FormStateInterface $form_state) {
295+
// @TODO Implement it.
296+
}
297+
298+
/**
299+
* {@inheritdoc}
300+
*/
301+
public function validateForm(array &$form, FormStateInterface $form_state) {
302+
// @TODO Implement it.
303+
}
304+
305+
/**
306+
* {@inheritdoc}
307+
*/
308+
public function submitForm(array &$form, FormStateInterface $form_state) {
309+
// @TODO Implement it.
310+
}
311+
254312
}

src/EntityBrowserDisplayInterface.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,25 @@ interface EntityBrowserDisplayInterface extends PluginInspectionInterface {
2222
*/
2323
public function label();
2424

25+
/**
26+
* Displays entity browser.
27+
*
28+
* This is the "entry point" for every non-entity browser code to interact
29+
* with it. It will take care about displaying entity browser in one way or
30+
* another.
31+
*
32+
* @return array
33+
* An array suitable for drupal_render().
34+
*/
35+
public function displayEntityBrowser();
36+
37+
/**
38+
* Indicates completed selection.
39+
*
40+
* Entity browser will call this function when selection is done. Display
41+
* plugin is responsible for fetching selected entities and sending them to
42+
* the initiating code.
43+
*/
44+
public function selectionCompleted();
45+
2546
}

src/EntityBrowserInterface.php

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
namespace Drupal\entity_browser;
99

1010
use Drupal\Core\Config\Entity\ConfigEntityInterface;
11+
use Drupal\Core\Form\FormInterface;
1112

1213
/**
1314
* Provides an interface defining an entity browser entity.
1415
*/
15-
interface EntityBrowserInterface extends ConfigEntityInterface {
16+
interface EntityBrowserInterface extends ConfigEntityInterface, FormInterface {
1617

1718
/**
1819
* Returns the entity browser name.
@@ -97,4 +98,36 @@ public function getSelectionDisplay();
9798
*/
9899
public function getWidgetSelector();
99100

101+
/**
102+
* Returns currently selected entities.
103+
*
104+
* @return array
105+
* Array of currently selected entities.
106+
*/
107+
public function getSelectedEntities();
108+
109+
/**
110+
* Sets currently selected entities.
111+
*
112+
* @param array $entities
113+
* Entities that are currently selected.
114+
*/
115+
public function setSelectedEntities(array $entities);
116+
117+
/**
118+
* Adds entities to currently selected entities.
119+
*
120+
* @param array $entities
121+
* Entities to be added to the list of currently selected entities.
122+
*/
123+
public function addSelectedEntities(array $entities);
124+
125+
/**
126+
* Indicates completed selection.
127+
*
128+
* Selection process is done and currently selected entities are sent to the
129+
* initiating code.
130+
*/
131+
public function selectionCompleted();
132+
100133
}

src/EntityBrowserSelectionDisplayInterface.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,12 @@ interface EntityBrowserSelectionDisplayInterface extends PluginInspectionInterfa
2222
*/
2323
public function label();
2424

25+
/**
26+
* Returns selection display form.
27+
*
28+
* @return array
29+
* Form structure.
30+
*/
31+
public function getForm();
32+
2533
}

src/EntityBrowserWidgetInterface.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,12 @@ public function label();
3030
*/
3131
public function getWeight();
3232

33+
/**
34+
* Returns widget form.
35+
*
36+
* @return array
37+
* Form structure.
38+
*/
39+
public function getForm();
40+
3341
}

src/EntityBrowserWidgetSelectorInterface.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,20 @@ interface EntityBrowserWidgetSelectorInterface extends PluginInspectionInterface
2222
*/
2323
public function label();
2424

25+
/**
26+
* Returns widget selector form.
27+
*
28+
* @return array
29+
* Form structure.
30+
*/
31+
public function getForm();
32+
33+
/**
34+
* Returns ID of the widget that is currently selected.
35+
*
36+
* @return string
37+
* ID of the currently selected widget.
38+
*/
39+
public function getCurrentWidget();
40+
2541
}

src/Plugin/EntityBrowser/Display/Standalone.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,19 @@ class Standalone extends PluginBase implements EntityBrowserDisplayInterface {
3333
public function label() {
3434
return $this->label;
3535
}
36+
37+
/**
38+
* {@inheritdoc}
39+
*/
40+
public function displayEntityBrowser() {
41+
// @TODO Implement it.
42+
}
43+
44+
/**
45+
* {@inheritdoc}
46+
*/
47+
public function selectionCompleted() {
48+
// @TODO Implement it.
49+
}
50+
3651
}

src/Plugin/EntityBrowser/SelectionDisplay/NoDisplay.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,11 @@ public function label() {
3434
$this->label;
3535
}
3636

37+
/**
38+
* {@inheritdoc}
39+
*/
40+
public function getForm() {
41+
// @TODO Implement it.
42+
}
43+
3744
}

src/Plugin/EntityBrowser/Widget/View.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,11 @@ public function getWeight() {
4848
return $this->weight;
4949
}
5050

51+
/**
52+
* {@inheritdoc}
53+
*/
54+
public function getForm() {
55+
// @TODO Implement it.
56+
}
57+
5158
}

src/Plugin/EntityBrowser/WidgetSelector/Tabs.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,19 @@ class Tabs extends PluginBase implements EntityBrowserWidgetSelectorInterface {
3333
public function label() {
3434
return $this->label;
3535
}
36+
37+
/**
38+
* {@inheritdoc}
39+
*/
40+
public function getForm() {
41+
// @TODO Implement it.
42+
}
43+
44+
/**
45+
* {@inheritdoc}
46+
*/
47+
public function getCurrentWidget() {
48+
// @TODO Implement it.
49+
}
50+
3651
}

0 commit comments

Comments
 (0)