public function DefaultConfigEntityHandler::pull in CMS Content Sync 8
Same name and namespace in other branches
- 2.1.x src/Plugin/cms_content_sync/entity_handler/DefaultConfigEntityHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler\DefaultConfigEntityHandler::pull()
- 2.0.x src/Plugin/cms_content_sync/entity_handler/DefaultConfigEntityHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler\DefaultConfigEntityHandler::pull()
Pull the remote entity.
Overrides EntityHandlerBase::pull
File
- src/
Plugin/ cms_content_sync/ entity_handler/ DefaultConfigEntityHandler.php, line 130
Class
- DefaultConfigEntityHandler
- Class DefaultConfigEntityHandler, providing a minimalistic implementation for any config entity type.
Namespace
Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handlerCode
public function pull(PullIntent $intent) {
$action = $intent
->getAction();
if (!parent::pull($intent)) {
return false;
}
if (SyncIntent::ACTION_DELETE === $action) {
return true;
}
/**
* @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity
*/
$entity = $intent
->getEntity();
$forbidden_fields = $this
->getForbiddenFields();
foreach ($this
->getConfigProperties() as $property => $config) {
if (in_array($property, $forbidden_fields)) {
continue;
}
$entity
->set($property, $intent
->getProperty($property));
}
$entity
->save();
return true;
}