コード例 #1
0
ファイル: Layout.php プロジェクト: ericssonm/JusCuzCustoms
 public function save()
 {
     $layout = $this->request->post->getJson('layout');
     if (!isset($layout)) {
         throw new \RuntimeException('Error while saving layout: Structure missing', 400);
     }
     $configuration = $this->params['configuration'];
     $preset = $this->request->post->getJsonArray('preset');
     // Create layout from the data.
     $layout = new LayoutObject($configuration, $layout, $preset);
     // Save layout and its index.
     $layout->save()->saveIndex();
     // Fire save event.
     $event = new Event();
     $event->gantry = $this->container;
     $event->theme = $this->container['theme'];
     $event->controller = $this;
     $event->layout = $layout;
     $this->container->fireEvent('admin.layout.save', $event);
 }
コード例 #2
0
ファイル: Layout.php プロジェクト: Ettore495/Ettore-Work
 public function save()
 {
     if (!isset($_POST['layout'])) {
         throw new \RuntimeException('Error while saving layout: Structure missing', 400);
     }
     $configuration = $this->params['configuration'];
     $layout = json_decode($_POST['layout'], true);
     $preset = isset($_POST['preset']) ? json_decode($_POST['preset'], true) : '';
     // Create layout from the data.
     $layout = new LayoutObject($configuration, LayoutReader::data(['preset' => $preset, 'children' => $layout]));
     // Save layout and its index.
     $layout->save()->saveIndex();
     // Fire save event.
     $event = new Event();
     $event->gantry = $this->container;
     $event->theme = $this->container['theme'];
     $event->controller = $this;
     $event->layout = $layout;
     $this->container->fireEvent('admin.layout.save', $event);
 }