示例#1
0
 /**
  * Prefixes a given stylesheet path with a base URL for stylesheets
  * before rendering the markup for a link element to include it.
  *
  * @param stdClass $item Object representing the stylesheet to render
  *
  * @return string Markup for the rendered link element
  */
 public function itemToString(stdClass $item)
 {
     if ($this->_isAdminPage(Zend_Controller_Front::getInstance()->getRequest())) {
         $item->href = WEB_CSS . ltrim($item->href, '/');
     }
     return parent::itemToString($item);
 }
 /**
  * Create HTML link element from data item
  *
  * @param  \stdClass $item
  * @return string
  */
 public function itemToString(\stdClass $item)
 {
     $attributes = (array) $item;
     if (isset($attributes['type']) && ($attributes['type'] == 'text/css' || $attributes['type'] == 'text/less')) {
         // This is a stylesheet, consider extension and compile .less to .css
         if ($attributes['type'] == 'text/less' || \MUtil_String::endsWith($attributes['href'], '.less', true)) {
             $this->compile($this->view, $attributes['href'], false);
             // Modify object, not the derived array
             $item->type = 'text/css';
             $item->href = substr($attributes['href'], 0, -4) . 'css';
         }
     }
     $version = $this->view->currentVersion;
     if (property_exists($item, 'href')) {
         $item->href = $item->href . '?' . $version;
     }
     return \Zend_View_Helper_HeadLink::itemToString($item);
 }
示例#3
0
 /**
  * Create HTML link element from data item
  *
  * @param  \stdClass $item
  * @return string
  */
 public function itemToString(\stdClass $item)
 {
     $attributes = (array) $item;
     if (isset($attributes['type']) && ($attributes['type'] == 'text/css' || $attributes['type'] == 'text/less')) {
         // This is a stylesheet, consider extension and compile .less to .css
         if ($attributes['type'] == 'text/less' || \MUtil_String::endsWith($attributes['href'], '.less', true)) {
             $this->compile($this->view, $attributes['href'], false);
             // Modify object, not the derived array
             $item->type = 'text/css';
             $item->href = substr($attributes['href'], 0, -4) . 'css';
         }
     }
     return parent::itemToString($item);
 }