Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Core\Display;
|
Chris@0
|
4
|
Chris@18
|
5 use Drupal\Component\Plugin\ConfigurableInterface;
|
Chris@0
|
6 use Drupal\Component\Plugin\ConfigurablePluginInterface;
|
Chris@18
|
7 use Drupal\Component\Plugin\DependentPluginInterface;
|
Chris@0
|
8 use Drupal\Component\Plugin\PluginInspectionInterface;
|
Chris@0
|
9 use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
|
Chris@0
|
10 use Drupal\Core\Plugin\PluginFormInterface;
|
Chris@0
|
11 use Drupal\Core\Session\AccountInterface;
|
Chris@0
|
12
|
Chris@0
|
13 /**
|
Chris@0
|
14 * Provides an interface for DisplayVariant plugins.
|
Chris@0
|
15 *
|
Chris@0
|
16 * @see \Drupal\Core\Display\Annotation\DisplayVariant
|
Chris@0
|
17 * @see \Drupal\Core\Display\VariantBase
|
Chris@0
|
18 * @see \Drupal\Core\Display\VariantManager
|
Chris@0
|
19 * @see plugin_api
|
Chris@0
|
20 */
|
Chris@18
|
21 interface VariantInterface extends PluginInspectionInterface, ConfigurableInterface, DependentPluginInterface, ConfigurablePluginInterface, PluginFormInterface, RefinableCacheableDependencyInterface {
|
Chris@0
|
22
|
Chris@0
|
23 /**
|
Chris@0
|
24 * Returns the user-facing display variant label.
|
Chris@0
|
25 *
|
Chris@0
|
26 * @return string
|
Chris@0
|
27 * The display variant label.
|
Chris@0
|
28 */
|
Chris@0
|
29 public function label();
|
Chris@0
|
30
|
Chris@0
|
31 /**
|
Chris@0
|
32 * Returns the admin-facing display variant label.
|
Chris@0
|
33 *
|
Chris@0
|
34 * This is for the type of display variant, not the configured variant itself.
|
Chris@0
|
35 *
|
Chris@0
|
36 * @return string
|
Chris@0
|
37 * The display variant administrative label.
|
Chris@0
|
38 */
|
Chris@0
|
39 public function adminLabel();
|
Chris@0
|
40
|
Chris@0
|
41 /**
|
Chris@0
|
42 * Returns the unique ID for the display variant.
|
Chris@0
|
43 *
|
Chris@0
|
44 * @return string
|
Chris@0
|
45 * The display variant ID.
|
Chris@0
|
46 */
|
Chris@0
|
47 public function id();
|
Chris@0
|
48
|
Chris@0
|
49 /**
|
Chris@0
|
50 * Returns the weight of the display variant.
|
Chris@0
|
51 *
|
Chris@0
|
52 * @return int
|
Chris@0
|
53 * The display variant weight.
|
Chris@0
|
54 */
|
Chris@0
|
55 public function getWeight();
|
Chris@0
|
56
|
Chris@0
|
57 /**
|
Chris@0
|
58 * Sets the weight of the display variant.
|
Chris@0
|
59 *
|
Chris@0
|
60 * @param int $weight
|
Chris@0
|
61 * The weight to set.
|
Chris@0
|
62 */
|
Chris@0
|
63 public function setWeight($weight);
|
Chris@0
|
64
|
Chris@0
|
65 /**
|
Chris@0
|
66 * Determines if this display variant is accessible.
|
Chris@0
|
67 *
|
Chris@0
|
68 * @param \Drupal\Core\Session\AccountInterface $account
|
Chris@0
|
69 * (optional) The user for which to check access, or NULL to check access
|
Chris@0
|
70 * for the current user. Defaults to NULL.
|
Chris@0
|
71 *
|
Chris@0
|
72 * @return bool
|
Chris@0
|
73 * TRUE if this display variant is accessible, FALSE otherwise.
|
Chris@0
|
74 */
|
Chris@0
|
75 public function access(AccountInterface $account = NULL);
|
Chris@0
|
76
|
Chris@0
|
77 /**
|
Chris@0
|
78 * Builds and returns the renderable array for the display variant.
|
Chris@0
|
79 *
|
Chris@0
|
80 * The variant can contain cacheability metadata for the configuration that
|
Chris@0
|
81 * was passed in setConfiguration(). In the build() method, this should be
|
Chris@0
|
82 * added to the render array that is returned.
|
Chris@0
|
83 *
|
Chris@0
|
84 * @return array
|
Chris@0
|
85 * A render array for the display variant.
|
Chris@0
|
86 */
|
Chris@0
|
87 public function build();
|
Chris@0
|
88
|
Chris@0
|
89 }
|