public function admin_edit($id = null, $query = array())
 {
     $this->GlobalLayout->GlobalContent->hasField('id');
     parent::admin_edit($id, $query);
     $plugins = $this->GlobalLayout->getPlugins();
     $models = $this->GlobalLayout->getModels($this->request->data['GlobalLayout']['plugin']);
     $this->set(compact('plugins', 'models'));
 }
 public function admin_edit($id = null, $query = null)
 {
     parent::admin_edit($id, $query);
     $groups = array(0 => __('Public')) + $this->GlobalContent->Group->find('list');
     $layouts = $this->GlobalContent->GlobalLayout->find('list', array('conditions' => array('GlobalLayout.model' => $this->request->data['GlobalContent']['model'])));
     if (empty($layouts)) {
         $this->notice(__('Please create a layout for this content type'), array('level' => 'warning', 'redirect' => array('controller' => 'global_layouts', 'action' => 'add')));
     }
     $this->set(compact('groups', 'layouts'));
 }
 public function admin_delete($id = null)
 {
     if (!$id) {
         $this->notice('invalid');
     }
     $count = $this->GlobalCategory->find('count', array('conditions' => array('Category.parent_id' => $id)));
     if ($count > 0) {
         $this->notice(sprintf(__('That %s has sub-categories'), $this->prettyModelName), array('level' => 'warning', 'redirect' => true));
     }
     $category = $this->GlobalCategory->read(null, $id);
     if (!empty($category['Content'])) {
         $this->notice(sprintf(__('That %s has content items, remove them before continuing'), $this->prettyModelName), array('level' => 'warning', 'redirect' => true));
     }
     return parent::admin_delete($id);
 }