Skip to content

Commit 42d09fe

Browse files
committed
Merge tag '2.0.3'
Feature release - Feature image size for provide responsive image
2 parents 4373c7e + d2407d9 commit 42d09fe

File tree

13 files changed

+164
-43
lines changed

13 files changed

+164
-43
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"type": "contao-module",
1212
"homepage": "http://now.metamodel.me/",
13-
"license": "LGPL-3.0+",
13+
"license": "LGPL-3.0-or-later",
1414
"authors": [
1515
{
1616
"name": "Christian Schiffler",

contao/config/autoload.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of MetaModels/attribute_translatedfile.
55
*
6-
* (c) 2012-2016 The MetaModels team.
6+
* (c) 2012-2018 The MetaModels team.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -19,8 +19,8 @@
1919
* @author Andreas Isaak <andy.jared@googlemail.com>
2020
* @author David Greminger <david.greminger@1up.io>
2121
* @author Sven Baumann <baumann.sv@gmail.com>
22-
* @copyright 2012-2016 The MetaModels team.
23-
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0
22+
* @copyright 2012-2018 The MetaModels team.
23+
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0-or-later
2424
* @filesource
2525
*/
2626

contao/config/event_listeners.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of MetaModels/attribute_translatedfile.
55
*
6-
* (c) 2012-2016 The MetaModels team.
6+
* (c) 2012-2018 The MetaModels team.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -17,14 +17,16 @@
1717
* @subpackage AttributeTranslatedFile
1818
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
1919
* @author Sven Baumann <baumann.sv@gmail.com>
20-
* @copyright 2012-2016 The MetaModels team.
21-
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0
20+
* @copyright 2012-2018 The MetaModels team.
21+
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0-or-later
2222
* @filesource
2323
* @filesource
2424
*/
2525

26+
use ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event\GetPropertyOptionsEvent;
2627
use MetaModels\Attribute\TranslatedFile\AttributeTypeFactory;
2728
use MetaModels\Attribute\Events\CreateAttributeFactoryEvent;
29+
use MetaModels\Events\Attribute\TranslatedFile\ImageSizeOptions;
2830
use MetaModels\MetaModelsEvents;
2931

3032
return array
@@ -35,4 +37,8 @@ function (CreateAttributeFactoryEvent $event) {
3537
$factory->addTypeFactory(new AttributeTypeFactory());
3638
}
3739
),
40+
41+
GetPropertyOptionsEvent::NAME => array(
42+
array(new ImageSizeOptions(), 'getPropertyOptions')
43+
)
3844
);

contao/dca/tl_metamodel_attribute.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of MetaModels/attribute_translatedfile.
55
*
6-
* (c) 2012-2016 The MetaModels team.
6+
* (c) 2012-2018 The MetaModels team.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -20,8 +20,8 @@
2020
* @author Andreas Isaak <andy.jared@googlemail.com>
2121
* @author David Greminger <david.greminger@1up.io>
2222
* @author Sven Baumann <baumann.sv@gmail.com>
23-
* @copyright 2012-2016 The MetaModels team.
24-
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0
23+
* @copyright 2012-2018 The MetaModels team.
24+
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0-or-later
2525
* @filesource
2626
* @filesource
2727
*/

contao/dca/tl_metamodel_dcasetting.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of MetaModels/attribute_translatedfile.
55
*
6-
* (c) 2012-2016 The MetaModels team.
6+
* (c) 2012-2018 The MetaModels team.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -21,8 +21,8 @@
2121
* @author Carolina M. Koehn <office@kikmedia.de>
2222
* @author David Greminger <david.greminger@1up.io>
2323
* @author Sven Baumann <baumann.sv@gmail.com>
24-
* @copyright 2012-2016 The MetaModels team.
25-
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0
24+
* @copyright 2012-2018 The MetaModels team.
25+
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0-or-later
2626
* @filesource
2727
* @filesource
2828
*/

contao/dca/tl_metamodel_rendersetting.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of MetaModels/attribute_translatedfile.
55
*
6-
* (c) 2012-2016 The MetaModels team.
6+
* (c) 2012-2018 The MetaModels team.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -20,8 +20,8 @@
2020
* @author Andreas Isaak <andy.jared@googlemail.com>
2121
* @author David Greminger <david.greminger@1up.io>
2222
* @author Sven Baumann <baumann.sv@gmail.com>
23-
* @copyright 2012-2016 The MetaModels team.
24-
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0
23+
* @copyright 2012-2018 The MetaModels team.
24+
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0-or-later
2525
* @filesource
2626
*/
2727

@@ -68,6 +68,7 @@
6868
'reference' => &$GLOBALS['TL_LANG']['MSC'],
6969
'eval' => array(
7070
'rgxp' => 'digit',
71+
'includeBlankOption' => true,
7172
'nospace' => true,
7273
'helpwizard' => true,
7374
'tl_class' => 'w50',
Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,41 @@
11
<?php if (is_array($this->src)): ?>
22
<ul>
3-
<?php foreach($this->src as $arrFile):
3+
<?php foreach($this->src as $arrFile):
44
$strTitle = ($arrFile['title']) ? $arrFile['title'] : (($arrFile['alt']) ? $arrFile['alt'] : $arrFile['file']);
55
$strAlt = ($arrFile['caption']) ? $arrFile['caption'] : ''; ?>
66
<li class="<?php echo $arrFile['class']; ?>">
7-
<?php if ($this->settings->get('file_showLink')): ?>
7+
<?php if ($arrFile['isPicture'] && $this->settings->get('file_showImage')): ?>
8+
<figure class="image_container<?= $arrFile['floatClass'] ?>"<?php if ($arrFile['margin']): ?> style="<?= $arrFile['margin'] ?>"<?php endif; ?>>
9+
<?php endif; ?>
10+
<?php if ($this->settings->get('file_showLink')): ?>
811
<?php if ($this->settings->get('file_showImage')): ?>
912
<a class="cboxElement" data-lightbox="<?php echo $arrFile['lb']; ?>" title="<?php echo $strTitle; ?>" href="<?php echo $arrFile['file']; ?>">
1013
<?php else: ?>
1114
<a title="<?php echo $strTitle; ?>" href="<?php echo $arrFile['url']; ?>">
1215
<?php endif; ?>
1316
<?php endif; ?>
1417

15-
<?php if ($this->settings->get('file_showImage')): ?>
18+
<?php if (!$arrFile['isPicture'] && $this->settings->get('file_showImage')): ?>
1619
<?php if ($arrFile['isGdImage'] || $arrFile['isSvgImage']): ?>
1720
<?php echo $this->generateImage($arrFile['src'], $strAlt); ?>
1821
<?php endif; ?>
22+
<?php elseif ($arrFile['isPicture'] && $this->settings->get('file_showImage')): ?>
23+
<?php $this->insert('picture_default',$arrFile['picture']); ?>
1924
<?php else: ?>
2025
<img src="<?php echo $arrFile['icon']; ?>" alt="<?php echo $strAlt; ?>" /> <?php echo $strTitle; ?> <span class="size"><?php echo $arrFile['sizetext']; ?></span>
2126
<?php endif; ?>
2227

2328
<?php if ($this->settings->get('file_showLink')): ?>
2429
</a>
2530
<?php endif; ?>
31+
32+
<?php if ($arrFile['isPicture'] && $this->settings->get('file_showImage')): ?>
33+
<?php if ($arrFile['caption']): ?>
34+
<figcaption class="caption"><?= $arrFile['caption'] ?></figcaption>
35+
<?php endif; ?>
36+
</figure>
37+
<?php endif; ?>
2638
</li>
2739
<?php endforeach; ?>
2840
</ul>
29-
<?php endif; ?>
41+
<?php endif; ?>

contao/templates/mm_attr_translatedfile_alternative.html5

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
<?php if (is_array($this->src)): ?>
22
<?php foreach($this->src as $arrFile): ?>
33
<p class="<?= $arrFile['class'] ?><?= $this->additional_class ?>">
4+
<?php if ($arrFile['isPicture'] && $this->settings->get('file_showImage')): ?>
5+
<figure class="image_container<?= $arrFile['floatClass'] ?>"<?php if ($arrFile['margin']): ?> style="<?= $arrFile['margin'] ?>"<?php endif; ?>>
6+
<?php endif; ?>
47
<?php if ($this->settings->get('file_showLink')): ?>
5-
<?php if ($this->settings->get('file_showImage')): ?>
6-
<a class="cboxElement" data-lightbox="<?= $arrFile['lb'] ?>" title="<?= $arrFile['alt'] ?>" href="<?= $arrFile['file'] ?>">
7-
<?php else: ?>
8-
<a title="<?= $arrFile['alt'] ?>" href="<?= $arrFile['url'] ?>">
9-
<?php endif; ?>
8+
<?php if ($this->settings->get('file_showImage')): ?>
9+
<a class="cboxElement" data-lightbox="<?= $arrFile['lb'] ?>" title="<?= $arrFile['alt'] ?>" href="<?= $arrFile['file'] ?>">
10+
<?php else: ?>
11+
<a title="<?= $arrFile['alt'] ?>" href="<?= $arrFile['url'] ?>">
12+
<?php endif; ?>
1013
<?php endif; ?>
11-
<?php if ($this->settings->get('file_showImage')): ?>
12-
<?php if ($arrFile['isGdImage'] || $arrFile['isSvgImage']): ?>
13-
<?= $this->generateImage($arrFile['src'], $arrFile['caption']) ?>
14-
<?php endif; ?>
14+
<?php if (!$arrFile['isPicture'] && $this->settings->get('file_showImage')): ?>
15+
<?php if ($arrFile['isGdImage'] || $arrFile['isSvgImage']): ?>
16+
<?= $this->generateImage($arrFile['src'], $arrFile['caption']) ?>
17+
<?php endif; ?>
18+
<?php elseif ($arrFile['isPicture'] && $this->settings->get('file_showImage')): ?>
19+
<?php $this->insert('picture_default',$arrFile['picture']); ?>
1520
<?php else: ?>
16-
<img src="<?= $arrFile['icon'] ?>" alt="" /> <?= $arrFile['alt'] ? $arrFile['alt'] : $arrFile['file'] ?> <span class="size"><?= $arrFile['sizetext'] ?></span>
21+
<img src="<?= $arrFile['icon'] ?>" alt="" /> <?= $arrFile['alt'] ? $arrFile['alt'] : $arrFile['file'] ?> <span class="size"><?= $arrFile['sizetext'] ?></span>
1722
<?php endif; ?>
1823
<?php if ($this->settings->get('file_showLink')): ?>
19-
</a>
24+
</a>
25+
<?php endif; ?>
26+
<?php if ($arrFile['isPicture'] && $this->settings->get('file_showImage')): ?>
27+
<?php if ($arrFile['caption']): ?>
28+
<figcaption class="caption"><?= $arrFile['caption'] ?></figcaption>
29+
<?php endif; ?>
30+
</figure>
2031
<?php endif; ?>
2132
</p>
2233
<?php endforeach; ?>

src/MetaModels/Attribute/TranslatedFile/AttributeTypeFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of MetaModels/attribute_translatedfile.
55
*
6-
* (c) 2012-2016 The MetaModels team.
6+
* (c) 2012-2018 The MetaModels team.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -17,8 +17,8 @@
1717
* @subpackage AttributeTranslatedFile
1818
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
1919
* @author Sven Baumann <baumann.sv@gmail.com>
20-
* @copyright 2012-2016 The MetaModels team.
21-
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0
20+
* @copyright 2012-2018 The MetaModels team.
21+
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0-or-later
2222
* @filesource
2323
*/
2424

src/MetaModels/Attribute/TranslatedFile/TranslatedFile.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of MetaModels/attribute_translatedfile.
55
*
6-
* (c) 2012-2017 The MetaModels team.
6+
* (c) 2012-2018 The MetaModels team.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -21,8 +21,8 @@
2121
* @author Andreas Nölke <zero@brothers-project.de>
2222
* @author Sven Baumann <baumann.sv@gmail.com>
2323
* @author Ingolf Steinhardt <info@e-spin.de>
24-
* @copyright 2012-2017 The MetaModels team.
25-
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0
24+
* @copyright 2012-2018 The MetaModels team.
25+
* @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0-or-later
2626
* @filesource
2727
*/
2828

0 commit comments

Comments
 (0)