2 namespace TYPO3\CMS\Frontend\DataProcessing;
119 'right' => [1, 9, 17, 25],
120 'left' => [2, 10, 18, 26]
123 'above' => [0, 1, 2],
124 'intext' => [17, 18, 25, 26],
125 'below' => [8, 9, 10]
146 'columnSpacing' => 0,
231 array $contentObjectConfiguration,
235 if (isset($processorConfiguration[
'if.']) && !$cObj->
checkIf($processorConfiguration[
'if.'])) {
236 return $processedData;
239 $this->contentObjectRenderer = $cObj;
243 'filesProcessedDataKey',
244 $processorConfiguration,
247 if (isset($processedData[$filesProcessedDataKey]) && is_array($processedData[$filesProcessedDataKey])) {
248 $this->fileObjects = $processedData[$filesProcessedDataKey];
249 $this->galleryData[
'count'][
'files'] = count($this->fileObjects);
251 throw new ContentRenderingException(
'No files found for key ' . $filesProcessedDataKey .
' in $processedData.', 1436809789);
275 $processorConfiguration,
281 return $processedData;
295 if ($dataArrayKey && isset($this->contentObjectRenderer->data[$dataArrayKey])) {
296 $defaultValue = $this->contentObjectRenderer->data[$dataArrayKey];
298 return $this->contentObjectRenderer->stdWrapValue(
300 $this->processorConfiguration,
315 foreach ($this->availableGalleryPositions as $positionDirectionKey => $positionDirectionValue) {
316 foreach ($positionDirectionValue as $positionKey => $positionArray) {
317 if (in_array($this->mediaOrientation, $positionArray,
true)) {
318 $this->galleryData[
'position'][$positionDirectionKey] = $positionKey;
323 if ($this->mediaOrientation === 25 || $this->mediaOrientation === 26) {
324 $this->galleryData[
'position'][
'noWrap'] =
true;
335 if ($this->galleryData[
'position'][
'vertical'] ===
'intext') {
351 $columns = max((
int)$this->numberOfColumns, 1);
354 if ($columns > $this->galleryData[
'count'][
'files']) {
355 $columns = $this->galleryData[
'count'][
'files'];
358 if ($columns === 0) {
363 $rows = ceil($this->galleryData[
'count'][
'files'] / $columns);
365 $this->galleryData[
'count'][
'columns'] = $columns;
366 $this->galleryData[
'count'][
'rows'] = (int)$rows;
381 $columnSpacingTotal = ($this->galleryData[
'count'][
'columns'] - 1) * $this->columnSpacing;
383 $galleryWidthMinusBorderAndSpacing = max($this->galleryData[
'width'] - $columnSpacingTotal, 1);
385 if ($this->borderEnabled) {
386 $borderPaddingTotal = ($this->galleryData[
'count'][
'columns'] * 2) * $this->borderPadding;
387 $borderWidthTotal = ($this->galleryData[
'count'][
'columns'] * 2) * $this->borderWidth;
388 $galleryWidthMinusBorderAndSpacing = $galleryWidthMinusBorderAndSpacing - $borderPaddingTotal - $borderWidthTotal;
392 if ($this->equalMediaHeight) {
393 $mediaScalingCorrection = 1;
394 $maximumRowWidth = 0;
397 for ($row = 1; $row <= $this->galleryData[
'count'][
'rows']; $row++) {
399 for ($column = 1; $column <= $this->galleryData[
'count'][
'columns']; $column++) {
400 $fileKey = (($row - 1) * $this->galleryData[
'count'][
'columns']) + $column - 1;
401 if ($fileKey > $this->galleryData[
'count'][
'files'] - 1) {
407 $maximumRowWidth = max($totalRowWidth, $maximumRowWidth);
408 $mediaInRowScaling = $totalRowWidth / $galleryWidthMinusBorderAndSpacing;
409 $mediaScalingCorrection = max($mediaInRowScaling, $mediaScalingCorrection);
413 foreach ($this->fileObjects as $key => $fileObject) {
414 $mediaHeight = floor($this->equalMediaHeight / $mediaScalingCorrection);
418 $this->mediaDimensions[$key] = [
419 'width' => $mediaWidth,
420 'height' => $mediaHeight
425 $this->galleryData[
'width'] = floor($maximumRowWidth / $mediaScalingCorrection);
428 }
elseif ($this->equalMediaWidth) {
429 $mediaScalingCorrection = 1;
433 $mediaInRowScaling = $totalRowWidth / $galleryWidthMinusBorderAndSpacing;
434 $mediaScalingCorrection = max($mediaInRowScaling, $mediaScalingCorrection);
437 foreach ($this->fileObjects as $key => $fileObject) {
438 $mediaWidth = floor($this->equalMediaWidth / $mediaScalingCorrection);
439 $mediaHeight = floor(
442 $this->mediaDimensions[$key] = [
443 'width' => $mediaWidth,
444 'height' => $mediaHeight
449 $this->galleryData[
'width'] = floor($totalRowWidth / $mediaScalingCorrection);
453 $maxMediaWidth = (int)($galleryWidthMinusBorderAndSpacing / $this->galleryData[
'count'][
'columns']);
455 foreach ($this->fileObjects as $key => $fileObject) {
457 $mediaHeight = floor(
460 $this->mediaDimensions[$key] = [
461 'width' => $mediaWidth,
462 'height' => $mediaHeight
479 return $fileObject->
getProperty($dimensionalProperty);
481 $croppingConfiguration = json_decode($fileObject->
getProperty(
'crop'),
true);
482 return (
int)$croppingConfiguration[$dimensionalProperty];
494 for ($row = 1; $row <= $this->galleryData[
'count'][
'rows']; $row++) {
495 for ($column = 1; $column <= $this->galleryData[
'count'][
'columns']; $column++) {
496 $fileKey = (($row - 1) * $this->galleryData[
'count'][
'columns']) + $column - 1;
498 $this->galleryData[
'rows'][$row][
'columns'][$column] = [
499 'media' => $this->fileObjects[$fileKey],
501 'width' => $this->mediaDimensions[$fileKey][
'width'],
502 'height' => $this->mediaDimensions[$fileKey][
'height']