You are here

interface BlockStyleInterface in Block Style Plugins 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/BlockStyleInterface.php \Drupal\block_style_plugins\Plugin\BlockStyleInterface

Defines an interface for Block style plugins.

Hierarchy

Expanded class hierarchy of BlockStyleInterface

All classes that implement BlockStyleInterface

File

src/Plugin/BlockStyleInterface.php, line 13

Namespace

Drupal\block_style_plugins\Plugin
View source
interface BlockStyleInterface extends PluginInspectionInterface, ConfigurableInterface, PluginFormInterface {

  /**
   * Returns the configuration form elements specific to a block configuration.
   *
   * This code will be run as part of a form alter so that the current blocks
   * configuration will be available to this method.
   *
   * @param array $form
   *   The form definition array for the block configuration form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   *
   * @return array
   *   The renderable form array representing the entire configuration form.
   */
  public function prepareForm(array $form, FormStateInterface $form_state);

  /**
   * Returns a customized form array with new form settings for styles.
   *
   * @param array $form
   *   The form definition array for the block configuration form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   *
   * @return array
   *   The renderable form array representing the entire configuration form.
   */
  public function formAlter(array $form, FormStateInterface $form_state);

  /**
   * Adds block style specific submission handling for the block form.
   *
   * @param array $form
   *   The form definition array for the full block configuration form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   */
  public function submitForm($form, FormStateInterface $form_state);

  /**
   * Builds and returns the renderable array for this block style plugin.
   *
   * @param array $variables
   *   List of all variables sent to the theme system.
   *
   * @return array
   *   A renderable array representing the content of the block.
   */
  public function build(array $variables);

  /**
   * Exclude styles from appearing on a block.
   *
   * Determine if configuration should be excluded from certain blocks when a
   * block plugin id or block content type is passed from a plugin.
   *
   * @return bool
   *   Return True if the current block should not get the styles.
   */
  public function exclude();

  /**
   * Only show styles on specific blocks.
   *
   * Determine if configuration should be only included on certain blocks when a
   * block plugin id or block content type is passed from a plugin.
   *
   * @return bool
   *   Return True if the current block should only get the styles.
   */
  public function includeOnly();

  /**
   * Add theme suggestions for the block.
   *
   * @param array $suggestions
   *   List of theme suggestions.
   * @param array $variables
   *   List of variables from a preprocess hook.
   *
   * @return array
   *   List of all theme suggestions.
   */
  public function themeSuggestion(array $suggestions, array $variables);

}

Members

Namesort descending Modifiers Type Description Overrides
BlockStyleInterface::build public function Builds and returns the renderable array for this block style plugin. 1
BlockStyleInterface::exclude public function Exclude styles from appearing on a block. 1
BlockStyleInterface::formAlter public function Returns a customized form array with new form settings for styles. 1
BlockStyleInterface::includeOnly public function Only show styles on specific blocks. 1
BlockStyleInterface::prepareForm public function Returns the configuration form elements specific to a block configuration. 1
BlockStyleInterface::submitForm public function Adds block style specific submission handling for the block form. 1
BlockStyleInterface::themeSuggestion public function Add theme suggestions for the block. 1
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 11
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 12
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 12
PluginFormInterface::buildConfigurationForm public function Form constructor. 36
PluginFormInterface::submitConfigurationForm public function Form submission handler. 32
PluginFormInterface::validateConfigurationForm public function Form validation handler. 18
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