abstract class FacetapiEmptyBehavior in Facet API 6.3
Same name and namespace in other branches
- 7.2 plugins/facetapi/empty_behavior.inc \FacetapiEmptyBehavior
- 7 plugins/facetapi/empty_behavior.inc \FacetapiEmptyBehavior
Abstract class implemented by all empty behavior plugins.
Hierarchy
- class \FacetapiEmptyBehavior
Expanded class hierarchy of FacetapiEmptyBehavior
1 string reference to 'FacetapiEmptyBehavior'
- facetapi_facetapi_empty_behaviors in ./
facetapi.facetapi.inc - Implements hook_facetapi_empty_behaviors().
File
- plugins/
facetapi/ empty_behavior.inc, line 11 - Base class for empty behaviors.
View source
abstract class FacetapiEmptyBehavior {
/**
* The machine readable name of facet configuration.
*
* @var string
*/
protected $configName;
/**
* An array of facet settings.
*
* @var array
*/
protected $settings;
/**
* Initializes settings.
*/
public function __construct(stdClass $settings) {
$this->configName = $settings->name;
$this->settings = $settings->settings;
$this->settings += $this
->getDefaultSettings();
}
/**
* Executes the abstract class behavior.
*
* @return
* The element's render array.
*/
public abstract function execute();
/**
* Allows for backend specific overrides to the settings form.
*/
public function settingsForm(&$form, &$form_state) {
// Nothing to do...
}
/**
* Returns an array of default settings.
*/
public function getDefaultSettings() {
return array();
}
/**
* Helper function for translating strings.
*
* @param string $key
* The array key of the element being translated.
* @param string $string
* The string being translated.
*
* @return
* The translated string.
*
* @see facetapi_translate_string()
*/
public function translate($key, $string) {
$config_name = preg_replace('@[^a-zA-Z0-9]@', '_', $this->configName);
$name = 'facetapi:' . $config_name . ':empty_text:' . $key;
return facetapi_translate_string($name, $string);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FacetapiEmptyBehavior:: |
protected | property | The machine readable name of facet configuration. | |
FacetapiEmptyBehavior:: |
protected | property | An array of facet settings. | |
FacetapiEmptyBehavior:: |
abstract public | function | Executes the abstract class behavior. | 2 |
FacetapiEmptyBehavior:: |
public | function | Returns an array of default settings. | 1 |
FacetapiEmptyBehavior:: |
public | function | Allows for backend specific overrides to the settings form. | 1 |
FacetapiEmptyBehavior:: |
public | function | Helper function for translating strings. | |
FacetapiEmptyBehavior:: |
public | function | Initializes settings. | 1 |