@@ 177-191 (lines=15) @@ | ||
174 | * @param string $key |
|
175 | * @return mixed Result if the setting is available, or null otherwise |
|
176 | */ |
|
177 | public function getOption($key) |
|
178 | { |
|
179 | // If possible use the current record |
|
180 | if ($record = $this->getOwnerRecord()) { |
|
181 | return $record->getCommentsOption($key); |
|
182 | } |
|
183 | ||
184 | // Otherwise a singleton of that record |
|
185 | if ($class = $this->getParentClass()) { |
|
186 | return singleton($class)->getCommentsOption($key); |
|
187 | } |
|
188 | ||
189 | // Otherwise just use the default options |
|
190 | return singleton(CommentsExtension::class)->getCommentsOption($key); |
|
191 | } |
|
192 | ||
193 | /** |
|
194 | * Returns all the commenting options for the current instance. |
|
@@ 198-211 (lines=14) @@ | ||
195 | * |
|
196 | * @return array |
|
197 | */ |
|
198 | public function getOptions() |
|
199 | { |
|
200 | if ($record = $this->getOwnerRecord()) { |
|
201 | return $record->getCommentsOptions(); |
|
202 | } |
|
203 | ||
204 | // Otherwise a singleton of that record |
|
205 | if ($class = $this->getParentClass()) { |
|
206 | return singleton($class)->getCommentsOptions(); |
|
207 | } |
|
208 | ||
209 | // Otherwise just use the default options |
|
210 | return singleton(CommentsExtension::class)->getCommentsOptions(); |
|
211 | } |
|
212 | ||
213 | /** |
|
214 | * Workaround for generating the link to this controller |