Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5namespace Drupal\display_builder\Controller;
6
7use Drupal\display_builder\InstanceInterface;
8use Symfony\Component\HttpFoundation\Request;
9
10/**
11 * HTTP controller for contextual menu actions (paste, delete, save preset).
12 */
13interface ApiContextualMenuControllerInterface {
14
15  /**
16   * Paste a source.
17   *
18   * Reads 'node_id' (source to copy), 'parent_id' ('__root__' or a node ID),
19   * 'slot_id', and 'slot_position' from the request body - the contextual
20   * menu only knows these at click time, so they can't be route parameters.
21   *
22   * @param \Symfony\Component\HttpFoundation\Request $request
23   *   HTTP Request.
24   * @param \Drupal\display_builder\InstanceInterface $display_builder_instance
25   *   Display builder instance.
26   *
27   * @return array
28   *   A renderable array
29   *
30   * @see components/contextual_menu/contextual_menu.js
31   */
32  public function paste(Request $request, InstanceInterface $display_builder_instance): array;
33
34  /**
35   * Delete a source.
36   *
37   * Reads 'node_id' from the request body - the contextual menu only knows
38   * it at click time, so it can't be a route parameter.
39   *
40   * @param \Symfony\Component\HttpFoundation\Request $request
41   *   HTTP Request.
42   * @param \Drupal\display_builder\InstanceInterface $display_builder_instance
43   *   Display builder instance.
44   *
45   * @return array
46   *   A renderable array
47   *
48   * @see components/contextual_menu/contextual_menu.js
49   */
50  public function delete(Request $request, InstanceInterface $display_builder_instance): array;
51
52  /**
53   * Save a source as preset.
54   *
55   * Reads 'node_id' from the request body - the contextual menu only knows
56   * it at click time, so it can't be a route parameter.
57   *
58   * @param \Symfony\Component\HttpFoundation\Request $request
59   *   HTTP Request.
60   * @param \Drupal\display_builder\InstanceInterface $display_builder_instance
61   *   Display builder instance.
62   *
63   * @return array
64   *   A renderable array
65   *
66   * @see components/contextual_menu/contextual_menu.js
67   */
68  public function saveAsPreset(Request $request, InstanceInterface $display_builder_instance): array;
69
70  /**
71   * Paste or merge a source's ui_styles third-party-setting onto another.
72   *
73   * Reads 'node_id' (paste target), 'source_node_id' (styles to copy from),
74   * and 'mode' ('replace', the default, or 'merge') from the request body -
75   * the contextual menu only knows these at click time, so they can't be
76   * route parameters.
77   *
78   * @param \Symfony\Component\HttpFoundation\Request $request
79   *   HTTP Request.
80   * @param \Drupal\display_builder\InstanceInterface $display_builder_instance
81   *   Display builder instance.
82   *
83   * @return array
84   *   A renderable array
85   *
86   * @see components/contextual_menu/contextual_menu.js
87   */
88  public function pasteStyles(Request $request, InstanceInterface $display_builder_instance): array;
89
90  /**
91   * Clear a source's ui_styles third-party-setting.
92   *
93   * Reads 'node_id' from the request body - the contextual menu only knows
94   * it at click time, so it can't be a route parameter.
95   *
96   * @param \Symfony\Component\HttpFoundation\Request $request
97   *   HTTP Request.
98   * @param \Drupal\display_builder\InstanceInterface $display_builder_instance
99   *   Display builder instance.
100   *
101   * @return array
102   *   A renderable array
103   *
104   * @see components/contextual_menu/contextual_menu.js
105   */
106  public function deleteStyles(Request $request, InstanceInterface $display_builder_instance): array;
107
108}