Created
May 25, 2017 14:32
-
-
Save heddn/b49ce728a111f63cd33ce8ae4e987e91 to your computer and use it in GitHub Desktop.
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
/** | |
* {@inheritdoc} | |
*/ | |
public function processDefinition(&$definition, $plugin_id) { | |
parent::processDefinition($definition, $plugin_id); | |
// Loop over each of the definitions and categorize it as config or content. | |
if (!empty($definition['class'])) { | |
$configuration_classes = [ | |
EntityConfigBase::class, | |
Config::class, | |
UserData::class, | |
ComponentEntityDisplayBase::class, | |
]; | |
// Do not overwrite an otherwise defined category. | |
if (empty($definition['category'])) { | |
if ($this->classInArray($definition['class'], $configuration_classes)) { | |
$definition['category'] = MigrateDestination::CATEGORY_CONFIGURATION; | |
} | |
else { | |
$definition['category'] = MigrateDestination::CATEGORY_CONTENT; | |
} | |
} | |
} | |
} |
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
public function processDefinition(&$definition, $plugin_id) { | |
parent::processDefinition($definition, $plugin_id); | |
// Loop over each of the definitions and categorize it as config or content. | |
$destination = $this->migrateDestinationPluginManager->getDefinition($definition['destination']['plugin'], FALSE); | |
if (!empty($destination['class'])) { | |
$configuration_classes = [ | |
EntityConfigBase::class, | |
Config::class, | |
UserData::class, | |
ComponentEntityDisplayBase::class, | |
]; | |
// Do not overwrite an otherwise defined category. | |
if (empty($definition['category'])) { | |
if (!empty($destination['category'])) { | |
$definition['category'] = $destination['category']; | |
} | |
elseif ($this->classInArray($destination['class'], $configuration_classes)) { | |
$definition['category'] = MigrateDestination::CATEGORY_CONFIGURATION; | |
} | |
else { | |
$definition['category'] = MigrateDestination::CATEGORY_CONTENT; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment