File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212class Field extends DataObject
1313{
1414 public function __construct (
15- private AbstractBlock $ block ,
15+ private ? AbstractBlock $ block = null ,
1616 array $ data = [],
1717 ) {
1818 parent ::__construct ($ data );
@@ -80,7 +80,12 @@ public function getFieldType(): FieldTypeInterface
8080 return $ fieldType ;
8181 }
8282
83- public function getBlock (): AbstractBlock
83+ public function setBlock (AbstractBlock $ block ): self
84+ {
85+ $ this ->block = $ block ;
86+ }
87+
88+ public function getBlock (): ?AbstractBlock
8489 {
8590 return $ this ->block ;
8691 }
Original file line number Diff line number Diff line change 77use Magento \Framework \View \Element \AbstractBlock ;
88use Magento \Framework \View \Element \Template ;
99use Magento \Framework \View \LayoutInterface ;
10+ use RuntimeException ;
1011
1112class FieldFactory
1213{
@@ -29,7 +30,7 @@ public function createWithBlock(
2930 }
3031
3132 public function create (
32- AbstractBlock $ block ,
33+ ? AbstractBlock $ block = null ,
3334 array $ data = [],
3435 ): Field {
3536 if (!isset ($ data ['code ' ]) && !empty ($ data ['name ' ])) {
@@ -50,7 +51,7 @@ public function create(
5051 }
5152
5253 if (false === $ data ['field_type ' ] instanceof FieldTypeInterface) {
53- throw new \ RuntimeException ((string )__ ('Field type "%1" could not be resolved ' , $ data ['field_type ' ]));
54+ throw new RuntimeException ((string )__ ('Field type "%1" could not be resolved ' , $ data ['field_type ' ]));
5455 }
5556
5657 if (!isset ($ data ['scope ' ])) {
You can’t perform that action at this time.
0 commit comments