1 <?php
 2 
 3 /**
 4  * This class can be used to add settings to the system settings page.
 5  *
 6  * @author gharlan
 7  *
 8  * @package redaxo\core
 9  */
10 abstract class rex_system_setting
11 {
12     /**
13      * Settings array.
14      *
15      * @var self[]
16      */
17     private static $settings = [];
18 
19     /**
20      * Returns the setting key.
21      *
22      * @return string
23      */
24     abstract public function getKey();
25 
26     /**
27      * Returns the field.
28      *
29      * @return rex_form_element
30      */
31     abstract public function getField();
32 
33     /**
34      * Sets the new value.
35      *
36      * @param mixed $value
37      */
38     abstract public function setValue($value);
39 
40     /**
41      * Registers a setting object.
42      *
43      * @param self $setting Setting object
44      */
45     public static function register(self $setting)
46     {
47         self::$settings[] = $setting;
48     }
49 
50     /**
51      * Returns all registered setting objects.
52      *
53      * @return self[]
54      */
55     public static function getAll()
56     {
57         return self::$settings;
58     }
59 }
60