@@ 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 |
@@ 513-524 (lines=12) @@ | ||
510 | * @param Datastore_Interface $datastore |
|
511 | * @return object $this |
|
512 | **/ |
|
513 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
514 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
515 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
516 | } |
|
517 | $this->datastore = $datastore; |
|
518 | $this->has_default_datastore = $set_as_default; |
|
519 | ||
520 | foreach ( $this->fields as $field ) { |
|
521 | $field->set_datastore( $this->get_datastore(), true ); |
|
522 | } |
|
523 | return $this; |
|
524 | } |
|
525 | ||
526 | /** |
|
527 | * Get the DataStore instance |