3 namespace Drupal\Driver\Cores;
5 use Drupal\Component\Utility\Random;
8 * Drupal core interface.
10 interface CoreInterface {
13 * Instantiate the core interface.
15 * @param string $drupal_root
16 * The path to the Drupal root folder.
18 * URI that is accessing Drupal. Defaults to 'default'.
19 * @param \Drupal\Component\Utility\Random $random
20 * Random string generator.
22 public function __construct($drupal_root, $uri = 'default', Random $random = NULL);
25 * Return random generator.
27 public function getRandom();
32 public function bootstrap();
37 public function getModuleList();
40 * Returns a list of all extension absolute paths.
43 * An array of absolute paths to enabled extensions.
45 public function getExtensionPathList();
50 public function clearCache();
56 * True if cron runs, otherwise false.
58 public function runCron();
63 public function nodeCreate($node);
68 public function nodeDelete($node);
73 public function userCreate(\stdClass $user);
78 public function userDelete(\stdClass $user);
81 * Add a role to a user.
83 * @param \stdClass $user
84 * The Drupal user object.
85 * @param string $role_name
88 public function userAddRole(\stdClass $user, $role_name);
91 * Validate, and prepare environment for Drupal bootstrap.
93 * @throws \Drupal\Driver\Exception\BootstrapException
94 * Thrown when the Drupal site cannot be bootstrapped.
96 * @see _drush_bootstrap_drupal_site_validate()
98 public function validateDrupalSite();
101 * Processes a batch of actions.
103 public function processBatch();
106 * Create a taxonomy term.
108 public function termCreate(\stdClass $term);
111 * Deletes a taxonomy term.
113 public function termDelete(\stdClass $term);
118 * @param array $permissions
119 * An array of permissions to create the role with.
122 * The created role name.
124 public function roleCreate(array $permissions);
129 * @param string $role_name
130 * A role name to delete.
132 public function roleDelete($role_name);
135 * Get FieldHandler class.
137 * @param string $entity_type
138 * Entity type machine name.
139 * @param string $field_name
140 * Field machine name.
142 * @return \Drupal\Driver\Fields\FieldHandlerInterface
145 public function getFieldHandler($entity, $entity_type, $field_name);
148 * Check if the specified field is an actual Drupal field.
150 * @param string $entity_type
151 * The entity type to check.
152 * @param string $field_name
153 * The field name to check.
156 * TRUE if the given field is a Drupal field, FALSE otherwise.
158 public function isField($entity_type, $field_name);
161 * Returns array of field types for the specified entity.
163 * @param string $entity_type
164 * The entity type for which to return the field types.
167 * An associative array of field types, keyed by field name.
169 public function getEntityFieldTypes($entity_type);
172 * Creates a language.
174 * @param \stdClass $language
175 * An object with the following properties:
176 * - langcode: the langcode of the language to create.
178 public function languageCreate(\stdClass $language);
181 * Deletes a language.
183 * @param \stdClass $language
184 * An object with the following properties:
185 * - langcode: the langcode of the language to delete.
187 public function languageDelete(\stdClass $language);
190 * Clears the static caches.
192 public function clearStaticCaches();
195 * Returns a configuration item.
197 * @param string $name
198 * The name of the configuration object to retrieve.
200 * A string that maps to a key within the configuration data.
203 * The data that was requested.
205 public function configGet($name, $key = '');
208 * Sets a value in a configuration object.
210 * @param string $name
211 * The name of the configuration object.
213 * Identifier to store value in configuration.
214 * @param mixed $value
215 * Value to associate with identifier.
217 public function configSet($name, $key, $value);