コード例 #1
0
 public function url($action = null)
 {
     if (empty($action)) {
         return parent::url();
     } else {
         if ($action == 'preview') {
             if ($previewSetting = $this->blueprint()->preview()) {
                 switch ($previewSetting) {
                     case 'parent':
                         return $this->parent() ? $this->parent()->url() : $this->url();
                         break;
                     case 'first-child':
                         return $this->children()->first() ? $this->children()->first()->url() : false;
                         break;
                     case 'last-child':
                         return $this->children()->last() ? $this->children()->last()->url() : false;
                         break;
                     default:
                         return $this->url();
                         break;
                 }
             } else {
                 return false;
             }
         } else {
             if ($this->site->multilang() and $lang = $this->site->language($action)) {
                 return parent::url($lang->code());
             } else {
                 return panel()->urls()->index() . '/' . $this->uri($action);
             }
         }
     }
 }