Adds an asset to the view.

@param View   $view the View object
@param string $file the asset file name
@param string $type the asset file type (css or js)
@param string $class the class name of the AssetBundle
519989
protected function addAsset($view, $file, $type, $class)
    {
        if ($type == 'css' || $type == 'js') {
            $asset = $view->getAssetManager();
            $bundle = $asset->bundles[$class];
            if ($type == 'css') {
                $bundle->css[] = $file;
            } else {
                $bundle->js[] = $file;
            }

            $asset->bundles[$class] = $bundle;
            $view->setAssetManager($asset);
        }
    }
597163
public function addFile($class, $file)
    {
        if (!is_file($file)) {
            throw new MappingException(sprintf('The mapping file %s does not exist', $file));
        }

        if (!is_readable($file)) {
            throw new MappingException(sprintf('The mapping file %s is not readable', $file));
        }
        $this->files[$class] = $file;

        return $this;
    }
207105
protected function addClassEvent($view, $class, $prefix)
    {
        $name = $prefix.$view;

        // When registering a class based view "composer", we will simply resolve the
        // classes from the application IoC container then call the compose method
        // on the instance. This allows for convenient, testable view composers.
        $callback = $this->buildClassEventCallback(
            $class, $prefix
        );

        $this->addEventListener($name, $callback);

        return $callback;
    }
1078976
public function show($file, $data)
    {
        $this->setTemplate($file);
        //
        $this->assign($data);
        //
        $this->store($this->compile());
        //
        $this->display();
    }
1262466
public function composeIndex(View $view)
    {
        $this->composeWithTitle($view);
        $this->composeWithLayout($view);
        $this->composeWithAllRouteNames($view);
        $this->composeWithRequiredFields($view);
        $this->composeWithValidationRules($view);
        $this->composeWithPartialsLocation($view);
        $this->composeWithResourceLocation($view);
    }
892558
public function registerAssetFiles($view)
    {
        parent::registerAssetFiles($view);

        $options =
        [
            'notify' =>
            [
                'imageError'    => \Yii::$app->getAssetManager()->getAssetUrl($this, 'js/components/notify/images/error.png'),
                'imageFail'     => \Yii::$app->getAssetManager()->getAssetUrl($this, 'js/components/notify/images/fail.gif'),
                'imageInfo'     => \Yii::$app->getAssetManager()->getAssetUrl($this, 'js/components/notify/images/info.png'),
                'imageSuccess'  => \Yii::$app->getAssetManager()->getAssetUrl($this, 'js/components/notify/images/success.png'),
                'imageWarning'  => \Yii::$app->getAssetManager()->getAssetUrl($this, 'js/components/notify/images/warning.png')
            ]
        ];

        $options = Json::encode($options);

        $view->registerJs(<<<JS
        (function(sx, $, _)
        {
            sx.Config.merge({$options});
        })(sx, sx.$, sx._);
JS
);
    }
637024
public function addView($view, $data = null)
    {
        if(!is_object($view))
            $view = new \erdiko\core\View($view, $data);
        if($data != null)
            $view->setData($data);
        
        $this->appendContent($view->toHtml());
    }
1349487
public function registerAssetFiles($view)
    {
        if ($this->language !== null) {
            $this->js[] = 'langs/' . $this->language . '.min.js';
        }

        if (!empty($this->plugins)) {
            foreach ($this->plugins as $plugin => $properties) {
                if (is_string($properties)) {
                    $plugin = $properties;
                }

                if ($plugin === 'colors') {
                    $this->css[] = 'plugins/' . $plugin . '/ui/trumbowyg.' . $plugin . '.css';
                }

                $this->js[] = 'plugins/' . $plugin . '/trumbowyg.' . $plugin . '.js';
            }
        }

        parent::registerAssetFiles($view);
    }
1073401
public function resolve($type, $file, $scope = null, $asFileInfo = false)
    {
        $assetPath = new AssetPath($file, $scope);
        $result = $this->resolveThemeFile($type, $assetPath->getPath(), $assetPath->getScope(), $asFileInfo);

        if (($result === false) && $this->fallback) {
            $result = $this->fallback->resolve($type, $assetPath, null, $asFileInfo);
        }

        return $result;
    }
252357
protected function registerAssets($files)
    {
        foreach ($files as $type => $_files) {
            if ($type == 'script') {
                foreach ($_files as $file) {
                    $this->view->registerJsFile($this->assetUrl . $file);
                }
            } else {
                foreach ($_files as $file) {
                    $this->view->registerCssFile($this->assetUrl . $file);
                }
            }
        }
    }
300841
public function render($file = null)
    {
        if (null !== $file)
        {
            $this->setFilename($file);
        }

        if (empty($this->_file))
        {
            throw new ViewException('You must set the file to use within your view before rendering');
        }

        return $this->capture($this->_file, $this->_data);
    }
13784
public function addObject(AssetObjectInterface $aoi)
    {
        // Store f
        if ($aoi->getType() == 'file') {
            
            $dt = debug_backtrace();
            
            self::$files_used[self::$filecounter . '-' . $dt[1]['function']] = $aoi->getContent();
            self::$filecounter ++;
        }
        
        $this->objects[] = $aoi;
    }
315476
public function view($_type = null, $id = null)
    {
        // setting up an event for the view
        $_event = new Event('Controller.PostTypes.beforeView.' . $this->_type, $this, [
            'id' => $id,
        ]);
        $this->eventManager()->dispatch($_event);

        $type = $this->Model->get($id, [
            'contain' => $this->Settings['contain']
        ]);
        $this->set('type', $type);

        // setting up an event for the view
        $_event = new Event('Controller.PostTypes.afterView.' . $this->_type, $this, [
            'id' => $id,
        ]);
        $this->eventManager()->dispatch($_event);

        if (!$this->Settings['views']['view']) {
            $this->render(Configure::read('PostTypes.AdminPostTypeViews.view'));
            return;
        }

        $this->render($this->Settings['views']['view']);
    }
357959
public static function registerAsset($alias, $view)
    {
        $module = static::instance();
        if (!empty($module)) {
            $class = $module->getAssetClassname($alias);
            return $class::register($view);
        }
    }
604257
protected function _render($type) {
		// @todo Replace the `AssetCompress` check by a `Reveal` rule.
		if (in_array($type, array('js', 'css')) && CakePlugin::loaded('AssetCompress') && isset($this->_View->AssetCompress)) {
			foreach ($this->{$type} as $path => $args) {
				$targets = $this->_View->AssetCompress->config()->targets($type);
				$exists = false;
				foreach ($targets as $target) {
					$files = $this->_View->AssetCompress->config()->files($target);
					if (in_array($this->_addExt($path, $type), $files) || in_array($path, $files)) {
						$exists = true;
						break;
					}
				}
				$args = array_merge(Hash::normalize(array('path', 'rel', 'options')), compact('path') + $args);

				if (!$exists) {
					if ('js' == $type) {
						$this->_View->Html->script($path, (array) $args['options']);
					} else {
						$this->_View->Html->css($path, $args['rel'], (array) $args['options']);
					}
					continue;
				}

				$haystack = $this->_View->fetch($args['options']['block']);
				$target = str_replace(array('.css', '.js'), array('', ''), $target);
				$needle = DS . 'assets' . DS . $target;
				if (strpos($haystack, $needle) === false) {
					$method = $type;
					if ('js' == $method) {
						$method = 'script';
					}
					$this->_View->AssetCompress->{$method}($target, (array) $args['options']);
				}
			}
			return;
		}

		foreach ($this->{$type} as $path => $args) {
			extract($args);

			switch ($type) {

				case 'css':
					if (!isset($haystack)) {
						$haystack = $this->_View->fetch('css');
					}

					$needle = $this->_View->Html->css($path, $rel, $options);
					if (strpos($haystack, $needle) === false) {
						$this->_View->prepend('css', $needle);
					}
				break;

				case 'js':
					$this->_View->Html->script($path, $options);
				break;

				case 'scriptBlock':
					$this->_View->Html->scriptBlock($script, $options);
				break;

				default:
			}

		}
	}
919191
public function includeFunc( View $view)
	{
		if( $this->isFunc() )
		{
			Helper::includeFile( $this->getFuncFilePath(), ["view" => $view], false, true );
		}
		return $this;
	}
1057382
protected function viewContent($type, $view)
    {
        $ext = pathinfo($view, PATHINFO_EXTENSION);
        $view = ($ext === '') ? $view.'.php' : $view;
        foreach ($this->paths as $path) {
            $path .= $type . DIRECTORY_SEPARATOR;
            if ($this->context()
                &&
                file_exists($path . trim($this->context(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $view)
            ) {
                $viewPath = $path . trim($this->context(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $view;
                break;
            }
            if (file_exists($path . $view)) {
                $viewPath = $path . $view;
                break;
            }
        }
        if (!isset($viewPath)) {
            throw new \RuntimeException('Unable to find the ' . $view);
        }
        ob_start();
        include($viewPath);
        $content = ob_get_contents();
        ob_end_clean();
        return $content;
    }