Exemplo n.º 1
0
 /**
  * Adds backend layouts to the given backend layout collection.
  * The default backend layout ('default_default') is not added
  * since it's the default fallback if nothing is specified.
  *
  * @param DataProviderContext $dataProviderContext
  * @param BackendLayoutCollection $backendLayoutCollection
  * @return void
  */
 public function addBackendLayouts(DataProviderContext $dataProviderContext, BackendLayoutCollection $backendLayoutCollection)
 {
     $layoutData = $this->getLayoutData($dataProviderContext->getFieldName(), $dataProviderContext->getPageTsConfig(), $dataProviderContext->getPageId());
     foreach ($layoutData as $data) {
         $backendLayout = $this->createBackendLayout($data);
         $backendLayoutCollection->add($backendLayout);
     }
 }
 /**
  * Adds backend layouts to the given backend layout collection.
  *
  * @param DataProviderContext $dataProviderContext
  * @param BackendLayoutCollection $backendLayoutCollection
  * @return void
  */
 public function addBackendLayouts(DataProviderContext $dataProviderContext, BackendLayoutCollection $backendLayoutCollection)
 {
     $pageUid = $dataProviderContext->getPageId();
     $config = $this->getBackendLayoutConfiguration($pageUid);
     $configString = $this->encodeTypoScriptArray($config);
     $backendLayout = new BackendLayout('fluidpages', 'Fluidpages', $configString);
     $backendLayoutCollection->add($backendLayout);
 }
 /**
  * @return void
  */
 public function testAddBackendLayouts()
 {
     $instance = $this->getMock('FluidTYPO3\\Fluidpages\\Backend\\BackendLayoutDataProvider', array('getBackendLayoutConfiguration', 'encodeTypoScriptArray'));
     $instance->expects($this->once())->method('getBackendLayoutConfiguration')->with(1)->willReturn(array('conf'));
     $instance->expects($this->once())->method('encodeTypoScriptArray')->with(array('conf'))->willReturn('conf');
     $collection = new BackendLayoutCollection('collection');
     $context = new DataProviderContext();
     $context->setPageId(1);
     $instance->addBackendLayouts($context, $collection);
     $this->assertEquals('conf', reset($collection->getAll())->getConfiguration());
 }
 /**
  * Gets PageTsConfig from DataProviderContext if available,
  * if not it will be generated for the current Page.
  *
  * @param DataProviderContext $dataProviderContext
  * @return void
  */
 protected function generatePageTsConfig($dataProviderContext = NULL)
 {
     if ($dataProviderContext === NULL) {
         $pageId = (int) ($this->getPageId() !== NULL ?: GeneralUtility::_GP('id'));
         $this->setPageTsConfig((array) BackendUtility::getPagesTSconfig($pageId));
     } else {
         $this->setPageTsConfig((array) $dataProviderContext->getPageTsConfig());
     }
 }
 /**
  * Gets PageTsConfig from DataProviderContext if available,
  * if not it will be generated for the current Page.
  *
  * @param DataProviderContext $dataProviderContext
  * @return void
  */
 protected function generatePageTsConfig($dataProviderContext = null)
 {
     if ($dataProviderContext === null) {
         $pageId = $this->getPageId();
         $pageId = $pageId > 0 ? $pageId : (int) GeneralUtility::_GP('id');
         $pageTsConfig = BackendUtility::getPagesTSconfig($pageId);
     } else {
         $pageTsConfig = $dataProviderContext->getPageTsConfig();
     }
     $this->setPageTsConfig($pageTsConfig);
 }