You are here

abstract class EmptyFieldHandler in Empty fields 7.2

Abstract base class defining a field_empty_handler.

Defines a way to easily create empty field reaction plugins.

Hierarchy

Expanded class hierarchy of EmptyFieldHandler

See also

field_empty_handler_text().

File

plugins/empty_fields_handler.inc, line 14
Contains the base class for empty field handler classes.

View source
abstract class EmptyFieldHandler {
  public $options;

  /**
   * Create a new EmptyFieldHandler.
   */
  public function __construct() {
    $this->options = $this
      ->defaults();
  }

  /**
   * Default options that map to FAPI elements in EmptyFieldHandler::form().
   */
  public function defaults() {
    return array();
  }

  /**
   * Provide FAPI elements to configure the empty field rendering.
   */
  public function form($context) {
    return array();
  }

  /**
   * Provide the summary text to display on the field display settings page.
   */
  public abstract function summaryText();

  /**
   * Provide a reaction. Set the content of the field.
   */
  public abstract function react($context);

  /**
   * Provide a method to alter the output of the plugin.
   */
  public function alterOutput(&$output, $context) {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EmptyFieldHandler::$options public property
EmptyFieldHandler::alterOutput public function Provide a method to alter the output of the plugin.
EmptyFieldHandler::defaults public function Default options that map to FAPI elements in EmptyFieldHandler::form(). 2
EmptyFieldHandler::form public function Provide FAPI elements to configure the empty field rendering. 2
EmptyFieldHandler::react abstract public function Provide a reaction. Set the content of the field. 2
EmptyFieldHandler::summaryText abstract public function Provide the summary text to display on the field display settings page. 2
EmptyFieldHandler::__construct public function Create a new EmptyFieldHandler.