Exemplo n.º 1
0
 public function onGetMenuItemTypeInfo()
 {
     $type = Request::input('type');
     return ['menuItemTypeInfo' => MenuItem::getTypeInfo($type)];
 }
Exemplo n.º 2
0
 /**
  * Saves the object to the disk.
  */
 public function save()
 {
     if ($this->itemData !== false) {
         $this->items = MenuItem::initFromArray($this->itemData);
     }
     $contentData = ['name' => $this->name, 'items' => $this->itemData ? $this->itemData : []];
     $dumper = new YamlDumper();
     $this->content = $dumper->dump($contentData, 20, 0, false, true);
     return parent::save();
 }
Exemplo n.º 3
0
 /**
  * Returns the item reference description.
  * @param \RainLab\Pages\Classes\MenuItem $item Specifies the menu item
  * @return string 
  */
 protected function getReferenceDescription($item)
 {
     if ($this->typeListCache === false) {
         $this->typeListCache = $item->getTypeOptions();
     }
     if (!isset($this->typeInfoCache[$item->type])) {
         $this->typeInfoCache[$item->type] = MenuItem::getTypeInfo($item->type);
     }
     if (isset($this->typeInfoCache[$item->type])) {
         $result = $this->typeListCache[$item->type];
         if ($item->type !== 'url') {
             if (isset($this->typeInfoCache[$item->type]['references'])) {
                 $result .= ': ' . $this->findReferenceName($item->reference, $this->typeInfoCache[$item->type]['references']);
             }
         } else {
             $result .= ': ' . $item->url;
         }
     } else {
         $result = trans('Uknown menu item type');
     }
     return $result;
 }