comparison core/lib/Drupal/Core/Display/VariantInterface.php @ 0:4c8ae668cc8c

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