/** * getNewInstanceAction * * @return Response */ public function getNewInstanceAction() { $routeMatch = $this->getEvent()->getRouteMatch(); $pluginType = $routeMatch->getParam('pluginType'); $instanceId = $routeMatch->getParam('instanceId'); $pluginManager = $this->getServiceLocator()->get('Rcm\\Service\\PluginManager'); if ($instanceId < 0) { $instanceConfig = $pluginManager->getDefaultInstanceConfig($pluginType); } else { $instanceConfig = $pluginManager->getInstanceConfig($instanceId); } //Allow plugins to preview with an unsaved instance configuration $instanceConfigPreview = $this->params()->fromPost('previewInstanceConfig'); if ($instanceConfigPreview) { $instanceConfig = array_merge($instanceConfig, $instanceConfigPreview); } $viewData = $pluginManager->getPluginViewData($pluginType, $instanceId, $instanceConfig); $html = $viewData['html']; $headLink = new HeadLink(); foreach ($viewData['css'] as $css) { $cssInfo = unserialize($css); $headLink->append($cssInfo); } $headScript = new HeadScript(); foreach ($viewData['js'] as $js) { $jsInfo = unserialize($js); $headScript->append($jsInfo); } $html = $headLink->toString() . $headScript->toString() . $html; $response = new Response(); $response->setContent($html); return $response; }
/** * Loading the ExtJs library and CSS in a view */ public function loadLibrary() { $lib = rtrim($this->config['library_path'], '/') . '/'; foreach (array_reverse($this->config['css']) as $css) { $this->headLink->prependStylesheet($lib . $css); } foreach (array_reverse($this->config['js']) as $js) { $this->headScript->prependFile($lib . $js); } }
private function include_css($url_file, $browser = "") { if (file_exists(getcwd() . "/public" . $url_file)) { switch ($browser) { case "IE": $this->_headLink->appendStylesheet($url_file, array("screen", "print"), "IE", null); break; default: $this->_headLink->appendStylesheet($url_file, array("screen", "print")); break; } } }
/** * Initializes the HeadLink element * @return $this */ public function initHeadLink() { $cssPath = $this->options->getCss()->getPath(); $stylesheets = $this->orderByPriority($this->options->getCss()->getStylesheets()); foreach ($stylesheets as $css) { if (isset($css["media"])) { $this->headLink->appendStylesheet($cssPath . "/" . $css["name"], $css["media"], false, array()); } else { $this->headLink->appendStylesheet($cssPath . "/" . $css["name"], 'screen', false, array()); } } return $this; }
/** * {@inheritDoc} * Canonize attribute 'conditional' with 'conditionalStylesheet' */ public function itemToString(stdClass $item) { if (isset($item->conditional)) { $item->conditionalStylesheet = $item->conditional; $item->conditional = null; } return parent::itemToString($item); }
/** * @return HeadLink */ public function headLink() { $this->__initialized__ && $this->__initialized__->__invoke(); if (null === $this->headLink) { $this->headLink = new HeadLink(); $this->headLink->setView($this->view); } return $this->headLink; }
/** * Create HTML link element from data item * * @param stdClass $item data item * * @return string */ public function itemToString(\stdClass $item) { // Normalize href to account for themes, then call the parent class: $relPath = 'css/' . $item->href; $currentTheme = ThemeTools::findContainingTheme($relPath); if (!empty($currentTheme)) { $urlHelper = $this->getView()->plugin('url'); $item->href = $urlHelper('home') . "themes/{$currentTheme}/" . $relPath; } return parent::itemToString($item); }
/** * Create HTML link element from data item * * @param \stdClass $item data item * * @return string */ public function itemToString(\stdClass $item) { // Normalize href to account for themes, then call the parent class: $relPath = 'css/' . $item->href; $details = $this->themeInfo->findContainingTheme($relPath, ThemeInfo::RETURN_ALL_DETAILS); if (!empty($details)) { $urlHelper = $this->getView()->plugin('url'); $url = $urlHelper('home') . "themes/{$details['theme']}/" . $relPath; $url .= strstr($url, '?') ? '&_=' : '?_='; $url .= filemtime($details['path']); $item->href = $url; } return parent::itemToString($item); }
/** * Render link elements as string * * @param string|int $indent * @return string */ public function toString($indent = null) { $this->preToString(); return parent::toString($indent); }
public function __invoke(array $attributes = null, $placement = Placeholder\Container\AbstractContainer::APPEND) { return parent::__invoke($attributes, $placement); }
public function itemToString(\stdClass $item) { if (isset($item->href) && !$this->startsWith($item->href, '//') && !$this->startsWith($item->href, 'http') && !$this->startsWith($item->href, 'ftp')) { if ($this->inline === true) { return $this->itemToInlineCssString($item); } else { $item->href = $this->view->mediapath($item->href); } } return parent::itemToString($item); }
/** * headLink() - View Helper Method * * Returns current object instance. Optionally, allows passing array of * values to build link. * * @param array $attributes * @param string $placement * * @return HeadLink */ public function __invoke(array $attributes = null, $placement = AbstractContainer::APPEND) { $this->setRcmDefaultLink(); return parent::__invoke($attributes, $placement); }
/** * Overload method access. * * @param mixed $method * @param mixed $args * * @throws Exception\BadMethodCallException * * @return mixed */ public function __call($method, $args) { if ($this->basePath == null && method_exists($this->view, 'plugin')) { $this->basePath = $this->view->plugin('basepath')->__invoke(); } $ret = false; if (preg_match('/^(?P<action>set|(ap|pre)pend)(?P<type>Bootstrap|FontAwesome)$/', $method, $matches)) { $ret = $this->callWithCdn($matches, $args); } elseif (preg_match('/^(?P<action>set|(ap|pre)pend)(?P<type>Chosen|ChosenBootstrap)$/', $method, $matches)) { $ret = $this->callWithoutCdn($matches, $args); } return $ret !== false ? $ret : parent::__call($method, $args); }
public function offsetSet($index, $value) { $value->href = $this->appendCdn($value->href); parent::offsetSet($index, $value); }
/** * @issue ZF-10345 */ public function testIdAttributeIsSupported() { $this->helper->appendStylesheet(array('href' => '/bar/baz', 'id' => 'foo')); $this->assertContains('id="foo"', $this->helper->toString()); }