Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function addSectionsToMenu($menu_id = null){
- $this->layout = 'admin';
- $this->set('menu_id', $menu_id);
- $this->set('menu', $this->Widget->Menu->findById($menu_id));
- $this->set('existing_widgets', $this->Widget->findAllByMenuId($menu_id));
- if (!$menu_id && empty($this->data)) {
- $this->Session->setFlash(__('Pick a menu to add to please :)', true));
- }
- if(!empty($data['Widget'])) {
- $saveSuccess = true;
- foreach($data['Widget'] as $widgetData) :
- $this->Widget->create();
- if($this->Widget->saveAll($widgetData)) : $saveSuccess = true; endif;
- endforeach;
- if ($saveSuccess) {
- $this->Session->setFlash(__('The Section(s) has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The Sections could not be saved. Please, try again.', true));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement