TypedConfigManagerInterface.php 2.29 KB
Newer Older
1 2 3 4 5 6 7 8 9
<?php

/**
 * @file
 * Contains \Drupal\Core\Config\TypedConfigManagerInterface.
 */

namespace Drupal\Core\Config;

10
use Drupal\Core\TypedData\TypedDataManagerInterface;
11

12
/**
13
 * Defines an interface for managing config schema type plugins.
14
 *
15 16 17 18
 * @see \Drupal\Core\Config\TypedConfigManager
 * @see \Drupal\Core\Config\Schema\ConfigSchemaDiscovery
 * @see hook_config_schema_info_alter()
 * @see https://www.drupal.org/node/1905070
19
 */
20
interface TypedConfigManagerInterface extends TypedDataManagerInterface {
21

22 23 24 25 26 27
  /**
   * Gets typed configuration data.
   *
   * @param string $name
   *   Configuration object name.
   *
28
   * @return \Drupal\Core\TypedData\TraversableTypedDataInterface
29 30 31 32
   *   Typed configuration element.
   */
  public function get($name);

33 34 35 36 37 38 39 40 41
  /**
   * Creates a new data definition object from a type definition array and
   * actual configuration data. Since type definitions may contain variables
   * to be replaced, we need the configuration value to create it.
   *
   * @param array $definition
   *   The base type definition array, for which a data definition should be
   *   created.
   * @param $value
42
   *   Optional value of the configuration element.
43 44 45 46 47 48 49 50 51
   * @param string $name
   *   Optional name of the configuration element.
   * @param object $parent
   *   Optional parent element.
   *
   * @return \Drupal\Core\TypedData\DataDefinitionInterface
   *   A data definition for the given data type.
   */
  public function buildDataDefinition(array $definition, $value, $name = NULL, $parent = NULL);
52

53 54 55 56 57 58 59 60 61 62
  /**
   * Checks if the configuration schema with the given config name exists.
   *
   * @param string $name
   *   Configuration name.
   *
   * @return bool
   *   TRUE if configuration schema exists, FALSE otherwise.
   */
  public function hasConfigSchema($name);
63

64 65 66 67 68 69 70 71 72 73 74 75
  /**
   * Gets a specific plugin definition.
   *
   * @param string $plugin_id
   *   A plugin id.
   * @param bool $exception_on_invalid
   *   Ignored with TypedConfigManagerInterface. Kept for compatibility with
   *   DiscoveryInterface.
   *
   * @return array
   *   A plugin definition array. If the given plugin id does not have typed
   *   configuration definition assigned, the definition of an undefined
76
   *   element type is returned.
77
   */
78
  public function getDefinition($plugin_id, $exception_on_invalid = TRUE);
79

80
}