コード例 #1
0
ファイル: Links.php プロジェクト: sunel/laravel-layout
 /**
  * Add link to the list.
  *
  * @param string       $label
  * @param string       $url
  * @param string       $title
  * @param bool         $prepare
  * @param array        $urlParams
  * @param int          $position
  * @param string|array $liParams
  * @param string|array $aParams
  *
  * @return \Layout\Page\Html\Links
  */
 public function addLink($label, $url = '', $title = '', $prepare = false, $urlParams = [], $position = null, $liParams = null, $aParams = null)
 {
     if (is_null($label) || false === $label) {
         return $this;
     }
     $link = new Object();
     $link->setData(['label' => $label, 'url' => $prepare ? $this->getUrl($url, is_array($urlParams) ? $urlParams : []) : $url, 'title' => $title, 'li_params' => $this->_prepareParams($liParams), 'a_params' => $this->_prepareParams($aParams)]);
     $this->_addIntoPosition($link, $position);
     return $this;
 }
コード例 #2
0
ファイル: Block.php プロジェクト: sunel/laravel-layout
 /**
  * Produce and return block's html output.
  *
  * It is a final method, but you can override _toHtml() method in descendants if needed.
  *
  * @return string
  */
 public final function toHtml()
 {
     app('events')->fire('block.to.html.before', ['block' => $this]);
     $html = $this->_loadCache();
     if ($html === false) {
         $this->_beforeToHtml();
         $html = $this->_toHtml();
         $this->_saveCache($html);
     }
     $html = $this->_afterToHtml($html);
     /*
      * Use single transport object instance for all blocks
      */
     if (self::$_transportObject === null) {
         self::$_transportObject = new Object();
     }
     self::$_transportObject->setHtml($html);
     app('events')->fire('block.to.html.after', ['block' => $this, 'transport' => self::$_transportObject]);
     $html = self::$_transportObject->getHtml();
     return $html;
 }