Inheritance: implements FluidTYPO3\Flux\Provider\ProviderInterface
Exemple #1
0
 /**
  * Post-process a command executed on a record form the table this ConfigurationProvider
  * is attached to.
  *
  * @param string $command
  * @param integer $id
  * @param array $row
  * @param integer $relativeTo
  * @param DataHandler $reference
  * @return void
  */
 public function postProcessCommand($command, $id, array &$row, &$relativeTo, DataHandler $reference)
 {
     if (TRUE === self::shouldCallWithClassName(__CLASS__, __FUNCTION__, $id)) {
         parent::postProcessCommand($command, $id, $row, $relativeTo, $reference);
         $pasteCommands = array('copy', 'move');
         if (TRUE === in_array($command, $pasteCommands)) {
             $callback = $this->getCallbackCommand();
             if (TRUE === isset($callback['paste'])) {
                 $pasteCommand = $callback['paste'];
                 $parameters = explode('|', $pasteCommand);
                 $this->contentService->pasteAfter($command, $row, $parameters, $reference);
             } else {
                 $moveData = (array) $this->getMoveData();
                 $this->contentService->moveRecord($row, $relativeTo, $moveData, $reference);
             }
         }
         if ('localize' === $command) {
             $this->contentService->fixPositionInLocalization($id, $relativeTo, $row, $reference);
         }
         self::trackMethodCallWithClassName(__CLASS__, __FUNCTION__, $id);
     }
 }
 /**
  * @param string $operation
  * @param integer $id
  * @param array $row
  * @param DataHandler $reference
  * @param array $removals Additional array of field names to remove from the stored Flux value
  */
 public function postProcessRecord($operation, $id, array &$row, DataHandler $reference, array $removals = [])
 {
     if ('update' === $operation) {
         $record = $this->loadRecordFromDatabase($id);
         $record = RecursiveArrayUtility::mergeRecursiveOverrule($record, $reference->datamap[$this->tableName][$id]);
         $form = $this->getForm($record);
         if (null !== $form) {
             $tableFieldName = $this->getFieldName($record);
             foreach ($form->getFields() as $field) {
                 $fieldName = $field->getName();
                 $sheetName = $field->getParent()->getName();
                 $inherit = (bool) $field->getInherit();
                 $inheritEmpty = (bool) $field->getInheritEmpty();
                 if (isset($record[$tableFieldName]['data']) && is_array($record[$tableFieldName]['data'])) {
                     $value = $record[$tableFieldName]['data'][$sheetName]['lDEF'][$fieldName]['vDEF'];
                     $inheritedValue = $this->getInheritedPropertyValueByDottedPath($record, $fieldName);
                     $empty = true === empty($value) && $value !== '0' && $value !== 0;
                     $same = $inheritedValue == $value;
                     if (true === $same && true === $inherit || true === $inheritEmpty && true === $empty) {
                         $removals[] = $fieldName;
                     }
                 }
             }
         }
     }
     parent::postProcessRecord($operation, $id, $row, $reference, $removals);
 }
 /**
  * @param array $tree
  * @param string $cacheKey Overrides the cache key
  * @param boolean $mergeToCache Merges the configuration of $tree to the current $cacheKey
  * @return array
  */
 protected function getMergedConfiguration(array $tree, $cacheKey = NULL, $mergeToCache = FALSE)
 {
     $cacheKey = $this->getCacheKeyForMergedConfiguration($tree);
     if (TRUE === $this->hasCacheForMergedConfiguration($cacheKey)) {
         return parent::getMergedConfiguration($tree, $cacheKey);
     }
     if (FALSE === $this->isUsingSubFieldName()) {
         $branch = reset($tree);
         if (FALSE === empty($branch[$this->mainAction]) && FALSE === empty($branch[$this->subAction]) && $branch[$this->mainAction] !== $branch[$this->subAction] && FALSE === empty($branch[$this->subFieldName])) {
             $branch = array_shift($tree);
             $this->currentFieldName = $this->subFieldName;
             parent::getMergedConfiguration(array($branch), $cacheKey);
             $this->currentFieldName = $this->fieldName;
         }
     }
     return parent::getMergedConfiguration($tree, $cacheKey, TRUE);
 }
 /**
  * Post-process a command executed on a record form the table this ConfigurationProvider
  * is attached to.
  *
  * @param string $command
  * @param integer $id
  * @param array $row
  * @param integer $relativeTo
  * @param DataHandler $reference
  * @return void
  */
 public function postProcessCommand($command, $id, array &$row, &$relativeTo, DataHandler $reference)
 {
     parent::postProcessCommand($command, $id, $row, $relativeTo, $reference);
     $pasteCommands = array('copy', 'move');
     if (TRUE === in_array($command, $pasteCommands)) {
         $callback = $this->getCallbackCommand();
         if (TRUE === isset($callback['paste'])) {
             $pasteCommand = $callback['paste'];
             $parameters = explode('|', $pasteCommand);
             $this->contentService->pasteAfter($command, $row, $parameters, $reference);
         } else {
             $this->contentService->moveRecord($row, $relativeTo, $reference);
         }
         if (0 < count($row)) {
             $this->updateRecord($row, $id);
         }
     }
 }