Property.php in Form Builder 7.2
File
modules/webform/src/Property.php
View source
<?php
namespace Drupal\form_builder_webform;
use Drupal\form_builder\PropertyBase;
class Property extends PropertyBase {
protected $storageParents;
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'];
}
public function setValue(&$component, $value) {
drupal_array_set_nested_value($component, $this->storageParents, $value);
}
public function form($component, $edit, &$form_state) {
$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();
}
public function getValue($component) {
return drupal_array_get_nested_value($component, $this->storageParents);
}
}