annotate core/lib/Drupal/Core/Display/VariantInterface.php @ 13:5fb285c0d0e3

Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've been lucky to get away with this so far, as we don't support self-registration which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5 was vulnerable to.
author Chris Cannam
date Mon, 23 Apr 2018 09:33:26 +0100
parents 4c8ae668cc8c
children af1871eacc83
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\Display;
Chris@0 4
Chris@0 5 use Drupal\Component\Plugin\ConfigurablePluginInterface;
Chris@0 6 use Drupal\Component\Plugin\PluginInspectionInterface;
Chris@0 7 use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
Chris@0 8 use Drupal\Core\Plugin\PluginFormInterface;
Chris@0 9 use Drupal\Core\Session\AccountInterface;
Chris@0 10
Chris@0 11 /**
Chris@0 12 * Provides an interface for DisplayVariant plugins.
Chris@0 13 *
Chris@0 14 * @see \Drupal\Core\Display\Annotation\DisplayVariant
Chris@0 15 * @see \Drupal\Core\Display\VariantBase
Chris@0 16 * @see \Drupal\Core\Display\VariantManager
Chris@0 17 * @see plugin_api
Chris@0 18 */
Chris@0 19 interface VariantInterface extends PluginInspectionInterface, ConfigurablePluginInterface, PluginFormInterface, RefinableCacheableDependencyInterface {
Chris@0 20
Chris@0 21 /**
Chris@0 22 * Returns the user-facing display variant label.
Chris@0 23 *
Chris@0 24 * @return string
Chris@0 25 * The display variant label.
Chris@0 26 */
Chris@0 27 public function label();
Chris@0 28
Chris@0 29 /**
Chris@0 30 * Returns the admin-facing display variant label.
Chris@0 31 *
Chris@0 32 * This is for the type of display variant, not the configured variant itself.
Chris@0 33 *
Chris@0 34 * @return string
Chris@0 35 * The display variant administrative label.
Chris@0 36 */
Chris@0 37 public function adminLabel();
Chris@0 38
Chris@0 39 /**
Chris@0 40 * Returns the unique ID for the display variant.
Chris@0 41 *
Chris@0 42 * @return string
Chris@0 43 * The display variant ID.
Chris@0 44 */
Chris@0 45 public function id();
Chris@0 46
Chris@0 47 /**
Chris@0 48 * Returns the weight of the display variant.
Chris@0 49 *
Chris@0 50 * @return int
Chris@0 51 * The display variant weight.
Chris@0 52 */
Chris@0 53 public function getWeight();
Chris@0 54
Chris@0 55 /**
Chris@0 56 * Sets the weight of the display variant.
Chris@0 57 *
Chris@0 58 * @param int $weight
Chris@0 59 * The weight to set.
Chris@0 60 */
Chris@0 61 public function setWeight($weight);
Chris@0 62
Chris@0 63 /**
Chris@0 64 * Determines if this display variant is accessible.
Chris@0 65 *
Chris@0 66 * @param \Drupal\Core\Session\AccountInterface $account
Chris@0 67 * (optional) The user for which to check access, or NULL to check access
Chris@0 68 * for the current user. Defaults to NULL.
Chris@0 69 *
Chris@0 70 * @return bool
Chris@0 71 * TRUE if this display variant is accessible, FALSE otherwise.
Chris@0 72 */
Chris@0 73 public function access(AccountInterface $account = NULL);
Chris@0 74
Chris@0 75 /**
Chris@0 76 * Builds and returns the renderable array for the display variant.
Chris@0 77 *
Chris@0 78 * The variant can contain cacheability metadata for the configuration that
Chris@0 79 * was passed in setConfiguration(). In the build() method, this should be
Chris@0 80 * added to the render array that is returned.
Chris@0 81 *
Chris@0 82 * @return array
Chris@0 83 * A render array for the display variant.
Chris@0 84 */
Chris@0 85 public function build();
Chris@0 86
Chris@0 87 }