/** * {@inheritdoc} */ public function synchronize(NodeInterface $node, Context $context, $dirtyAllowed = false) { /* @var $node \USync\AST\Drupal\MenuNode */ $object = ['menu_name' => $node->getName()]; if ($node->hasChild('name')) { $object['title'] = (string) $node->getChild('name')->getValue(); } if ($node->hasChild('description')) { $object['description'] = (string) $node->getChild('description')->getValue(); } $object += self::$defaults; if ($node->shouldDropOnUpdate()) { $context->log(sprintf("%s: deleting menu and children", $node->getPath())); menu_delete($object); } menu_save($object); return $node->getName(); }