ConditionInterface
interface ConditionInterface implements ExecutableInterface, PluginFormInterface, ConfigurableInterface, DependentPluginInterface, PluginInspectionInterface, CacheableDependencyInterface (View source)
An interface for condition plugins.
Condition plugins are context-aware and configurable. They support the following keys in their plugin definitions:
- context: An array of context definitions, keyed by context name. Each context definition is a typed data definition describing the context. Check the typed data definition docs for details.
- configuration: An array of configuration option definitions, keyed by option name. Each option definition is a typed data definition describing the configuration option. Check the typed data definition docs for details.
Methods
Sets the configuration for this plugin instance.
Calculates dependencies for the configured plugin.
Gets the definition of the plugin implementation.
The cache contexts associated with this object.
The cache tags associated with this object.
The maximum age for which this object may be cached.
Determines whether condition result will be negated.
Evaluates the condition and returns TRUE or FALSE accordingly.
Provides a human readable summary of the condition's configuration.
Sets the executable manager class.
Details
execute()
Executes the plugin.
array
buildConfigurationForm(array $form, FormStateInterface $form_state)
Form constructor.
Plugin forms are embedded in other forms. In order to know where the plugin form is located in the parent form, #parents and #array_parents must be known, but these are not available during the initial build phase. In order to have these properties available when building the plugin form's elements, let this method return a form element that has a #process callback and build the rest of the form in the callback. By the time the callback is executed, the element's #parents and #array_parents properties will have been set by the form API. For more documentation on #parents and
array_parents, see \Drupal\Core\Render\Element\FormElement.
validateConfigurationForm(array $form, FormStateInterface $form_state)
Form validation handler.
submitConfigurationForm(array $form, FormStateInterface $form_state)
Form submission handler.
array
getConfiguration()
Gets this plugin's configuration.
setConfiguration(array $configuration)
Sets the configuration for this plugin instance.
array
defaultConfiguration()
Gets default configuration for this plugin.
array
calculateDependencies()
Calculates dependencies for the configured plugin.
Dependencies are saved in the plugin's configuration entity and are used to determine configuration synchronization order. For example, if the plugin integrates with specific user roles, this method should return an array of dependencies listing the specified roles.
string
getPluginId()
Gets the plugin_id of the plugin instance.
array
getPluginDefinition()
Gets the definition of the plugin implementation.
string[]
getCacheContexts()
The cache contexts associated with this object.
These identify a specific variation/representation of the object.
Cache contexts are tokens: placeholders that are converted to cache keys by the @cache_contexts_manager service. The replacement value depends on the request context (the current URL, language, and so on). They're converted before storing an object in cache.
string[]
getCacheTags()
The cache tags associated with this object.
When this object is modified, these cache tags will be invalidated.
int
getCacheMaxAge()
The maximum age for which this object may be cached.
bool
isNegated()
Determines whether condition result will be negated.
bool
evaluate()
Evaluates the condition and returns TRUE or FALSE accordingly.
summary()
Provides a human readable summary of the condition's configuration.
setExecutableManager(ExecutableManagerInterface $executableManager)
Sets the executable manager class.