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
Form builder property for the example form type.
Hierarchy
- class \Drupal\form_builder\PropertyBase implements PropertyInterface
- class \Drupal\form_builder_examples\Property
Expanded class hierarchy of Property
1 file declares its use of Property
- form_builder_examples.module in examples/
form_builder_examples.module - form_builder_examples.module Sample implementations of form_builder.
File
- examples/
src/ Property.php, line 10
Namespace
Drupal\form_builder_examplesView source
class Property extends PropertyBase {
protected $property;
protected $params;
protected $formTypeName;
/**
* 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(&$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();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Property:: |
protected | property |
Overrides PropertyBase:: |
|
Property:: |
protected | property |
Overrides PropertyBase:: |
|
Property:: |
protected | property |
Overrides PropertyBase:: |
|
Property:: |
public | function | Generate form-API elements for editing this property. | |
PropertyBase:: |
public | function |
Submit handler for the editing form(). Overrides PropertyInterface:: |
1 |
PropertyBase:: |
public | function |
Construct a new instance of this property class. Overrides PropertyInterface:: |
1 |