@@ -71,6 +71,7 @@ function setValue($value) {
71
71
public function saveInto (DataObjectInterface $ record ) {
72
72
$ record ->setCastedField ($ this ->getLatField (), $ this ->latField ->dataValue ());
73
73
$ record ->setCastedField ($ this ->getLngField (), $ this ->lngField ->dataValue ());
74
+ return $ this ;
74
75
}
75
76
76
77
public function getChildFields () {
@@ -97,8 +98,43 @@ public function getLngData() {
97
98
return $ this ->data ->$ fieldNames ['lng ' ];
98
99
}
99
100
100
- public function getOption ($ option ) {
101
- return $ this ->options [$ option ];
101
+ public function getOption ($ name ) {
102
+ // Quicker execution path for "."-free names
103
+ if (strpos ($ name , '. ' ) === false ) {
104
+ if (isset ($ this ->options [$ name ])) return $ this ->options [$ name ];
105
+ } else {
106
+ $ names = explode ('. ' , $ name );
107
+
108
+ $ var = $ this ->options ;
109
+
110
+ foreach ($ names as $ n ) {
111
+ if (!isset ($ var [$ n ])) {
112
+ return null ;
113
+ }
114
+ $ var = $ var [$ n ];
115
+ }
116
+
117
+ return $ var ;
118
+ }
119
+ }
120
+
121
+ public function setOption ($ name , $ val ) {
122
+ // Quicker execution path for "."-free names
123
+ if (strpos ($ name ,'. ' ) === false ) {
124
+ $ this ->options [$ name ] = $ val ;
125
+ } else {
126
+ $ names = explode ('. ' , $ name );
127
+
128
+ // We still want to do this even if we have strict path checking for legacy code
129
+ $ var = &$ this ->options ;
130
+
131
+ foreach ($ names as $ n ) {
132
+ $ var = &$ var [$ n ];
133
+ }
134
+
135
+ $ var = $ val ;
136
+ }
137
+ return $ this ;
102
138
}
103
139
104
140
}
0 commit comments