forked from sstok/gush-experiments-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFieldConfigInterface.php
164 lines (146 loc) · 4.21 KB
/
FieldConfigInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
/*
* This file is part of the RollerworksSearch package.
*
* (c) Sebastiaan Stok <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Rollerworks\Component\Search;
/**
* The configuration of a SearchField.
*
* @author Sebastiaan Stok <[email protected]>
*/
interface FieldConfigInterface
{
/**
* Returns the name of field.
*
* @return string the Field name
*/
public function getName();
/**
* Returns the field type used to construct the field.
*
* @return ResolvedFieldTypeInterface The field's type
*/
public function getType();
/**
* Returns whether value-type $type is accepted by the field.
*
* Value must be a constant of:
*
* * ValuesBag::VALUE_TYPE_RANGE
* * ValuesBag::VALUE_TYPE_COMPARISON
* * ValuesBag::VALUE_TYPE_PATTERN_MATCH
*
* @param string $type
*
* @return bool
*/
public function supportValueType($type);
/**
* Set whether value-type $type is accepted by the field.
*
* * ValuesBag::VALUE_TYPE_RANGE
* * ValuesBag::VALUE_TYPE_COMPARISON
* * ValuesBag::VALUE_TYPE_PATTERN_MATCH
*
* @param string $type
* @param bool $enabled
*/
public function setValueTypeSupport($type, $enabled);
/**
* Returns the configured Model's class-name.
*
* This is required for certain storage engines.
*
* @return string
*/
public function getModelRefClass();
/**
* Returns the configured Model's field property-name.
*
* This is required for certain storage engines.
*
* @return string
*/
public function getModelRefProperty();
/**
* Set the {@link ValueComparisonInterface} instance for optimizing
* and validation.
*
* @param ValueComparisonInterface $comparisonObj
*/
public function setValueComparison(ValueComparisonInterface $comparisonObj);
/**
* Returns the configured {@link ValueComparisonInterface} instance.
*
* @return ValueComparisonInterface
*/
public function getValueComparison();
/**
* Appends / prepends a transformer to the view transformer chain.
*
* The transform method of the transformer is used to convert data from the
* normalized to the view format.
* The reverseTransform method of the transformer is used to convert from the
* view to the normalized format.
*
* @param DataTransformerInterface $viewTransformer
* @param bool $forcePrepend if set to true, prepend instead of appending
*/
public function addViewTransformer(DataTransformerInterface $viewTransformer, $forcePrepend = false);
/**
* Clears the view transformers of the field.
*
* @return self The configuration object.
*/
public function resetViewTransformers();
/**
* Returns the view transformers of the field.
*
* @return DataTransformerInterface[] An array of {@link DataTransformerInterface} instances
*/
public function getViewTransformers();
/**
* Returns whether the field's data is locked.
*
* A field with locked data is restricted to the data passed in
* this configuration.
*
* @return bool Whether the data is locked
*/
public function getDataLocked();
/**
* Returns all options passed during the construction of the field.
*
* @return array The passed options
*/
public function getOptions();
/**
* Returns whether a specific option exists.
*
* @param string $name The option name
*
* @return bool Whether the option exists
*/
public function hasOption($name);
/**
* Returns the value of a specific option.
*
* @param string $name The option name
* @param mixed $default The value returned if the option does not exist
*
* @return mixed The option value
*/
public function getOption($name, $default = null);
/**
* Returns a new SearchFieldView for the SearchField.
*
* @return SearchFieldView
*/
public function createView();
}