-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #633 from magento-firedrakes/MAGETWO-43157
[Merchant Beta][Firedrakes] Bugfixes
- Loading branch information
Showing
3 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
app/code/Magento/SalesRule/Block/Widget/Form/Element/Dependence.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\SalesRule\Block\Widget\Form\Element; | ||
|
||
/** | ||
* Form element dependencies mapper | ||
* Assumes that one element may depend on other element values. | ||
* Will toggle as "enabled" only if all elements it depends from toggle as true. | ||
*/ | ||
class Dependence extends \Magento\Backend\Block\Widget\Form\Element\Dependence | ||
{ | ||
/** | ||
* @param \Magento\Backend\Block\Context $context | ||
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder | ||
* @param \Magento\Config\Model\Config\Structure\Element\Dependency\FieldFactory $fieldFactory | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
\Magento\Backend\Block\Context $context, | ||
\Magento\Framework\Json\EncoderInterface $jsonEncoder, | ||
\Magento\Config\Model\Config\Structure\Element\Dependency\FieldFactory $fieldFactory, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $jsonEncoder, $fieldFactory, $data); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function _toHtml() | ||
{ | ||
if (!$this->_depends) { | ||
return ''; | ||
} | ||
|
||
return '<script> | ||
require(["uiRegistry", "mage/adminhtml/form"], function(registry) { | ||
var controller = new FormElementDependenceController(' . | ||
$this->_getDependsJson() . | ||
($this->_configOptions ? ', ' . | ||
$this->_jsonEncoder->encode( | ||
$this->_configOptions | ||
) : '') . '); | ||
registry.set("formDependenceController", controller); | ||
});</script>'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters