/** * @param string $table * @param integer $id * @param array $record * @return array|NULL */ protected function ensureRecordDataIsLoaded($table, $id, array $record) { if (TRUE === is_integer($id) && 0 === count($record)) { // patch: when a record is completely empty but a UID exists $loadedRecord = $this->recordService->getSingle($table, '*', $id); $record = TRUE === is_array($loadedRecord) ? $loadedRecord : $record; } return $record; }
/** * @param integer $relativeRecordUid * @param string $fluxAreaName * @param array $whitelist * @param array $blacklist * @return array */ protected function readWhitelistAndBlacklistFromColumn($relativeRecordUid, $fluxAreaName, $whitelist, $blacklist) { $relativeRecord = $this->recordService->getSingle('tt_content', '*', (int) $relativeRecordUid); $contentProviders = $this->configurationService->resolveConfigurationProviders('tt_content', NULL, $relativeRecord); foreach ($contentProviders as $contentProvider) { $grid = $contentProvider->getGrid($relativeRecord); if (NULL === $grid) { continue; } foreach ($grid->getRows() as $row) { foreach ($row->getColumns() as $column) { if ($column->getName() === $fluxAreaName) { list($whitelist, $blacklist) = $this->appendToWhiteAndBlacklistFromComponent($column, $whitelist, $blacklist); } } } } return array($whitelist, $blacklist); }
/** * @param integer $uid * @return array */ public function getContentAreasDefinedInContentElement($uid) { $uid = (int) $uid; $record = $this->recordService->getSingle('tt_content', '*', $uid); /** @var $providers ProviderInterface[] */ $providers = $this->fluxService->resolveConfigurationProviders('tt_content', NULL, $record); $columns = array(); foreach ($providers as $provider) { $grid = $provider->getGrid($record); if (TRUE === empty($grid)) { continue; } $gridConfiguration = $grid->build(); foreach ($gridConfiguration['rows'] as $row) { foreach ($row['columns'] as $column) { array_push($columns, array($column['label'] . ' (' . $column['name'] . ')', $column['name'])); } } } return array_unique($columns, SORT_REGULAR); }
/** * @param array $row * @param integer $uid * @return void */ protected function updateRecordInDatabase(array $row, $uid = NULL) { if (NULL === $uid) { $uid = $row['uid']; } $uid = (int) $uid; if (FALSE === empty($uid)) { $row['uid'] = $uid; $this->workspacesAwareRecordService->update('tt_content', $row); // reload our record for the next bits to have access to all fields $row = $this->recordService->getSingle('tt_content', '*', $uid); } $versionedRecordUid = (int) (TRUE === isset($row['t3ver_oid']) && 0 < (int) $row['t3ver_oid'] ? $row['t3ver_oid'] : 0); if (0 < $versionedRecordUid) { // temporary record; duplicate key values of original record into temporary one. // Note: will continue to call this method until all temporary records in chain have been processed. $placeholder = $this->recordService->getSingle('tt_content', '*', $row['t3ver_oid']); $placeholder['tx_flux_parent'] = (int) $row['tx_flux_parent']; $placeholder['tx_flux_column'] = $row['tx_flux_column']; $this->updateRecordInDatabase($placeholder, $row['t3ver_oid']); } }
/** * @param string $table * @param string $fields * @param string $uid * @return array|NULL */ public function getSingle($table, $fields, $uid) { $record = parent::getSingle($table, $fields, $uid); return NULL === $record ? NULL : $this->overlayRecord($table, $record); }
/** * @param string $table * @param integer $uid * @return integer */ protected function getPageIdFromRecordUid($table, $uid) { $record = $this->recordService->getSingle($table, 'pid', $uid); return TRUE === is_array($record) ? $this->getPageIdFromRecord($record) : 0; }