Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
NamelessCoder committed Jan 9, 2017
2 parents 2ebcec4 + 39022fe commit 782c65e
Show file tree
Hide file tree
Showing 372 changed files with 32,802 additions and 26,918 deletions.
6 changes: 5 additions & 1 deletion .editorconfig
Expand Up @@ -11,7 +11,11 @@ trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true

[*.{php,html,js,css}]
[*.{php}]
indent_size = 4
indent_style = space

[*.{html,js,css}]
indent_size = 4
indent_style = tab

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -3,3 +3,6 @@ vendor
build
src
composer.lock
/index.php
/typo3
/typo3_src
30 changes: 20 additions & 10 deletions .travis.yml
Expand Up @@ -2,23 +2,33 @@ language: php

sudo: false

env: COVERAGE="YES" TYPO3_VERSION=">=7.6.13, <7.6.99"

php:
- "5.5"
- "5.6"
- "7"
- "hhvm"
- "7.0"

matrix:
include:
- php: "5.6"
env: CHECKSTYLE="YES" COVERAGE="YES"
allow_failures:
- php: "hhvm"
- php: "7.0"
env: COVERAGE="YES" TYPO3_VERSION="^8.4.1"
- php: "7.1"
env: COVERAGE="NO" TYPO3_VERSION="^8.4.1"
- php: "7.0"
env: COVERAGE="NO" TYPO3_VERSION="dev-master"
- php: "7.1"
env: COVERAGE="NO" TYPO3_VERSION="dev-master"

cache:
directories:
- $HOME/.composer/cache

install: composer install
install:
- composer require "typo3/cms:$TYPO3_VERSION"

before_script: mkdir -p build/logs

script: if [[ "$COVERAGE" != "NO" ]]; then ./vendor/bin/phpunit --coverage-clover=build/logs/clover.xml; else ./vendor/bin/phpunit; fi

script: ./vendor/bin/ci-runner
after_script:
- ln -s Classes src
- if [[ "$COVERAGE" != "NO" ]]; then ./vendor/bin/coveralls; fi
464 changes: 40 additions & 424 deletions CHANGELOG.md

Large diffs are not rendered by default.

171 changes: 88 additions & 83 deletions Classes/Backend/AreaListItemsProcessor.php
Expand Up @@ -12,100 +12,105 @@
use FluidTYPO3\Flux\Service\FluxService;
use FluidTYPO3\Flux\Service\RecordService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
use TYPO3\CMS\Extbase\Reflection\ObjectAccess;

/**
* Returns options for a "content area" selector box
*/
class AreaListItemsProcessor {
class AreaListItemsProcessor
{

/**
* @var ObjectManagerInterface
*/
protected $objectManager;
/**
* @var ObjectManagerInterface
*/
protected $objectManager;

/**
* @var FluxService
*/
protected $fluxService;
/**
* @var FluxService
*/
protected $fluxService;

/**
* @var RecordService
*/
protected $recordService;
/**
* @var RecordService
*/
protected $recordService;

/**
* CONSTRUCTOR
*/
public function __construct() {
$this->objectManager = GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
$this->fluxService = $this->objectManager->get('FluidTYPO3\Flux\Service\FluxService');
$this->recordService = $this->objectManager->get('FluidTYPO3\Flux\Service\RecordService');
}
/**
* CONSTRUCTOR
*/
public function __construct()
{
$this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$this->fluxService = $this->objectManager->get(FluxService::class);
$this->recordService = $this->objectManager->get(RecordService::class);
}

/**
* @return array
*/
protected function readParentAndAreaNameFromUrl() {
$urlRequestedParent = ObjectAccess::getPropertyPath($_GET, 'defVals.tt_content.tx_flux_parent');
$urlRequestedArea = ObjectAccess::getPropertyPath($_GET, 'defVals.tt_content.tx_flux_column');
return array($urlRequestedParent, $urlRequestedArea);
}
/**
* @return array
*/
protected function readParentAndAreaNameFromUrl()
{
$urlRequestedParent = ObjectAccess::getPropertyPath($_GET, 'defVals.tt_content.tx_flux_parent');
$urlRequestedArea = ObjectAccess::getPropertyPath($_GET, 'defVals.tt_content.tx_flux_column');
return [$urlRequestedParent, $urlRequestedArea];
}

/**
* ItemsProcFunc - adds items to tt_content.colPos selector (first, pipes through EXT:gridelements)
*
* @param array $params
* @return void
*/
public function itemsProcFunc(&$params) {
list ($urlRequestedParent, $urlRequestedArea) = $this->readParentAndAreaNameFromUrl();
if ($urlRequestedParent) {
$parentUid = $urlRequestedParent;
} else {
$parentUid = $params['row']['tx_flux_parent'];
}
if ($parentUid > 0) {
$items = $this->getContentAreasDefinedInContentElement($parentUid);
} else {
$items = array();
}
// adds an empty option in the beginning of the item list
array_unshift($items, array('', ''));
if ($urlRequestedArea) {
foreach ($items as $index => $set) {
if ($set[1] !== $urlRequestedArea) {
unset($items[$index]);
}
}
}
$params['items'] = $items;
}

/**
* @param integer $uid
* @return array
*/
public function getContentAreasDefinedInContentElement($uid) {
$uid = (integer) $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);
}
/**
* ItemsProcFunc - adds items to tt_content.colPos selector (first, pipes through EXT:gridelements)
*
* @param array $params
* @return void
*/
public function itemsProcFunc(&$params)
{
list ($urlRequestedParent, $urlRequestedArea) = $this->readParentAndAreaNameFromUrl();
if ($urlRequestedParent) {
$parentUid = $urlRequestedParent;
} else {
$parentUid = $params['row']['tx_flux_parent'];
}
if ($parentUid > 0) {
$items = $this->getContentAreasDefinedInContentElement($parentUid);
} else {
$items = [];
}
// adds an empty option in the beginning of the item list
array_unshift($items, ['', '']);
if ($urlRequestedArea) {
foreach ($items as $index => $set) {
if ($set[1] !== $urlRequestedArea) {
unset($items[$index]);
}
}
}
$params['items'] = $items;
}

/**
* @param integer $uid
* @return array
*/
public function getContentAreasDefinedInContentElement($uid)
{
$uid = (integer) $uid;
$record = $this->recordService->getSingle('tt_content', '*', $uid);
/** @var $providers ProviderInterface[] */
$providers = $this->fluxService->resolveConfigurationProviders('tt_content', null, $record);
$columns = [];
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, [$column['label'] . ' (' . $column['name'] . ')', $column['name']]);
}
}
}
return array_unique($columns, SORT_REGULAR);
}
}

0 comments on commit 782c65e

Please sign in to comment.