-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added: support for EntityTools migrate feature
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace ColdTrick\StaticPages; | ||
|
||
use ColdTrick\EntityTools\Migrate; | ||
|
||
class MigrateStatic extends Migrate { | ||
|
||
/** | ||
* Add static to the supported types for EntityTools | ||
* | ||
* @param string $hook the name of the hook | ||
* @param string $type the type of the hook | ||
* @param array $return_value current return value | ||
* @param mixed $params supplied params | ||
* | ||
* @return array | ||
*/ | ||
public static function supportedSubtypes($hook, $type, $return_value, $params) { | ||
|
||
$return_value[\StaticPage::SUBTYPE] = self::class; | ||
|
||
return $return_value; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
* @see \ColdTrick\EntityTools\Migrate::setSupportedOptions() | ||
*/ | ||
protected function setSupportedOptions() { | ||
$this->supported_options = [ | ||
'backdate' => true, | ||
'change_owner' => false, | ||
'change_container' => true, | ||
]; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
* @see \ColdTrick\EntityTools\Migrate::changeContainer() | ||
*/ | ||
public function changeContainer($new_container_guid) { | ||
|
||
// do all the default stuff | ||
parent::changeContainer($new_container_guid); | ||
|
||
// also move owner | ||
$this->object->owner_guid = $new_container_guid; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters