Skip to content

Commit

Permalink
Exclude Header form field for storage
Browse files Browse the repository at this point in the history
  • Loading branch information
krazzer committed Sep 29, 2023
1 parent 67046fb commit 0eb540f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/Classes/WebForm/DataForm/StorageData.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use KikCMS\Classes\WebForm\Fields\ButtonField;
use KikCMS\Classes\WebForm\Fields\DataTableField;
use KikCMS\Classes\WebForm\Fields\Header;
use KikCMS\Classes\WebForm\Fields\HtmlField;
use KikCMS\ObjectLists\FieldMap;
use KikCmsCore\Classes\Model;
Expand Down Expand Up @@ -110,7 +111,7 @@ public function getMainInput(): array

foreach ($this->fieldMap as $key => $field) {
if ($field->isDontStore() || $field instanceof DataTableField || $field instanceof ButtonField ||
$field instanceof HtmlField) {
$field instanceof HtmlField || $field instanceof Header) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Classes/WebForm/Fields/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Header extends Field
*/
public function __construct(string $label)
{
$this->key = uniqid();
$this->key = 'header_' . uniqid();
$this->label = $label;
}

Expand Down
4 changes: 0 additions & 4 deletions src/Services/WebForm/StorageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ private function storeMain()

// set objects' properties
foreach ($mainInput as $key => $value) {
if(is_integer($key)){
$this->logger->log(LogLevel::NOTICE, 'Integer key encountered: ' . json_encode($mainInput));
}

if ($this->relationKeyService->isRelationKey($key)) {
$localPreSaveRelations = $this->relationKeyService->set($object, $key, $value, $langCode);
$preSaveRelations = array_merge($preSaveRelations, $localPreSaveRelations);
Expand Down

0 comments on commit 0eb540f

Please sign in to comment.