當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。