public function publish(Batch $batch, BlockType $bt, Page $page, Area $area, BlockValue $value)
 {
     $data = array();
     $data['slID'] = array();
     $records = $value->getRecords();
     foreach ($records as $record) {
         $value = $record->getData();
         $value = $value['service'];
         // because it comes out as an array
         $socialLink = Link::getByServiceHandle($value);
         if (is_object($socialLink)) {
             $data['slID'][] = $socialLink->getID();
         }
     }
     $b = $page->addBlock($bt, $area->getName(), $data);
     return $b;
 }
 public function publish(Batch $batch, BlockType $bt, Page $page, Area $area, BlockValue $value)
 {
     $routine = new PublishPageContentRoutine();
     $routine->setBatch($batch);
     /* @var $value AreaLayoutBlockValue */
     $layout = $value->getAreaLayout();
     $publisher = $layout->getPublisher();
     $layoutObject = $publisher->publish($layout);
     $columns = $layout->getColumns();
     $i = 0;
     $layoutBlock = $page->addBlock($bt, $area->getName(), array('arLayoutID' => $layoutObject->getAreaLayoutID()));
     foreach ($layoutObject->getAreaLayoutColumns() as $columnObject) {
         $column = $columns[$i];
         foreach ($column->getBlocks() as $block) {
             $subValue = $block->getBlockValue();
             $publisher = $subValue->getPublisher();
             $subarea = new Area();
             $subAreaName = $area->getName() . SubArea::AREA_SUB_DELIMITER . $columnObject->getAreaLayoutColumnDisplayID();
             $subarea->setName($subAreaName);
             /*
              * @var $publisher BlockPublisherInterface
              */
             $subBlockType = $routine->getTargetItem('block_type', $block->getType());
             if (is_object($subBlockType)) {
                 $b = $publisher->publish($batch, $subBlockType, $page, $subarea, $subValue);
                 $styleSet = $block->getStyleSet();
                 if (is_object($styleSet)) {
                     $styleSetPublisher = $styleSet->getPublisher();
                     $publishedStyleSet = $styleSetPublisher->publish();
                     $b->setCustomStyleSet($publishedStyleSet);
                 }
                 if ($block->getCustomTemplate()) {
                     $b->setCustomTemplate($block->getCustomTemplate());
                 }
             }
         }
         ++$i;
     }
     return $layoutBlock;
 }
 public function publish(Batch $batch, BlockType $bt, Page $page, Area $area, BlockValue $value)
 {
     $records = $value->getRecords();
     $inspector = \Core::make('import/value_inspector');
     if (count($records) == 1) {
         $data = array();
         foreach ($records[0]->getData() as $key => $value) {
             $result = $inspector->inspect($value);
             $data[$key] = $result->getReplacedValue();
         }
         $b = $page->addBlock($bt, $area->getName(), $data);
     } elseif (count($records) > 1) {
         foreach ($records as $record) {
             if (strcasecmp($record->getTable(), $bt->getController()->getBlockTypeDatabaseTable()) == 0) {
                 // This is the data record.
                 $data = array();
                 foreach ($record->getData() as $key => $value) {
                     $result = $inspector->inspect($value);
                     $data[$key] = $result->getReplacedValue();
                 }
                 $b = $page->addBlock($bt, $area->getName(), $data);
             }
         }
         // Now we import the OTHER records.
         foreach ($records as $record) {
             if (strcasecmp($record->getTable(), $bt->getController()->getBlockTypeDatabaseTable()) != 0) {
                 $aar = new BlockRecord($record->getTable());
                 $aar->bID = $b->getBlockID();
                 foreach ($record->getData() as $key => $value) {
                     $result = $inspector->inspect($value);
                     $aar->{$key} = $result->getReplacedValue();
                 }
                 $aar->Save();
             }
         }
     } else {
         $b = $page->addBlock($bt, $area->getName(), array());
     }
     return $b;
 }
 public function publish(Batch $batch, BlockType $bt, Page $page, Area $area, BlockValue $value)
 {
     $btc = $bt->getController();
     $bx = simplexml_load_string($value->getValue());
     return $btc->import($page, $area->getName(), $bx);
 }