You are here

interface BusinessRulesItemPluginInterface in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Plugin/BusinessRulesItemPluginInterface.php \Drupal\business_rules\Plugin\BusinessRulesItemPluginInterface

Interface BusinessRulesItemInterface.

@package Drupal\business_rules\Plugin

Hierarchy

Expanded class hierarchy of BusinessRulesItemPluginInterface

All classes that implement BusinessRulesItemPluginInterface

1 file declares its use of BusinessRulesItemPluginInterface
CustomValueVariable.php in src/Plugin/BusinessRulesVariable/CustomValueVariable.php

File

src/Plugin/BusinessRulesItemPluginInterface.php, line 16

Namespace

Drupal\business_rules\Plugin
View source
interface BusinessRulesItemPluginInterface extends PluginInspectionInterface {
  const VARIABLE_REGEX = '{{((\\w+|\\w+\\[\\d+\\]|\\w+\\[\\d+\\]\\-\\>+\\w+)|(\\w+\\-\\>+\\w+|\\w\\[\\d+\\]|\\w\\[\\d+\\]\\-\\>+\\w+)+?)}}';

  /**
   * Form constructor.
   *
   * Give a chance to plugin to change the buildForm method.
   *
   * @param array $form
   *   The form array.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The form state object.
   */
  public function buildForm(array &$form, FormStateInterface $form_state);

  /**
   * Provide a description of the item.
   *
   * @return string
   *   A string description of the item.
   */
  public function getDescription();

  /**
   * Get the redirect url for the item edit-form route.
   *
   * @param \Drupal\business_rules\ItemInterface $item
   *   The business rule item.
   *
   * @return \Drupal\Core\Url
   *   The Url.
   */
  public function getEditUrl(ItemInterface $item);

  /**
   * Provide the group of the item.
   *
   * @return string
   *   The item group name
   */
  public function getGroup();

  /**
   * Get the redirect url for the item collection route.
   *
   * @param \Drupal\business_rules\ItemInterface $item
   *   The item go get the Url.
   *
   * @return \Drupal\Core\Url
   *   The Url.
   */
  public function getRedirectUrl(ItemInterface $item);

  /**
   * Return the form array.
   *
   * @param array $form
   *   The form array.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The form state object.
   * @param \Drupal\business_rules\ItemInterface $item
   *   The configured item.
   *
   * @return array
   *   The render array for the settings form.
   *
   * @internal param array $form
   */
  public function getSettingsForm(array &$form, FormStateInterface $form_state, ItemInterface $item);

  /**
   * Return a variable set with all used variables on the item.
   *
   * If you are using variables in a textfield, you can use the regex as the
   * following:
   *
   *  preg_match_all(BusinessRulesItemPluginInterface::VARIABLE_REGEX, $text,
   * $variables);
   *
   * The $variables array will be filled with all used variables at index [1]
   *
   * @param \Drupal\business_rules\ItemInterface $item
   *   The business rule item.
   *
   * @return \Drupal\business_rules\VariablesSet
   *   The variableSet with all variables used on the Item.
   */
  public function getVariables(ItemInterface $item);

  /**
   * Extract the variables from the plugin settings.
   *
   * @param string $string
   *   The string that can have the variable token: {{variable_id}}.
   *
   * @return array
   *   Array with the variables names.
   *
   * @throws \Exception
   */
  public function pregMatch($string);

  /**
   * Process the item settings before it's saved.
   *
   * @param array $settings
   *   The settings to be processed before save the Business Rule Item.
   * @param \Drupal\business_rules\ItemInterface $item
   *   The item being processed.
   *
   * @return array
   *   The processed settings.
   */
  public function processSettings(array $settings, ItemInterface $item);

  /**
   * Process the tokens on the settings property for the item.
   *
   * @param \Drupal\business_rules\ItemInterface $item
   *   The Business Rules item.
   * @param \Drupal\business_rules\Events\BusinessRulesEvent $event
   *   The BusinessRulesEvent that triggered the processor.
   */
  public function processTokens(ItemInterface &$item, BusinessRulesEvent $event);

  /**
   * Process the item replacing the variables by it's values.
   *
   * @param mixed $content
   *   The item to be replaced by the variable value.
   * @param \Drupal\business_rules\VariablesSet $event_variables
   *   Array of Variables provided by the event.
   *
   * @return mixed
   *   The processed content, replacing the variables tokens for it's values.
   */
  public function processVariables($content, VariablesSet $event_variables);

  /**
   * Plugin form validator.
   *
   * If the plugin needs to perform a form validation, override this function.
   *
   * @param array $form
   *   The form array.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The form state object.
   */
  public function validateForm(array &$form, FormStateInterface $form_state);

}

Members

Namesort descending Modifiers Type Description Overrides
BusinessRulesItemPluginInterface::buildForm public function Form constructor. 1
BusinessRulesItemPluginInterface::getDescription public function Provide a description of the item. 1
BusinessRulesItemPluginInterface::getEditUrl public function Get the redirect url for the item edit-form route. 1
BusinessRulesItemPluginInterface::getGroup public function Provide the group of the item. 1
BusinessRulesItemPluginInterface::getRedirectUrl public function Get the redirect url for the item collection route. 1
BusinessRulesItemPluginInterface::getSettingsForm public function Return the form array. 1
BusinessRulesItemPluginInterface::getVariables public function Return a variable set with all used variables on the item. 1
BusinessRulesItemPluginInterface::pregMatch public function Extract the variables from the plugin settings. 1
BusinessRulesItemPluginInterface::processSettings public function Process the item settings before it's saved. 1
BusinessRulesItemPluginInterface::processTokens public function Process the tokens on the settings property for the item. 1
BusinessRulesItemPluginInterface::processVariables public function Process the item replacing the variables by it's values. 2
BusinessRulesItemPluginInterface::validateForm public function Plugin form validator. 1
BusinessRulesItemPluginInterface::VARIABLE_REGEX constant
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2