Version 1
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Update / UpdateInterface.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\bootstrap\Plugin\Update\UpdateInterface.
5  */
6
7 namespace Drupal\bootstrap\Plugin\Update;
8
9 use Drupal\bootstrap\Theme;
10
11 /**
12  * Defines the interface for an object oriented preprocess plugin.
13  *
14  * @ingroup plugins_update
15  */
16 interface UpdateInterface {
17
18   /**
19    * Retrieves the update description, if any.
20    *
21    * @return string
22    *   The update description.
23    */
24   public function getDescription();
25
26   /**
27    * Retrieves the human-readable label for the update.
28    *
29    * @return string
30    *   The update label.
31    */
32   public function getLabel();
33
34   /**
35    * Retrieves the update schema.
36    *
37    * @return int
38    */
39   public function getProvider();
40
41   /**
42    * Retrieves the update schema.
43    *
44    * @return int
45    */
46   public function getSchema();
47
48   /**
49    * Retrieves the update severity level.
50    *
51    * @return string
52    *   The update severity level.
53    */
54   public function getSeverity();
55
56   /**
57    * Retrieves the theme that provided the update.
58    *
59    * Used to determine whether or not the update should apply only to itself
60    * (the theme that implemented the plugin) and none of its sub-themes.
61    *
62    * @return \Drupal\bootstrap\Theme
63    */
64   public function getTheme();
65
66   /**
67    * Indicates whether or not the update is private.
68    *
69    * @return bool
70    */
71   public function isPrivate();
72
73   /**
74    * The batch process callback for the update.
75    *
76    * This is the bulk of the update plugin. Be careful to no fill it will a
77    * lot of heavily intensive processing. If you need to do a lot of things,
78    * split it up into multiple updates so the Batch API can handle it.
79    *
80    * You can throw an exception from this method in case your processing fails.
81    * Its message will be conveyed to the user to indicate what went wrong. If
82    * the update has failed, but do not wish to throw an exception, simply
83    * return FALSE and a generic "Update failed" message will appear.
84    *
85    * @param \Drupal\bootstrap\Theme $theme
86    *   The theme that the update is being applied to.
87    * @param array $context
88    *   The Batch API context array, passed by reference. Note: be very careful
89    *   to not store any instances created from a theme. The Batch API stores
90    *   this in the DB between each "request" and it may not be able to fully
91    *   reconstitute the object upon un-serialization. If you need to pass a
92    *   theme object between instances, you should instead use an identifier
93    *   (string) that can be used to reconstitute the object when needed.
94    *
95    * @return bool
96    *   FALSE if the update failed, otherwise any other return will be
97    *   interpreted as TRUE.
98    */
99   public function process(Theme $theme, array &$context);
100
101 }