class Property in Form Builder 7.2
Same name in this branch
- 7.2 examples/src/Property.php \Drupal\form_builder_examples\Property
- 7.2 modules/webform/src/Property.php \Drupal\form_builder_webform\Property
Hierarchy
- class \Drupal\form_builder\PropertyBase implements PropertyInterface
- class \Drupal\form_builder_webform\Property
Expanded class hierarchy of Property
1 file declares its use of Property
- form_builder_webform.module in modules/
webform/ form_builder_webform.module - Form Builder integration for the Webform module.
File
- modules/
webform/ src/ Property.php, line 7
Namespace
Drupal\form_builder_webformView source
class Property extends PropertyBase {
protected $storageParents;
/**
* {@inheritdoc}
*/
public function __construct($property, $params, $form_type_name) {
$params += array(
'storage_parents' => array(
$property,
),
);
parent::__construct($property, $params, $form_type_name);
$this->storageParents = $params['storage_parents'];
}
/**
* {@inheritdoc}
*/
public function setValue(&$component, $value) {
drupal_array_set_nested_value($component, $this->storageParents, $value);
}
/**
* Generate form-API elements for editing this property.
*
* @param array $form_state
* Form API form_state of the field configure form.
* @param \Drupal\form_builder\ElementInterface $element
* The currently stored element. Use this to get the "current" values.
*
* @return array
* Form-API array that will be merged into the field configure form.
*/
public function form($component, $edit, &$form_state) {
// Set weight to just anything. Element positions aren't configured in
// this way in form_builder.
$component['weight'] = 0;
if (isset($this->params['form']) && function_exists($this->params['form'])) {
$function = $this->params['form'];
return $function($component, $edit, $form_state, $this->property);
}
return array();
}
/**
* Read the value from a component array.
*/
public function getValue($component) {
return drupal_array_get_nested_value($component, $this->storageParents);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Property:: |
protected | property | ||
Property:: |
public | function | Generate form-API elements for editing this property. | |
Property:: |
public | function | Read the value from a component array. | |
Property:: |
public | function | 2 | |
Property:: |
public | function |
Construct a new instance of this property class. Overrides PropertyBase:: |
|
PropertyBase:: |
protected | property | 1 | |
PropertyBase:: |
protected | property | 1 | |
PropertyBase:: |
protected | property | 1 | |
PropertyBase:: |
public | function |
Submit handler for the editing form(). Overrides PropertyInterface:: |
1 |