Skip to content

Commit

Permalink
Merge pull request #1128 from magento-tsg/2.0.15-develop-pr14
Browse files Browse the repository at this point in the history
[TSG] Backporting for 2.0 (pr14) (2.0.15)
  • Loading branch information
Volodymyr Klymenko authored May 23, 2017
2 parents 1e9b79a + 7eb366d commit 22c402d
Show file tree
Hide file tree
Showing 70 changed files with 2,936 additions and 659 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use Magento\Backend\Block\Widget\Form\Generic;
use Magento\Config\Model\Config\Source\Yesno;
use Magento\Eav\Helper\Data;
use Magento\Eav\Block\Adminhtml\Attribute\PropertyLocker;
use Magento\Framework\App\ObjectManager;

class Advanced extends Generic
{
Expand All @@ -36,6 +38,13 @@ class Advanced extends Generic
*/
protected $disableScopeChangeList;

/**
* Disable form fields.
*
* @var \Magento\Eav\Block\Adminhtml\Attribute\PropertyLocker PropertyLocker
*/
private $propertyLocker;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\Registry $registry
Expand Down Expand Up @@ -241,6 +250,8 @@ protected function _prepareForm()
$form->getElement('is_global')->setDisabled(1);
}
$this->setForm($form);
$this->getPropertyLocker()->lock($form);

return $this;
}

Expand All @@ -264,4 +275,18 @@ private function getAttributeObject()
{
return $this->_coreRegistry->registry('entity_attribute');
}

/**
* Get property locker.
*
* @return PropertyLocker
*/
private function getPropertyLocker()
{
if (null === $this->propertyLocker) {
$this->propertyLocker = ObjectManager::getInstance()->get(PropertyLocker::class);
}

return $this->propertyLocker;
}
}
6 changes: 2 additions & 4 deletions app/code/Magento/Catalog/Block/Product/View/Gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,13 @@ public function getGalleryImages()
);
$image->setData(
'medium_image_url',
$this->_imageHelper->init($product, 'product_page_image_medium')
->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false)
$this->_imageHelper->init($product, 'product_page_image_medium_no_frame')
->setImageFile($image->getFile())
->getUrl()
);
$image->setData(
'large_image_url',
$this->_imageHelper->init($product, 'product_page_image_large')
->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false)
$this->_imageHelper->init($product, 'product_page_image_large_no_frame')
->setImageFile($image->getFile())
->getUrl()
);
Expand Down
21 changes: 11 additions & 10 deletions app/code/Magento/Catalog/Helper/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,28 +241,29 @@ protected function setWatermarkProperties()
{
$this->setWatermark(
$this->scopeConfig->getValue(
"design/watermark/{$this->_getModel()->getDestinationSubdir()}_image",
"design/watermark/{$this->getType()}_image",
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$this->setWatermarkImageOpacity(
$this->scopeConfig->getValue(
"design/watermark/{$this->_getModel()->getDestinationSubdir()}_imageOpacity",
"design/watermark/{$this->getType()}_imageOpacity",
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$this->setWatermarkPosition(
$this->scopeConfig->getValue(
"design/watermark/{$this->_getModel()->getDestinationSubdir()}_position",
"design/watermark/{$this->getType()}_position",
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);
$this->setWatermarkSize(
$this->scopeConfig->getValue(
"design/watermark/{$this->_getModel()->getDestinationSubdir()}_size",
"design/watermark/{$this->getType()}_size",
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
)
);

return $this;
}

Expand Down Expand Up @@ -496,14 +497,14 @@ protected function initBaseFile()
*/
protected function isScheduledActionsAllowed()
{
$isAllowed = true;
$model = $this->_getModel();
if ($model->isBaseFilePlaceholder()
&& $model->getNewFile() === true
|| $model->isCached()
) {
return false;

if ($model->isBaseFilePlaceholder() || $model->isCached()) {
$isAllowed = false;
}
return true;

return $isAllowed;
}

/**
Expand Down
Loading

0 comments on commit 22c402d

Please sign in to comment.