diff --git a/composer.json b/composer.json index 496df4f..4dfd45a 100644 --- a/composer.json +++ b/composer.json @@ -17,9 +17,8 @@ "twig/twig": "^1.26", "symfony/http-foundation": "~2.8.13|~3.1.6|~3.2", "glavweb/cms-rest-client": "~0.1", - "glavweb/cms-content-block": "~0.3", - "glavweb/cms-composite-object": "~0.1" - + "glavweb/cms-content-block": "~1.0", + "glavweb/cms-composite-object": "~1.0" }, "autoload": { "psr-4": { "Glavweb\\CmsTwigExtension\\": "src/" } diff --git a/src/Extension/CmsTwigExtension.php b/src/Extension/CmsTwigExtension.php index bcb0231..d422e58 100644 --- a/src/Extension/CmsTwigExtension.php +++ b/src/Extension/CmsTwigExtension.php @@ -11,12 +11,11 @@ namespace Glavweb\CmsTwigExtension\Extension; -use Glavweb\CmsContentBlock\Service\OptionService; -use Glavweb\CmsContentBlock\Service\OptionServiceService; +use Glavweb\CmsCompositeObject\Manager\CompositeObjectManager; +use Glavweb\CmsContentBlock\Manager\OptionManager; use Symfony\Component\HttpFoundation\Session\Session; use Glavweb\CmsRestClient\CmsRestClient; -use Glavweb\CmsContentBlock\Service\ContentBlockService; -use Glavweb\CmsCompositeObject\Service\CompositeObjectService; +use Glavweb\CmsContentBlock\Manager\ContentBlockManager; /** * Class CmsTwigExtension @@ -37,19 +36,19 @@ class CmsTwigExtension extends \Twig_Extension private $cmsRestClient; /** - * @var ContentBlockService + * @var ContentBlockManager */ - private $contentBlockService; + private $contentBlockManager; /** - * @var OptionService + * @var OptionManager */ - private $optionService; + private $optionManager; /** - * @var CompositeObjectService + * @var CompositeObjectManager */ - private $compositeObjectService; + private $compositeObjectManager; /** * @var string @@ -76,20 +75,20 @@ class CmsTwigExtension extends \Twig_Extension * * @param Session $session * @param CmsRestClient $cmsRestClient - * @param ContentBlockService $contentBlockService - * @param OptionService $optionService - * @param CompositeObjectService $compositeObjectService + * @param ContentBlockManager $contentBlockManager + * @param OptionManager $optionManager + * @param CompositeObjectManager $compositeObjectManager * @param string $cmsBaseUrl * @param bool $editable * @param bool $markupMode */ - public function __construct(Session $session, CmsRestClient $cmsRestClient, ContentBlockService $contentBlockService, OptionService $optionService, CompositeObjectService $compositeObjectService, $cmsBaseUrl, $apiBaseUrl, $editable = false, $markupMode = false) + public function __construct(Session $session, CmsRestClient $cmsRestClient, ContentBlockManager $contentBlockManager, OptionManager $optionManager, CompositeObjectManager $compositeObjectManager, $cmsBaseUrl, $apiBaseUrl, $editable = false, $markupMode = false) { $this->session = $session; $this->cmsRestClient = $cmsRestClient; - $this->contentBlockService = $contentBlockService; - $this->optionService = $optionService; - $this->compositeObjectService = $compositeObjectService; + $this->contentBlockManager = $contentBlockManager; + $this->optionManager = $optionManager; + $this->compositeObjectManager = $compositeObjectManager; $this->cmsBaseUrl = $cmsBaseUrl; $this->apiBaseUrl = $apiBaseUrl; $this->editable = $editable; @@ -152,9 +151,9 @@ public function content($category, $blockName, $default = null) return $default; } - $contentBlockService = $this->contentBlockService; + $contentBlockManager = $this->contentBlockManager; - return $contentBlockService->getContentBlock($category, $blockName, $default); + return $contentBlockManager->getContentBlock($category, $blockName, $default); } /** @@ -168,10 +167,10 @@ public function editable($category, $blockName) return ''; } - $contentBlockService = $this->contentBlockService; + $contentBlockManager = $this->contentBlockManager; if ($this->isEditable()) { - return $contentBlockService->editable($category, $blockName); + return $contentBlockManager->editable($category, $blockName); } return ''; @@ -189,10 +188,10 @@ public function editableObject($id) return ''; } - $compositeObjectService = $this->compositeObjectService; + $compositeObjectManager = $this->compositeObjectManager; if ($this->isEditable()) { - return $compositeObjectService->editable($id); + return $compositeObjectManager->editable($id); } return ''; @@ -212,9 +211,9 @@ public function option($category, $optionName, $default = null) return $default; } - $optionService = $this->optionService; + $optionManager = $this->optionManager; - return $optionService->getOption($category, $optionName, $default); + return $optionManager->getOption($category, $optionName, $default); } /** @@ -240,7 +239,7 @@ public function isEditable() */ public function getObjects($className) { - return $this->compositeObjectService->getObjectsByClassName($className); + return $this->compositeObjectManager->getObjectsByClassName($className); } /** @@ -263,7 +262,7 @@ public function spaceless($value) public function cmsAsset($resource) { if ($this->markupMode) { - return '/' . $resource; + return $resource; } return $this->cmsBaseUrl . '/' . $resource;