-
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 remote-tracking branch 'mainline/develop' into BUGS
- Loading branch information
Showing
202 changed files
with
6,768 additions
and
1,020 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
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
36 changes: 36 additions & 0 deletions
36
app/code/Magento/Backend/Block/Cache/Grid/Massaction/ProductionModeVisibilityChecker.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,36 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Backend\Block\Cache\Grid\Massaction; | ||
|
||
use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface; | ||
use Magento\Framework\App\State; | ||
|
||
/** | ||
* Class checks that action can be displayed on massaction list | ||
*/ | ||
class ProductionModeVisibilityChecker implements VisibilityCheckerInterface | ||
{ | ||
/** | ||
* @var State | ||
*/ | ||
private $state; | ||
|
||
/** | ||
* @param State $state | ||
*/ | ||
public function __construct(State $state) | ||
{ | ||
$this->state = $state; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function isVisible() | ||
{ | ||
return $this->state->getMode() !== State::MODE_PRODUCTION; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,14 +3,11 @@ | |
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Backend\Block\Widget\Grid; | ||
|
||
/** | ||
* Grid widget massaction default block | ||
* | ||
* @author Magento Core Team <[email protected]> | ||
*/ | ||
namespace Magento\Backend\Block\Widget\Grid; | ||
|
||
class Massaction extends \Magento\Backend\Block\Widget\Grid\Massaction\AbstractMassaction | ||
{ | ||
} |
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 |
---|---|---|
|
@@ -5,14 +5,14 @@ | |
*/ | ||
namespace Magento\Backend\Block\Widget\Grid\Massaction; | ||
|
||
use Magento\Framework\View\Element\Template; | ||
use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface as VisibilityChecker; | ||
use Magento\Framework\DataObject; | ||
|
||
/** | ||
* Grid widget massaction block | ||
* | ||
* @method \Magento\Quote\Model\Quote setHideFormElement(boolean $value) Hide Form element to prevent IE errors | ||
* @method boolean getHideFormElement() | ||
* @author Magento Core Team <[email protected]> | ||
*/ | ||
abstract class AbstractMassaction extends \Magento\Backend\Block\Widget | ||
{ | ||
|
@@ -73,20 +73,21 @@ protected function _construct() | |
* 'complete' => string, // Only for ajax enabled grid (optional) | ||
* 'url' => string, | ||
* 'confirm' => string, // text of confirmation of this action (optional) | ||
* 'additional' => string // (optional) | ||
* 'additional' => string, // (optional) | ||
* 'visible' => object // instance of VisibilityCheckerInterface (optional) | ||
* ); | ||
* | ||
* @param string $itemId | ||
* @param array|\Magento\Framework\DataObject $item | ||
* @param array|DataObject $item | ||
* @return $this | ||
*/ | ||
public function addItem($itemId, $item) | ||
{ | ||
if (is_array($item)) { | ||
$item = new \Magento\Framework\DataObject($item); | ||
$item = new DataObject($item); | ||
} | ||
|
||
if ($item instanceof \Magento\Framework\DataObject) { | ||
if ($item instanceof DataObject && $this->isVisible($item)) { | ||
$item->setId($itemId); | ||
$item->setUrl($this->getUrl($item->getUrl())); | ||
$this->_items[$itemId] = $item; | ||
|
@@ -95,6 +96,19 @@ public function addItem($itemId, $item) | |
return $this; | ||
} | ||
|
||
/** | ||
* Check that item can be added to list | ||
* | ||
* @param DataObject $item | ||
* @return bool | ||
*/ | ||
private function isVisible(DataObject $item) | ||
{ | ||
/** @var VisibilityChecker $checker */ | ||
$checker = $item->getData('visible'); | ||
return (!$checker instanceof VisibilityChecker) || $checker->isVisible(); | ||
} | ||
|
||
/** | ||
* Retrieve massaction item with id $itemId | ||
* | ||
|
18 changes: 18 additions & 0 deletions
18
app/code/Magento/Backend/Block/Widget/Grid/Massaction/VisibilityCheckerInterface.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,18 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Backend\Block\Widget\Grid\Massaction; | ||
|
||
use Magento\Framework\View\Element\Block\ArgumentInterface; | ||
|
||
interface VisibilityCheckerInterface extends ArgumentInterface | ||
{ | ||
/** | ||
* Check that action can be displayed on massaction list | ||
* | ||
* @return bool | ||
*/ | ||
public function isVisible(); | ||
} |
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
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
Oops, something went wrong.