Link to another view.

<code>
// Look up view from another view in the same place.
Theme::symlink('another')
</code>

@param  string $theme
@return string
198288
public function symlink($theme)
    {
        $trace = debug_backtrace();

        if (! isset($trace[1])) return;

        $link = str_replace($this->getThemeName(), $theme, array_get($trace[1], 'file'));

        extract($this->arguments);
        extract($this->view->getShared());

        return require($link);
    }
1071535
public static function forTheme($theme)
    {
        $dirName = $theme->getDirName();
        if ($themeData = array_get(self::$instances, $dirName)) {
            return $themeData;
        }

        try {
            $themeData = self::firstOrCreate(['theme' => $dirName]);
        }
        catch (Exception $ex) {
            // Database failed
            $themeData = new self(['theme' => $dirName]);
        }

        return self::$instances[$dirName] = $themeData;
    }
1345833
public function createViewLink($title, $options = [])
    {
        return $this->Html->link(
            $title,
            ['action' => 'view', $this->getContext()->get($this->getViewVar('primaryKey'))],
            $options
        );
    }
260158
private function findTemplatesInThemes(BundleInterface $bundle, $theme)
    {
        $templates = $this->findTemplatesInFolder($bundle->getPath().'/Resources/themes/'.$theme);
        $name = $bundle->getName();

        foreach ($templates as $i => $template) {
            $templates[$i] = $template->set('bundle', $name);
        }

        return $templates;
    }
77251
public function locateResource($resourcePath, ThemeInterface $theme)
    {
        $this->assertResourcePathIsValid($resourcePath);

        $bundleName = $this->getBundleNameFromResourcePath($resourcePath);
        $resourceName = $this->getResourceNameFromResourcePath($resourcePath);

        $bundles = $this->kernel->getBundle($bundleName, false);
        foreach ($bundles as $bundle) {
            $path = sprintf('%s/%s/%s', $theme->getPath(), $bundle->getName(), $resourceName);

            if ($this->filesystem->exists($path)) {
                return $path;
            }
        }

        throw new ResourceNotFoundException($resourcePath, $theme);
    }
448202
public function theme($theme = null)
    {
        deprecationWarning(
            'Email::theme() is deprecated. Use $email->viewBuilder()->getTheme()/setTheme() instead.'
        );

        if ($theme === null) {
            return $this->getTheme();
        }

        return $this->setTheme($theme);
    }
1002100
public function findThemeAsset($theme, $asset)
    {
        if (! empty($theme)) {
            $Folders = $this->engine->getFolders();

            if ($Folders->exists($theme)) {
                $this->Folder = $Folders->get($theme);
                $folderPath = rtrim($this->Folder->getPath(), '/');

                $folderPath = $this->removeViewFromPath($folderPath);

                if (file_exists($folderPath . DS . $asset)) {
                    $this->createSymlink($folderPath);

                    return '/' . $this->assetDir . '/' . $this->asset['asset'];
                }
            }
        }
        return false;
    }
942155
public function link($slug)
    {
        $link = Link::where('slug', $slug)->first();

        if (! $link) {
            abort(404, 'The link was not found');
        }

        return view('links::link', ['link' => $link]);
    }
96904
public function viewLink()
    {
        $link   = null;
        $locale = $this->lang();
        if ($locale !== null) {
            $translator = $this->translator();
            $origLocale = $translator->getLocale();
            $translator->setLocale($this->lang());
            $link = $this->renderTemplate('{{# withBaseUrl }}{{ obj.url }}{{/ withBaseUrl }}');
            $translator->setLocale($origLocale);
        }

        return $link;
    }
763611
public function symlink($target, $link)
    {
        if (!file_exists($target)) {
            throw new \InvalidArgumentException('Target not found: ' . $target);
        }
        if ($this->relative) {
            $target = $this->makePathRelative($target, dirname($link));
        }
        $this->fs->symlink($target, $link, $this->copyOnWindows);
    }
653804
protected function addRegisteredLocation($theme, $parent)
    {
        if (! is_null($parent)) {
            $parentLocation = $this->path('resources/views');
            app('view.finder')->prependLocation($parentLocation);
        }

        $themeLocation = $this->path('resources/views');
        app('view.finder')->prependLocation($themeLocation);
    }
1102578
static function setCurrent($theme = null) {
        //удалить все невостребованные классы тем оформления
        foreach(self::getThemes() as $t) {
            \LaraPage::body()->removeClass(self::getClassTheme($t));
        }
        //добавить класс текущей темы оформления
        \LaraPage::body()->addClass(self::getClassTheme($theme));
        self::$current = $theme;
        \Twig::addGlobal('current_theme', $theme);
    }
535261
public function getSymlink($bucket, $symlink)
    {
        $this->precheckCommon($bucket, $symlink, $options);

        $options[self::OSS_BUCKET] = $bucket;
        $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
        $options[self::OSS_OBJECT] = $symlink;
        $options[self::OSS_SUB_RESOURCE] = self::OSS_SYMLINK;

        $response = $this->auth($options);
        $result = new SymlinkResult($response);
        return $result->getData();
    }
1280567
protected function secondaryTheme($theme=null) {
        
        if($theme) {
            $this->origin = $this->container->getThemeActivated();
            $this->container->setThemeActivated($theme);
        }
        
    }
270150
public function getUrl($path)
    {
        if (isset($this->bundleDir)) {
            $path = '/' . $this->bundleDir . '/' . self::THEMES_FOLDER . '/' . ltrim($path, '/');
        }

        return parent::getUrl($path);
    }
980865
public function processSymlink(Symlink $symlink): bool
    {
        if ($symlink->isForceCreate() && $this->isToUnlink($symlink->getLink())) {
            try {
                if (\is_dir($symlink->getLink())) {
                    $result = $this->filesystem->removeDirectory($symlink->getLink());
                } else {
                    $result = $this->filesystem->remove($symlink->getLink());
                }
                if (!$result) {
                    throw new RuntimeException('Unknown error');
                }
            } catch (\Exception $exception) {
                throw new RuntimeException(sprintf(
                    'Cant unlink %s: %s',
                    $symlink->getLink(),
                    $exception->getMessage()
                ));
            }
        }

        if ($this->isToUnlink($symlink->getLink())) {
            throw new LinkDirectoryError('Link ' . $symlink->getLink() . ' already exists');
        }

        if ($symlink->isAbsolutePath()) {
            return @symlink($symlink->getTarget(), $symlink->getLink());
        }
        return $this->filesystem->relativeSymlink($symlink->getTarget(), $symlink->getLink());
    }
1109714
protected function getThemeBaseUrl(?Theme $theme = null) : string
    {
        $theme = $theme ?? $this->getTheme();

        if (isset($this->webPaths[$theme->getKey()])) {
            return $this->webPaths[$theme->getKey()];
        }

        return $this->webPaths[$theme->getKey()] = $this->url->make(new UrlSettings([
            'domain'        => $theme->getWebPath(),
            'path'          => $this->directory,
        ]));
    }