You are here

public function FieldHandlerBase::push in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 8 src/Plugin/FieldHandlerBase.php \Drupal\cms_content_sync\Plugin\FieldHandlerBase::push()
  2. 2.0.x src/Plugin/FieldHandlerBase.php \Drupal\cms_content_sync\Plugin\FieldHandlerBase::push()

Parameters

\Drupal\cms_content_sync\SyncIntent $intent:

Return value

bool Whether or not the content has been pushed. FALSE is a desired state, meaning the entity should not be pushed according to config.

Throws

\Drupal\cms_content_sync\Exception\SyncException

Overrides FieldHandlerInterface::push

1 call to FieldHandlerBase::push()
DefaultFormattedTextHandler::push in src/Plugin/cms_content_sync/field_handler/DefaultFormattedTextHandler.php
8 methods override FieldHandlerBase::push()
DefaultFileHandler::push in src/Plugin/cms_content_sync/field_handler/DefaultFileHandler.php
DefaultFormattedTextHandler::push in src/Plugin/cms_content_sync/field_handler/DefaultFormattedTextHandler.php
DefaultLayoutBuilderHandler::push in src/Plugin/cms_content_sync/field_handler/DefaultLayoutBuilderHandler.php
DefaultLinkHandler::push in src/Plugin/cms_content_sync/field_handler/DefaultLinkHandler.php
DefaultPanelizerHandler::push in src/Plugin/cms_content_sync/field_handler/DefaultPanelizerHandler.php

... See full list

File

src/Plugin/FieldHandlerBase.php, line 193

Class

FieldHandlerBase
Common base class for field handler plugins.

Namespace

Drupal\cms_content_sync\Plugin

Code

public function push(PushIntent $intent) {
  $action = $intent
    ->getAction();
  $entity = $intent
    ->getEntity();
  if (PushIntent::PUSH_AUTOMATICALLY != $this->settings['export']) {
    return false;
  }

  // Deletion doesn't require any action on field basis for static data.
  if (SyncIntent::ACTION_DELETE == $action) {
    return false;
  }
  $intent
    ->setProperty($this->fieldName, $entity
    ->get($this->fieldName)
    ->getValue());
  return true;
}