2 namespace wcf\system\form\builder\field\data\processor;
3 use wcf\system\form\builder\IFormDocument;
6 * Field data processor implementation that voids a certain data property.
8 * @author Matthias Schmidt
9 * @copyright 2001-2018 WoltLab GmbH
10 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
11 * @package WoltLabSuite\Core\System\Form\Builder\Field\Data\Processor
14 class VoidFormFieldDataProcessor implements IFormFieldDataProcessor {
16 * is `true` if the property is stored in the `data` array
19 protected $isDataProperty;
22 * name of the voided property
28 * Initializes a new CustomFormFieldDataProcessor object.
30 * @param string $property name of the voided property
31 * @param bool $isDataProperty is `true` if the property is stored in the `data` array
33 public function __construct($property, $isDataProperty = true) {
34 $this->property = $property;
35 $this->isDataProperty = $isDataProperty;
41 public function __invoke(IFormDocument $document, array $parameters) {
42 if ($this->isDataProperty) {
43 if (isset($parameters['data'][$this->property])) {
44 unset($parameters['data'][$this->property]);
47 else if (isset($parameters[$this->property])) {
48 unset($parameters[$this->property]);