class FormBuilderPropertyBase in Form Builder 7
Hierarchy
- class \FormBuilderPropertyBase implements FormBuilderPropertyInterface
Expanded class hierarchy of FormBuilderPropertyBase
1 string reference to 'FormBuilderPropertyBase'
File
- ./
form_builder.classes.inc, line 960
View source
class FormBuilderPropertyBase implements FormBuilderPropertyInterface {
protected $property;
protected $params;
protected $formTypeName;
/**
* {@inheritdoc}
*/
public function __construct($property, $params, $form_type_name) {
$this->property = $property;
$this->params = $params;
$this->formTypeName = $form_type_name;
}
/**
* {@inheritdoc}
*/
public function form(&$form_state, $element) {
$e = $element
->render();
if (isset($this->params['form']) && function_exists($this->params['form'])) {
$function = $this->params['form'];
$p = $this->property;
// Set a default value on the property to avoid notices.
$e['#' . $p] = isset($e['#' . $p]) ? $e['#' . $p] : NULL;
return $function($form_state, $this->formTypeName, $e, $p);
}
return array();
}
/**
* {@inheritdoc}
*/
public function submit($form, &$form_state) {
if (isset($this->params['submit'])) {
foreach ($this->params['submit'] as $function) {
if (function_exists($function)) {
$function($form, $form_state);
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FormBuilderPropertyBase:: |
protected | property | ||
FormBuilderPropertyBase:: |
protected | property | ||
FormBuilderPropertyBase:: |
protected | property | ||
FormBuilderPropertyBase:: |
public | function |
Generate form-API elements for editing this property. Overrides FormBuilderPropertyInterface:: |
1 |
FormBuilderPropertyBase:: |
public | function |
Submit handler for the editing form(). Overrides FormBuilderPropertyInterface:: |
1 |
FormBuilderPropertyBase:: |
public | function |
Construct a new instance of this property class. Overrides FormBuilderPropertyInterface:: |
1 |