@@ 515-526 (lines=12) @@ | ||
512 | * @param Datastore_Interface $datastore |
|
513 | * @return object $this |
|
514 | **/ |
|
515 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
516 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
517 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
518 | } |
|
519 | $this->datastore = $datastore; |
|
520 | $this->has_default_datastore = $set_as_default; |
|
521 | ||
522 | foreach ( $this->fields as $field ) { |
|
523 | $field->set_datastore( $this->get_datastore(), true ); |
|
524 | } |
|
525 | return $this; |
|
526 | } |
|
527 | ||
528 | /** |
|
529 | * Get the DataStore instance |
@@ 185-196 (lines=12) @@ | ||
182 | * |
|
183 | * @param Datastore_Interface $datastore |
|
184 | */ |
|
185 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
186 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
187 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
188 | } |
|
189 | $this->datastore = $datastore; |
|
190 | $this->has_default_datastore = $set_as_default; |
|
191 | ||
192 | foreach ( $this->groups as $group ) { |
|
193 | $group->set_datastore( $this->get_datastore(), true ); |
|
194 | } |
|
195 | return $this; |
|
196 | } |
|
197 | ||
198 | /** |
|
199 | * Return a clone of a field with hierarchy settings applied |