protected function _update_blocks($blocks_to_update, array $data)
 {
     foreach ($blocks_to_update as $entity) {
         $row = $data[$entity->get_bid()];
         $entity->set_position($row['position']);
         $entity->set_weight($row['weight']);
         $this->block_mapper->save($entity);
     }
 }
Пример #2
0
 protected function _duplicate_blocks(\blitze\sitemaker\model\blocks\collections\blocks $collection, $route_id, $style_id)
 {
     $blocks = array();
     foreach ($collection as $entity) {
         $copy = clone $entity;
         $copy->set_style($style_id)->set_route_id($route_id);
         $copied = $this->block_mapper->save($copy);
         $position = $copied->get_position();
         $blocks[$position][] = $this->render_block($copied);
     }
     return $blocks;
 }
Пример #3
0
 private function _update_similar($old_hash, $new_hash, $settings)
 {
     // find all similar blocks
     $blocks_collection = $this->block_mapper->find(array('hash' => $old_hash));
     $blocks = array();
     foreach ($blocks_collection as $entity) {
         $entity->set_hash($new_hash);
         $entity->set_settings($settings);
         $this->block_mapper->save($entity);
         $blocks[$entity->get_bid()] = $this->render_block($entity);
     }
     return $blocks;
 }