当前位置: 首页>>代码示例>>PHP>>正文


PHP ThemeInterface::getPath方法代码示例

本文整理汇总了PHP中Sylius\Bundle\ThemeBundle\Model\ThemeInterface::getPath方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemeInterface::getPath方法的具体用法?PHP ThemeInterface::getPath怎么用?PHP ThemeInterface::getPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sylius\Bundle\ThemeBundle\Model\ThemeInterface的用法示例。


在下文中一共展示了ThemeInterface::getPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getApplicationPaths

 /**
  * @param string         $resourceName
  * @param ThemeInterface $theme
  *
  * @return array
  */
 protected function getApplicationPaths($resourceName, ThemeInterface $theme)
 {
     $paths = [sprintf('%s/%s', $theme->getPath(), $resourceName)];
     if ($this->deviceDetection->getType() !== null) {
         $paths[] = sprintf('%s/%s/%s', $theme->getPath(), $this->deviceDetection->getType(), $resourceName);
         krsort($paths);
     }
     return $paths;
 }
开发者ID:superdesk,项目名称:web-publisher,代码行数:15,代码来源:ApplicationResourceLocator.php

示例2:

 function it_throws_an_exception_if_settings_schema_does_not_exist(ThemeInterface $theme)
 {
     $theme->getTitle()->willReturn('Candy shop');
     $theme->getName()->willReturn('candy/shop');
     $theme->getPath()->willReturn($this->vfsStream->url());
     $this->shouldThrow(new \InvalidArgumentException(sprintf('Could not find settings schema of theme "Candy shop" (candy/shop) in file "%s"', $this->vfsStream->url() . '/Settings.php')))->during('getSchema', [$theme]);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:7,代码来源:ThemeSettingsSchemaProviderSpec.php

示例3: getBundlePaths

 /**
  * @param string         $resourcePath
  * @param ThemeInterface $theme
  */
 protected function getBundlePaths($resourcePath, ThemeInterface $theme)
 {
     $bundleName = $this->getBundleNameFromResourcePath($resourcePath);
     $resourceName = $this->getResourceNameFromResourcePath($resourcePath);
     $bundles = $this->kernel->getBundle($bundleName, false);
     $paths = [];
     if (is_array($bundles)) {
         foreach ($bundles as $bundle) {
             if ($this->deviceDetection->getType() !== null) {
                 $paths[] = sprintf('%s/%s/%s/%s', $theme->getPath(), $this->deviceDetection->getType(), $bundle->getName(), $resourceName);
             }
             $paths[] = sprintf('%s/%s/%s', $theme->getPath(), $bundle->getName(), $resourceName);
         }
     }
     return $paths;
 }
开发者ID:superdesk,项目名称:web-publisher,代码行数:20,代码来源:BundleResourceLocator.php

示例4:

 function it_throws_an_exception_if_resource_can_not_be_located(Filesystem $filesystem, ThemeInterface $theme)
 {
     $theme->getName()->willReturn('theme/name');
     $theme->getPath()->willReturn('/theme/path');
     $filesystem->exists('/theme/path/resource')->willReturn(false);
     $this->shouldThrow(ResourceNotFoundException::class)->during('locateResource', ['resource', $theme]);
 }
开发者ID:Sylius,项目名称:SyliusThemeBundle,代码行数:7,代码来源:ApplicationResourceLocatorSpec.php

示例5: locateResource

 /**
  * {@inheritdoc}
  */
 public function locateResource($resourceName, ThemeInterface $theme)
 {
     $path = sprintf('%s/%s', $theme->getPath(), $resourceName);
     if (!$this->filesystem->exists($path)) {
         throw new ResourceNotFoundException($resourceName, $theme);
     }
     return $path;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:11,代码来源:ApplicationResourceLocator.php

示例6: it_should_return_global_variables

 public function it_should_return_global_variables(ThemeInterface $theme, ThemeContextInterface $themeContext)
 {
     $theme->getName()->willReturn('swp/theme-one');
     $theme->getPath()->willReturn('/path/to/theme/');
     $themeContext->getTheme()->shouldBeCalled()->willReturn($theme);
     $globals = ['theme' => $theme];
     $this->getGlobals()->shouldReturn($globals);
 }
开发者ID:superdesk,项目名称:web-publisher,代码行数:8,代码来源:CoreExtensionSpec.php

示例7:

 function it_returns_an_array_of_translation_resources_paths(FinderFactoryInterface $finderFactory, Finder $finder, ThemeInterface $theme)
 {
     $finderFactory->create()->willReturn($finder);
     $theme->getPath()->willReturn('/theme');
     $finder->in('/theme')->shouldBeCalled()->willReturn($finder);
     $finder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($finder);
     $finder->getIterator()->willReturn(new \ArrayIterator(['/theme/messages.en.yml', '/theme/translations/messages.en.yml', '/theme/translations/messages.en.yml.jpg', '/theme/translations/messages.yml', '/theme/AcmeBundle/translations/messages.pl_PL.yml']));
     $this->findTranslationFiles($theme)->shouldReturn(['/theme/translations/messages.en.yml', '/theme/AcmeBundle/translations/messages.pl_PL.yml']);
 }
开发者ID:sidibea,项目名称:Sylius,代码行数:9,代码来源:TranslationFilesFinderSpec.php

示例8: getScreenshotPath

 /**
  * @param ThemeInterface $theme
  * @param int $screenshotNumber
  *
  * @return string
  */
 private function getScreenshotPath(ThemeInterface $theme, $screenshotNumber)
 {
     $screenshots = $theme->getScreenshots();
     if (!isset($screenshots[$screenshotNumber])) {
         throw new NotFoundHttpException(sprintf('Theme "%s" does not have screenshot #%d', $theme->getTitle(), $screenshotNumber));
     }
     $screenshotRelativePath = $screenshots[$screenshotNumber];
     return rtrim($theme->getPath(), \DIRECTORY_SEPARATOR) . \DIRECTORY_SEPARATOR . $screenshotRelativePath;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:15,代码来源:ThemeScreenshotController.php

示例9:

 function it_throws_an_exception_if_resource_can_not_be_located(Filesystem $filesystem, KernelInterface $kernel, ThemeInterface $theme, BundleInterface $childBundle, BundleInterface $parentBundle)
 {
     $kernel->getBundle('ParentBundle', false)->willReturn([$childBundle, $parentBundle]);
     $childBundle->getName()->willReturn('ChildBundle');
     $parentBundle->getName()->willReturn('ParentBundle');
     $theme->getName()->willReturn('theme/name');
     $theme->getPath()->willReturn('/theme/path');
     $filesystem->exists('/theme/path/ChildBundle/views/index.html.twig')->shouldBeCalled()->willReturn(false);
     $filesystem->exists('/theme/path/ParentBundle/views/index.html.twig')->shouldBeCalled()->willReturn(false);
     $this->shouldThrow(ResourceNotFoundException::class)->during('locateResource', ['@ParentBundle/Resources/views/index.html.twig', $theme]);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:11,代码来源:BundleResourceLocatorSpec.php

示例10: getSchema

 /**
  * {@inheritdoc}
  */
 public function getSchema(ThemeInterface $theme)
 {
     $schemaPath = sprintf('%s/Settings.php', $theme->getPath());
     if (!file_exists($schemaPath)) {
         throw new \InvalidArgumentException(sprintf('Could not find settings schema of theme "%s" (%s) in file "%s"', $theme->getTitle(), $theme->getName(), $schemaPath));
     }
     $schema = (require $schemaPath);
     if (!$schema instanceof SchemaInterface) {
         throw new \InvalidArgumentException(sprintf('File "%s" must return an instance of "%s"', $schemaPath, SchemaInterface::class));
     }
     return $schema;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:15,代码来源:ThemeSettingsSchemaProvider.php

示例11:

 function it_finds_translation_files_and_adds_them_to_translator(ContainerBuilder $containerBuilder, ThemeRepositoryInterface $themeRepository, ThemeInterface $firstTheme, ThemeInterface $secondTheme, Definition $translatorDefinition)
 {
     $containerBuilder->get("sylius.theme.repository")->shouldBeCalled()->willReturn($themeRepository);
     $themeRepository->findAll()->shouldBeCalled()->willReturn([$firstTheme, $secondTheme]);
     $firstTheme->getPath()->shouldBeCalled()->willReturn($this->getFirstThemePath());
     $secondTheme->getPath()->shouldBeCalled()->willReturn($this->getSecondThemePath());
     $containerBuilder->getParameter('kernel.bundles')->shouldBeCalled()->willReturn(["SampleBundle" => "/Foo/Bar"]);
     $containerBuilder->addResource(Argument::type('Symfony\\Component\\Config\\Resource\\DirectoryResource'))->shouldBeCalled();
     $containerBuilder->findDefinition('translator.default')->shouldBeCalled()->willReturn($translatorDefinition);
     $translatorDefinition->getArgument(3)->shouldBeCalled()->willReturn(["resource_files" => ["en" => ["/lorem/ipsum/messages.en.yml"]]]);
     $translatorDefinition->replaceArgument(3, ["resource_files" => ["en" => ["/lorem/ipsum/messages.en.yml", $this->getFirstThemePath() . '/SampleBundle/translations/messages.en.yml', $this->getFirstThemePath() . '/translations/messages.en.yml', $this->getSecondThemePath() . '/translations/messages.en.yml']]])->shouldBeCalled();
     $this->process($containerBuilder);
 }
开发者ID:liverbool,项目名称:dos-theme-bundle,代码行数:13,代码来源:ThemeTranslationCompilerPassSpec.php

示例12: locateResource

 /**
  * {@inheritdoc}
  *
  * @param string $resourcePath Eg. "@AcmeBundle/Resources/views/template.html.twig"
  */
 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);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:19,代码来源:BundleResourceLocator.php

示例13: iShouldNotSeeThemedHomepage

 /**
  * @Then I should not see a homepage from :theme theme
  */
 public function iShouldNotSeeThemedHomepage(ThemeInterface $theme)
 {
     $content = file_get_contents(rtrim($theme->getPath(), '/') . '/SyliusShopBundle/views/Homepage/index.html.twig');
     Assert::notSame($this->homePage->getContents(), $content);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:8,代码来源:ThemeContext.php

示例14: iShouldNotSeeThemedHomepage

 /**
  * @Then I should not see a homepage from :theme theme
  */
 public function iShouldNotSeeThemedHomepage(ThemeInterface $theme)
 {
     $content = file_get_contents(rtrim($theme->getPath(), '/') . '/SyliusWebBundle/views/Frontend/Homepage/main.html.twig');
     expect($this->homePage->getContents())->notToBe($content);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:8,代码来源:ThemeContext.php

示例15: themeChangesHomepageTemplateContents

 /**
  * @Given /^(this theme) changes homepage template contents to "([^"]+)"$/
  */
 public function themeChangesHomepageTemplateContents(ThemeInterface $theme, $contents)
 {
     $file = rtrim($theme->getPath(), '/') . '/SyliusShopBundle/views/Homepage/index.html.twig';
     $dir = dirname($file);
     if (!file_exists($dir)) {
         mkdir($dir, 0777, true);
     }
     file_put_contents($file, $contents);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:12,代码来源:ThemeContext.php


注:本文中的Sylius\Bundle\ThemeBundle\Model\ThemeInterface::getPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。