Skip to content

Commit

Permalink
[TASK] Cosmetic fixes
Browse files Browse the repository at this point in the history
Moves some methods up/down class body, touch-ups for doc comments and such.
  • Loading branch information
NamelessCoder committed Mar 10, 2015
1 parent 2f09dc9 commit d40c768
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 45 deletions.
6 changes: 1 addition & 5 deletions Classes/Form/AbstractFormContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,7 @@ public function remove($childName) {
* @return boolean
*/
public function has($childOrChildName) {
if (TRUE === $childOrChildName instanceof FormInterface) {
$name = $childOrChildName->getName();
} else {
$name = $childOrChildName;
}
$name = (TRUE === $childOrChildName instanceof FormInterface) ? $childOrChildName->getName() : $childOrChildName;
return (FALSE !== $this->get($name));
}

Expand Down
19 changes: 10 additions & 9 deletions Classes/Service/ContentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,6 @@ public function moveRecord(array &$row, &$relativeTo, $parameters, DataHandler $
$this->updateMovePlaceholder($row);
}

/**
* @param integer $relativeTo
* @return array
*/
protected function getTargetAreaStoredInSession($relativeTo) {
'' !== session_id() ? : session_start();
return $_SESSION['target' . $relativeTo];
}

/**
* @param array $row
* @return void
Expand Down Expand Up @@ -348,4 +339,14 @@ protected function updateRecordInDatabase(array $row, $uid = NULL) {
}
}

/**
* @codeCoverageIgnore
* @param integer $relativeTo
* @return array
*/
protected function getTargetAreaStoredInSession($relativeTo) {
'' !== session_id() ? : session_start();
return $_SESSION['target' . $relativeTo];
}

}
8 changes: 8 additions & 0 deletions Classes/Utility/MiscellaneousUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ public static function getIconForTemplate(Form $form) {
return NULL;
}

/**
* Cleans flex form XML, removing any field nodes identified
* in $removals and trimming the result to avoid empty containers.
*
* @param string $xml
* @param array $removals
* @return string
*/
public static function cleanFlexFormXml($xml, array $removals = array()) {
$dom = new \DOMDocument();
$dom->loadXML($xml);
Expand Down
68 changes: 37 additions & 31 deletions Classes/View/PreviewView.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,27 +289,13 @@ protected function drawGridColumn(array $row, Column $column) {
}

/**
* @param integer $contentElementUid
* @param string $areaName
* @return integer
*/
protected function registerTargetContentAreaInSession($contentElementUid, $areaName) {
if ('' === session_id()) {
session_start();
}
$integer = MiscellaneousUtility::generateUniqueIntegerForFluxArea($contentElementUid, $areaName);
$_SESSION['target' . $integer] = array($contentElementUid, $areaName);
return $integer;
}

/**
* @param array $row
* @param array $parentRow
* @param Column $column
* @param array $record
* @param PageLayoutView $dblist
* @return string
*/
protected function drawRecord(array $row, Column $column, array $record, PageLayoutView $dblist) {
protected function drawRecord(array $parentRow, Column $column, array $record, PageLayoutView $dblist) {
$colPosFluxContent = ContentService::COLPOS_FLUXCONTENT;
$disabledClass = FALSE === empty($record['isDisabled']) ? ' t3-page-ce-hidden' : '';
$element = $this->drawElement($record, $dblist);
Expand All @@ -320,11 +306,13 @@ protected function drawRecord(array $row, Column $column, array $record, PageLay
return <<<CONTENT
<div class="t3-page-ce$disabledClass {$record['_CSSCLASS']} ui-draggable" id="element-tt_content-{$record['uid']}" data-table="tt_content" data-uid="{$record['uid']}">
$element
<div class="t3-page-ce-dropzone ui-droppable" id="colpos-$colPosFluxContent-page-{$row['pid']}-{$row['uid']}-after-{$record['uid']}" style="min-height: 16px;">
<div class="t3-page-ce-dropzone ui-droppable"
id="colpos-$colPosFluxContent-page-{$parentRow['pid']}-{$parentRow['uid']}-after-{$record['uid']}"
style="min-height: 16px;">
<div class="t3-page-ce-wrapper-new-ce">
{$this->drawNewIcon($row, $column, $record['uid'])}
{$this->drawPasteIcon($row, $column, FALSE, $record)}
{$this->drawPasteIcon($row, $column, TRUE, $record)}
{$this->drawNewIcon($parentRow, $column, $record['uid'])}
{$this->drawPasteIcon($parentRow, $column, FALSE, $record)}
{$this->drawPasteIcon($parentRow, $column, TRUE, $record)}
</div>
</div>
</div>
Expand Down Expand Up @@ -428,10 +416,8 @@ protected function getNewLinkLegacy(array $row, $after, $columnName) {
protected function drawPasteIcon(array $row, Column $column, $reference = FALSE, array $relativeTo = array()) {
$command = TRUE === $reference ? 'reference' : 'paste';
$relativeUid = TRUE === isset($relativeTo['uid']) ? $relativeTo['uid'] : 0;
$relativeTo = $row['pid'] . '-' . $command . '-' . $relativeUid . '-' . $row['uid'];
if (FALSE === empty($area)) {
$relativeTo .= '-' . $column->getName();
}
$relativeTo = $row['pid'] . '-' . $command . '-' . $relativeUid . '-' .
$row['uid'] . (FALSE === empty($area) ? '-' . $column->getName() : '');
return ClipBoardUtility::createIconWithUrl($relativeTo, $reference);
}

Expand Down Expand Up @@ -533,13 +519,6 @@ protected function isDeleteOrMovePlaceholder($record) {
return (TRUE === empty($record) || VersionState::DELETE_PLACEHOLDER === (integer) $record['t3ver_state']);
}

/**
* @return integer
*/
protected function getActiveWorkspaceId() {
return (integer) (TRUE === isset($GLOBALS['BE_USER']->workspace) ? $GLOBALS['BE_USER']->workspace : 0);
}

/**
* @param array $row
* @return PageLayoutView
Expand Down Expand Up @@ -595,31 +574,58 @@ protected function configurePageLayoutViewForLanguageMode(PageLayoutView $view)
}

/**
* @codeCoverageIgnore
* @return array
*/
protected function getPageModuleSettings() {
return $GLOBALS['SOBE']->MOD_SETTINGS;
}

/**
* @codeCoverageIgnore
* @return DatabaseConnection
*/
protected function getDatabaseConnection() {
return $GLOBALS['TYPO3_DB'];
}

/**
* @codeCoverageIgnore
* @return BackendUserAuthentication
*/
protected function getBackendUser() {
return $GLOBALS['BE_USER'];
}

/**
* @codeCoverageIgnore
* @return LanguageService
*/
protected function getLanguageService() {
return $GLOBALS['LANG'];
}

/**
* @codeCoverageIgnore
* @return integer
*/
protected function getActiveWorkspaceId() {
return (integer) (TRUE === isset($GLOBALS['BE_USER']->workspace) ? $GLOBALS['BE_USER']->workspace : 0);
}

/**
* @codeCoverageIgnore
* @param integer $contentElementUid
* @param string $areaName
* @return integer
*/
protected function registerTargetContentAreaInSession($contentElementUid, $areaName) {
if ('' === session_id()) {
session_start();
}
$integer = MiscellaneousUtility::generateUniqueIntegerForFluxArea($contentElementUid, $areaName);
$_SESSION['target' . $integer] = array($contentElementUid, $areaName);
return $integer;
}

}

0 comments on commit d40c768

Please sign in to comment.