Skip to content

Converted several grids from Magento\Sales module to new layout xml config format: #488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Implemented MAGETWO-11122: Configurable Grids (#471)
- converted Magento\Sales\Block\Adminhtml\Transactions\Grid and Magento\Sales\Block\Adminhtml\Order\View\Tab\Transactions to new layout xml config format
  • Loading branch information
Zyava committed Feb 1, 2014
commit 6094315418381a8750bfddbccd426910c987881e
58 changes: 58 additions & 0 deletions app/code/Magento/Payment/Model/Resource/Grid/GroupsArray.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Magento
* @package Magento_Sales
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

namespace Magento\Payment\Model\Resource\Grid;

/**
* Sales transaction types option array
*/
class GroupsArray implements \Magento\Core\Model\Option\ArrayInterface
{
/**
* Payment data
*
* @var \Magento\Payment\Helper\Data
*/
protected $_paymentData;

/**
* @param \Magento\Payment\Helper\Data $paymentData
*/
public function __construct(\Magento\Payment\Helper\Data $paymentData)
{
$this->_paymentData = $paymentData;
}

/**
* Return option array
*
* @return array
*/
public function toOptionArray()
{
return $this->_paymentData->getPaymentMethodList(true, true, true);
}
}
58 changes: 58 additions & 0 deletions app/code/Magento/Payment/Model/Resource/Grid/TypesArray.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Magento
* @package Magento_Sales
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

namespace Magento\Payment\Model\Resource\Grid;

/**
* Sales transaction payment method types option array
*/
class TypesArray implements \Magento\Core\Model\Option\ArrayInterface
{
/**
* Payment data
*
* @var \Magento\Payment\Helper\Data
*/
protected $_paymentData;

/**
* @param \Magento\Payment\Helper\Data $paymentData
*/
public function __construct(\Magento\Payment\Helper\Data $paymentData)
{
$this->_paymentData = $paymentData;
}

/**
* Return option array
*
* @return array
*/
public function toOptionArray()
{
return $this->_paymentData->getPaymentMethodList(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,64 +34,84 @@
namespace Magento\Sales\Block\Adminhtml\Order\View\Tab;

class Transactions
extends \Magento\Sales\Block\Adminhtml\Transactions\Grid
extends \Magento\View\Element\Text\ListText
implements \Magento\Backend\Block\Widget\Tab\TabInterface
{
/**
* @var \Magento\AuthorizationInterface
*/
protected $_authorization;

/**
* Retrieve grid url
*
* @return string
* @param \Magento\View\Element\Context $context
* @param \Magento\AuthorizationInterface $authorization
* @param array $data
*/
public function getGridUrl()
{
return $this->getUrl('sales/order/transactions', array('_current' => true));
public function __construct(
\Magento\View\Element\Context $context,
\Magento\AuthorizationInterface $authorization,
array $data = array()
) {
$this->_authorization = $authorization;
parent::__construct($context, $data);
}

// /**
// * Retrieve grid url
// *
// * @return string
// */
// public function getGridUrl()
// {
// return $this->getUrl('sales/order/transactions', array('_current' => true));
// }
//
// /**
// * Retrieve grid row url
// *
// * @return string
// */
// public function getRowUrl($item)
// {
// return $this->getUrl('sales/transactions/view', array('_current' => true, 'txn_id' => $item->getId()));
// }

/**
* Retrieve grid row url
*
* @return string
* Initialize grid params
*/
public function getRowUrl($item)
protected function _construct()
{
return $this->getUrl('sales/transactions/view', array('_current' => true, 'txn_id' => $item->getId()));
parent::_construct();
$this->setId('order_transactions');
$this->setUseAjax(true);
}

/**
* Retrieve tab label
*
* @return string
* {@inheritdoc}
*/
public function getTabLabel()
{
return __('Transactions');
}

/**
* Retrieve tab title
*
* @return string
* {@inheritdoc}
*/
public function getTabTitle()
{
return __('Transactions');
}

/**
* Check whether can show tab
*
* @return bool
* {@inheritdoc}
*/
public function canShowTab()
{
return true;
}

/**
* Check whether tab is hidden
*
* @return bool
* {@inheritdoc}
*/
public function isHidden()
{
Expand Down
Loading