@@ 189-200 (lines=12) @@ | ||
186 | * |
|
187 | * @param Datastore_Interface $datastore |
|
188 | */ |
|
189 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
190 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
191 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
192 | } |
|
193 | $this->datastore = $datastore; |
|
194 | $this->has_default_datastore = $set_as_default; |
|
195 | ||
196 | foreach ( $this->groups as $group ) { |
|
197 | $group->set_datastore( $this->get_datastore(), true ); |
|
198 | } |
|
199 | return $this; |
|
200 | } |
|
201 | ||
202 | /** |
|
203 | * Return a clone of a field with hierarchy settings applied |
@@ 506-517 (lines=12) @@ | ||
503 | * @param Datastore_Interface $datastore |
|
504 | * @return object $this |
|
505 | **/ |
|
506 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
507 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
508 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
509 | } |
|
510 | $this->datastore = $datastore; |
|
511 | $this->has_default_datastore = $set_as_default; |
|
512 | ||
513 | foreach ( $this->fields as $field ) { |
|
514 | $field->set_datastore( $this->get_datastore(), true ); |
|
515 | } |
|
516 | return $this; |
|
517 | } |
|
518 | ||
519 | /** |
|
520 | * Get the DataStore instance |