1 | <?php |
||
19 | class FieldContainer extends JsonObject |
||
20 | { |
||
21 | 14 | public function fieldDefinition($field) |
|
22 | { |
||
23 | 14 | if (!$this->parent instanceof CustomFieldObject) { |
|
24 | return null; |
||
25 | } |
||
26 | 14 | $typeReference = $this->parent->getType(); |
|
27 | |||
28 | 14 | if (!$typeReference instanceof TypeReference) { |
|
29 | return null; |
||
30 | } |
||
31 | 14 | $type = $typeReference->getObj(); |
|
32 | 14 | if (!$type instanceof Type) { |
|
33 | 7 | return null; |
|
34 | } |
||
35 | 7 | $fieldDefinitions = $type->getFieldDefinitions(); |
|
36 | 7 | if (!$fieldDefinitions instanceof FieldDefinitionCollection) { |
|
37 | return null; |
||
38 | } |
||
39 | 7 | $fieldDefinition = $fieldDefinitions->getByName($field); |
|
40 | 7 | if (!$fieldDefinition instanceof FieldDefinition) { |
|
41 | return null; |
||
42 | } |
||
43 | 7 | $fieldType = $fieldDefinition->getType(); |
|
44 | 7 | if (!$fieldType instanceof FieldType) { |
|
45 | return null; |
||
46 | } |
||
47 | 7 | return $fieldType->fieldTypeDefinition(); |
|
48 | } |
||
49 | |||
50 | /** |
||
51 | * @param string $field |
||
52 | * @param mixed $value |
||
53 | * @return $this |
||
54 | */ |
||
55 | public function set($field, $value) |
||
56 | { |
||
57 | return parent::set($field, $value); |
||
58 | } |
||
59 | |||
60 | 14 | public function hasField($field) |
|
64 | } |
||
65 |