Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
aembler committed Feb 28, 2017
1 parent 82cf6c1 commit 937c9b0
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,20 @@ public function jsonSerialize()
$node->lazy = true;
$node->nodetype = 'page';
$node->extraClasses = 'migration-node-main';

$publisherValidator = $page->getPublisherValidator();
$skipItem = $publisherValidator->skipItem();
if ($skipItem) {
$node->extraClasses .= ' migration-item-skipped';
}

$node->id = $page->getId();
$node->pagePath = '<a href="#" data-editable-property="path" data-type="text" data-pk="' . $page->getID() . '" data-title="' . t('Page Path') . '">' . $page->getBatchPath() . '</a>';
$node->pageType = $page->getType();
$node->pageTemplate = $page->getTemplate();
$node->statusClass = $formatter->getCollectionStatusIconClass();
if (!$skipItem) {
$node->statusClass = $formatter->getCollectionStatusIconClass();
}
$response[] = $node;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
<?php
namespace PortlandLabs\Concrete5\MigrationTool\Publisher\Validator;

use PortlandLabs\Concrete5\MigrationTool\Batch\ContentMapper\Item\Item;
use PortlandLabs\Concrete5\MigrationTool\Entity\ContentMapper\IgnoredTargetItem;
use PortlandLabs\Concrete5\MigrationTool\Entity\Import\Page;
use PortlandLabs\Concrete5\MigrationTool\Publisher\PublishableInterface;
use PortlandLabs\Concrete5\MigrationTool\Publisher\Routine\CreatePageStructureRoutine;
use PortlandLabs\Concrete5\MigrationTool\Publisher\Routine\CreatePageStructureRoutineAction;

class PageValidator extends AbstractValidator
{

protected $skip = false;

public function __construct(PublishableInterface $object)
{
parent::__construct($object);

$em = \Database::connection()->getEntityManager();
$page = $this->object;
/**
* @var $page Page
*/
$r = $em->getRepository('\PortlandLabs\Concrete5\MigrationTool\Entity\Import\Batch');
$collection = $page->getCollection();
$batch = $r->findFromCollection($collection);

// This code checks to see if the page type for the current page is being ignored globally.
// If it is, then we ignore this page.
$mappers = \Core::make('migration/manager/mapping');
$mapper = $mappers->driver('page_type');
$list = $mappers->createTargetItemList($batch, $mapper);
$item = new Item($page->getType());
$targetItem = $list->getSelectedTargetItem($item);

if ($targetItem instanceof IgnoredTargetItem) {
$this->skip = true;
}

}

public function skipItem()
{
return false;
return $this->skip;
}
}

0 comments on commit 937c9b0

Please sign in to comment.