class FormBuilderWebformProperty in Form Builder 7
Hierarchy
- class \FormBuilderPropertyBase implements FormBuilderPropertyInterface
- class \FormBuilderWebformProperty
Expanded class hierarchy of FormBuilderWebformProperty
1 string reference to 'FormBuilderWebformProperty'
- form_builder_webform_form_builder_form_types in modules/
webform/ form_builder_webform.module - Implements hook_form_builder_form_types().
File
- modules/
webform/ form_builder_webform.classes.inc, line 203
View source
class FormBuilderWebformProperty extends FormBuilderPropertyBase {
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);
}
/**
* {@inheritdoc}
*/
public function form(&$form_state, $element) {
// We use the rendered element here to re-use the form-API functions.
$e = $element
->render();
$e += array(
"#{$this->property}" => $this
->getValue($e['#webform_component']),
);
// Set weight to just anything. Element positions aren't configured in
// this way in form_builder.
$e['#webform_component']['weight'] = 0;
if (isset($this->params['form']) && function_exists($this->params['form'])) {
$function = $this->params['form'];
return $function($form_state, $this->formTypeName, $e, $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 |
---|---|---|---|---|
FormBuilderPropertyBase:: |
protected | property | ||
FormBuilderPropertyBase:: |
protected | property | ||
FormBuilderPropertyBase:: |
protected | property | ||
FormBuilderPropertyBase:: |
public | function |
Submit handler for the editing form(). Overrides FormBuilderPropertyInterface:: |
1 |
FormBuilderWebformProperty:: |
protected | property | ||
FormBuilderWebformProperty:: |
public | function |
Generate form-API elements for editing this property. Overrides FormBuilderPropertyBase:: |
|
FormBuilderWebformProperty:: |
public | function | Read the value from a component array. | |
FormBuilderWebformProperty:: |
public | function | 2 | |
FormBuilderWebformProperty:: |
public | function |
Construct a new instance of this property class. Overrides FormBuilderPropertyBase:: |