You are here

public function Embed::nodeStatus in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 2.0.x src/Controller/Embed.php \Drupal\cms_content_sync\Controller\Embed::nodeStatus()
1 string reference to 'Embed::nodeStatus'
cms_content_sync.routing.yml in ./cms_content_sync.routing.yml
cms_content_sync.routing.yml

File

src/Controller/Embed.php, line 169

Class

Embed
Class Embed provides helpers to embed Sync Core functionality into the site.

Namespace

Drupal\cms_content_sync\Controller

Code

public function nodeStatus(NodeInterface $node) {
  $this
    ->init();
  $user = \Drupal::currentUser();
  $params = [
    'configurationAccess' => $user
      ->hasPermission('administer cms content sync'),
  ];
  if (EntityHandlerPluginManager::isEntityTypeConfiguration($node
    ->getEntityTypeId())) {
    $params['remoteUniqueId'] = $node
      ->id();
  }
  else {
    $params['remoteUuid'] = $node
      ->uuid();
  }

  // TODO: Show warning if not using Sync Core v2 yet, so users understand why it's empty.
  $embed = $this->embedService
    ->entityStatus($params);
  return $this
    ->run($embed);
}