Skip to content

Commit

Permalink
Merge pull request #6 from timgatzky/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
timgatzky committed Dec 12, 2017
2 parents 4904b22 + 0325318 commit c96140a
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public function onSubmitCallback($objDC)
if($objDC->activeRecord->type == 'image')
{
$arrOptions = deserialize($objDC->activeRecord->options);
if(!in_array('cropperdata', $arrOptions) && in_array('size', $arrOptions))
if(in_array('cropperdata', $arrOptions) && !in_array('size', $arrOptions))
{
$arrOptions[] = 'cropperdata';
$arrOptions[] = 'size';
\Database::getInstance()->prepare("UPDATE ".$objDC->table." %s WHERE id=?")->set( array('options' => $arrOptions) )->execute($objDC->id);
}
}
Expand Down
3 changes: 3 additions & 0 deletions system/modules/pct_image_crop/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 1.2.0
Update: Image crop [cropperdata] is now a visible option in image attributes

### 1.1.0
Update: Support for CustomElements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@
* @link http://contao.org
*/

\System::loadLanguageFile('tl_pct_customelement_attribute',$GLOBALS['TL_LANGUAGE'],true);

/**
* Config
*/
$GLOBALS['TL_DCA']['tl_pct_customelement_attribute']['config']['onsubmit_callback'][] = array('PCT\ImageCrop\Backend\TableCustomElementAttribute', 'onSubmitCallback');

/**
* Add Cropper option for image attributes
*/
$GLOBALS['TL_DCA']['tl_pct_customelement_attribute']['fields']['options']['image']['options'][] = 'cropperdata';
$GLOBALS['TL_DCA']['tl_pct_customelement_attribute']['fields']['options']['image']['reference']['cropperdata'] = $GLOBALS['TL_LANG']['tl_pct_customelement_attribute']['options']['image']['cropperdata'];
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* Contao
* German translation file
*
* copyright Tim Gatzky 2017
* author Tim Gatzky <info@tim-gatzky.de>
* Translator:
*
* This file was created automatically be the Contao extension repository translation module.
* Do not edit this file manually. Contact the author or translator for this module to establish
* permanent text corrections which are update-safe.
*/

/**
* Legends
*/
$GLOBALS['TL_LANG']['tl_pct_customelement_attribute']['options']['image']['cropperdata'] = 'Image Crop erlauben [cropperdata] (Setzt Bildbreite und Bildhöhe voraus)';
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* Contao
* German translation file
*
* copyright Tim Gatzky 2017
* author Tim Gatzky <info@tim-gatzky.de>
* Translator:
*
* This file was created automatically be the Contao extension repository translation module.
* Do not edit this file manually. Contact the author or translator for this module to establish
* permanent text corrections which are update-safe.
*/

/**
* Legends
*/
$GLOBALS['TL_LANG']['tl_pct_customelement_attribute']['options']['image']['cropperdata'] = 'Allow image crop [cropperdata] (Requires image size option)';

0 comments on commit c96140a

Please sign in to comment.