public function FieldHandlerBase::pull in CMS Content Sync 8
Same name and namespace in other branches
- 2.1.x src/Plugin/FieldHandlerBase.php \Drupal\cms_content_sync\Plugin\FieldHandlerBase::pull()
- 2.0.x src/Plugin/FieldHandlerBase.php \Drupal\cms_content_sync\Plugin\FieldHandlerBase::pull()
Parameters
\Drupal\cms_content_sync\SyncIntent $intent: The request containing all pushed data
Return value
bool Whether or not the content has been pulled. FALSE is a desired state, meaning the entity should not be pulled according to config.
Throws
\Drupal\cms_content_sync\Exception\SyncException
Overrides FieldHandlerInterface::pull
1 call to FieldHandlerBase::pull()
- DefaultPathHandler::pull in src/
Plugin/ cms_content_sync/ field_handler/ DefaultPathHandler.php
8 methods override FieldHandlerBase::pull()
- DefaultFileHandler::pull in src/
Plugin/ cms_content_sync/ field_handler/ DefaultFileHandler.php - DefaultFormattedTextHandler::pull in src/
Plugin/ cms_content_sync/ field_handler/ DefaultFormattedTextHandler.php - DefaultLayoutBuilderHandler::pull in src/
Plugin/ cms_content_sync/ field_handler/ DefaultLayoutBuilderHandler.php - DefaultLinkHandler::pull in src/
Plugin/ cms_content_sync/ field_handler/ DefaultLinkHandler.php - DefaultPanelizerHandler::pull in src/
Plugin/ cms_content_sync/ field_handler/ DefaultPanelizerHandler.php
File
- src/
Plugin/ FieldHandlerBase.php, line 153
Class
- FieldHandlerBase
- Common base class for field handler plugins.
Namespace
Drupal\cms_content_sync\PluginCode
public function pull(PullIntent $intent) {
$action = $intent
->getAction();
$entity = $intent
->getEntity();
// Deletion doesn't require any action on field basis for static data.
if (SyncIntent::ACTION_DELETE == $action) {
return false;
}
if ($intent
->shouldMergeChanges() && !$this
->forceMergeOverwrite()) {
return false;
}
if (PullIntent::PULL_AUTOMATICALLY != $this->settings['import']) {
return false;
}
// These fields can't be changed.
if (!$entity
->isNew()) {
if ('default_langcode' === $this->fieldName) {
return true;
}
}
$data = $intent
->getProperty($this->fieldName);
if (empty($data)) {
$entity
->set($this->fieldName, null);
}
else {
$entity
->set($this->fieldName, $data);
}
return true;
}