Skip to content

Instantly share code, notes, and snippets.

@heddn
Created May 25, 2017 14:32
Show Gist options
  • Save heddn/b49ce728a111f63cd33ce8ae4e987e91 to your computer and use it in GitHub Desktop.
Save heddn/b49ce728a111f63cd33ce8ae4e987e91 to your computer and use it in GitHub Desktop.
/**
* {@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;
}
}
}
}
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