-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IBX-7935: Handled User-related structs in
FieldCollectionType
dispa…
…tcher (#64) * IBX-7935: Handled User-related structs in `FieldCollectionType` dispatcher * IBX-7935: Refactored code * IBX-7935: Further code refactor * IBX-7935: Applied review remarks * IBX-7935: Fixup * IBX-7935: Applied review remarks * IBX-7935: Refactored options * IBX-7935: Refactored options * IBX-7935: Allowed BC * IBX-7935: Refactored default value for the `struct` option * IBX-7935: Refactored `FieldCollectionType` * IBX-7935: Fixed translation domain * IBX-7935: Applied review remark * IBX-7935: Removed unnecessary annotations * IBX-7935: Removed unnecessary annotations * IBX-7935: Fixed `data` option not being passed to `struct` * IBX-7935: Allow `struct` to be `null` option
- Loading branch information
Showing
13 changed files
with
417 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\ContentForms\Event; | ||
|
||
use Ibexa\Contracts\ContentForms\Data\Content\FieldData; | ||
use Symfony\Component\Form\FormInterface; | ||
use Symfony\Contracts\EventDispatcher\Event; | ||
|
||
abstract class StructFieldOptionsEvent extends Event | ||
{ | ||
protected FormInterface $parentForm; | ||
|
||
protected FieldData $fieldData; | ||
|
||
/** @var array<string, mixed> */ | ||
protected array $options; | ||
|
||
public function __construct( | ||
FormInterface $parentForm, | ||
FieldData $fieldData, | ||
array $options | ||
) { | ||
$this->parentForm = $parentForm; | ||
$this->fieldData = $fieldData; | ||
$this->options = $options; | ||
} | ||
|
||
public function getParentForm(): FormInterface | ||
{ | ||
return $this->parentForm; | ||
} | ||
|
||
public function getFieldData(): FieldData | ||
{ | ||
return $this->fieldData; | ||
} | ||
|
||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
public function getOptions(): array | ||
{ | ||
return $this->options; | ||
} | ||
|
||
/** | ||
* @param array<string, mixed> $options | ||
*/ | ||
public function setOptions(array $options): void | ||
{ | ||
$this->options = $options; | ||
} | ||
|
||
/** | ||
* @param mixed $value | ||
*/ | ||
public function setOption(string $option, $value): void | ||
{ | ||
$this->options[$option] = $value; | ||
} | ||
|
||
/** | ||
* @return mixed|null | ||
*/ | ||
public function getOption(string $option) | ||
{ | ||
return $this->options[$option] ?? null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\ContentForms\Event; | ||
|
||
use Ibexa\Contracts\ContentForms\Data\Content\FieldData; | ||
use Ibexa\Contracts\Core\Repository\Values\User\UserCreateStruct; | ||
use Symfony\Component\Form\FormInterface; | ||
|
||
final class UserCreateFieldOptionsEvent extends StructFieldOptionsEvent | ||
{ | ||
private UserCreateStruct $userCreateStruct; | ||
|
||
public function __construct( | ||
UserCreateStruct $userCreateStruct, | ||
FormInterface $parentForm, | ||
FieldData $fieldData, | ||
array $options | ||
) { | ||
$this->userCreateStruct = $userCreateStruct; | ||
|
||
parent::__construct($parentForm, $fieldData, $options); | ||
} | ||
|
||
public function getUserCreateStruct(): UserCreateStruct | ||
{ | ||
return $this->userCreateStruct; | ||
} | ||
} |
Oops, something went wrong.