You are here

public function FlexiformElement::__construct in Flexiform 7

Construct the class.

Parameters

string $namespace: The unique namespace of this form element.

array $settings: An array of settings for the element. It must include at least the following keys:

  • 'entity_namespace' - The namespace of the entity this element is

acting on. This is the key of the entity in the $flexiform->entities array.

  • 'element_name' - The name of the element we're using.
3 calls to FlexiformElement::__construct()
FlexiformElementEntityProperty::__construct in includes/element/property.element.inc
Overrides FlexiformElement::__construct().
FlexiformElementField::__construct in includes/element/field.element.inc
Overrides FlexiformElement::__construct().
FlexiformElementFlexiform::__construct in includes/element/flexiform.element.inc
Overrides FlexiformElement::__construct().
3 methods override FlexiformElement::__construct()
FlexiformElementEntityProperty::__construct in includes/element/property.element.inc
Overrides FlexiformElement::__construct().
FlexiformElementField::__construct in includes/element/field.element.inc
Overrides FlexiformElement::__construct().
FlexiformElementFlexiform::__construct in includes/element/flexiform.element.inc
Overrides FlexiformElement::__construct().

File

includes/flexiform.element.inc, line 67
Controller class for flexiform elements.

Class

FlexiformElement
Base class for all FlexiformElements

Code

public function __construct($flexiform, $settings, $element_namespace = '') {
  $this->flexiform = $flexiform;
  $this->entity_namespace = $settings['entity_namespace'];
  $this->entity_type = $flexiform->entities[$settings['entity_namespace']]['entity_type'];
  $this->bundle = $flexiform->entities[$settings['entity_namespace']]['bundle'];
  $this->element_name = $settings['element_name'];
  $this->element_info = flexiform_get_element_info($this->entity_type, $this->bundle, $this->element_name);
  $this->settings = $settings;
  $this->weight = !empty($settings['weight']) ? $settings['weight'] : 0;
  $this->settings += array(
    'display_options' => array(),
  );
  $this->element_namespace = !empty($element_namespace) ? $element_namespace : $this
    ->makeElementNamespace();
}