Skip to content

Commit

Permalink
ENGCOM-4466: [Backport] Fixed: #21278, Add sort order on downloadable…
Browse files Browse the repository at this point in the history
… links #21662
  • Loading branch information
sidolov authored Mar 18, 2019
2 parents 6167719 + 293f6d3 commit 3b9b259
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier;

use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Catalog\Model\Locator\LocatorInterface;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Downloadable\Model\Product\Type;
use Magento\Downloadable\Model\Source\TypeUpload;
use Magento\Downloadable\Model\Source\Shareable;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Downloadable\Model\Source\TypeUpload;
use Magento\Framework\Stdlib\ArrayManager;
use Magento\Ui\Component\DynamicRows;
use Magento\Framework\UrlInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Ui\Component\Container;
use Magento\Ui\Component\DynamicRows;
use Magento\Ui\Component\Form;

/**
* Class adds a grid with links
* Class adds a grid with links.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Links extends AbstractModifier
Expand Down Expand Up @@ -86,7 +88,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function modifyData(array $data)
{
Expand All @@ -101,7 +103,7 @@ public function modifyData(array $data)
}

/**
* {@inheritdoc}
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function modifyMeta(array $meta)
Expand Down Expand Up @@ -160,6 +162,8 @@ public function modifyMeta(array $meta)
}

/**
* Get dynamic rows meta.
*
* @return array
*/
protected function getDynamicRows()
Expand All @@ -180,6 +184,8 @@ protected function getDynamicRows()
}

/**
* Get single link record meta.
*
* @return array
*/
protected function getRecord()
Expand Down Expand Up @@ -221,6 +227,8 @@ protected function getRecord()
}

/**
* Get link title meta.
*
* @return array
*/
protected function getTitleColumn()
Expand All @@ -232,6 +240,7 @@ protected function getTitleColumn()
'label' => __('Title'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => 10,
];
$titleField['arguments']['data']['config'] = [
'formElement' => Form\Element\Input::NAME,
Expand All @@ -247,6 +256,8 @@ protected function getTitleColumn()
}

/**
* Get link price meta.
*
* @return array
*/
protected function getPriceColumn()
Expand All @@ -258,6 +269,7 @@ protected function getPriceColumn()
'label' => __('Price'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => 20,
];
$priceField['arguments']['data']['config'] = [
'formElement' => Form\Element\Input::NAME,
Expand All @@ -281,6 +293,8 @@ protected function getPriceColumn()
}

/**
* Get link file element meta.
*
* @return array
*/
protected function getFileColumn()
Expand All @@ -292,6 +306,7 @@ protected function getFileColumn()
'label' => __('File'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => 30,
];
$fileTypeField['arguments']['data']['config'] = [
'formElement' => Form\Element\Select::NAME,
Expand Down Expand Up @@ -344,6 +359,8 @@ protected function getFileColumn()
}

/**
* Get sample container meta.
*
* @return array
*/
protected function getSampleColumn()
Expand All @@ -355,6 +372,7 @@ protected function getSampleColumn()
'label' => __('Sample'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => 40,
];
$sampleTypeField['arguments']['data']['config'] = [
'formElement' => Form\Element\Select::NAME,
Expand Down Expand Up @@ -403,6 +421,8 @@ protected function getSampleColumn()
}

/**
* Get link "is sharable" element meta.
*
* @return array
*/
protected function getShareableColumn()
Expand All @@ -413,13 +433,16 @@ protected function getShareableColumn()
'componentType' => Form\Field::NAME,
'dataType' => Form\Element\DataType\Number::NAME,
'dataScope' => 'is_shareable',
'sortOrder' => 50,
'options' => $this->shareable->toOptionArray(),
];

return $shareableField;
}

/**
* Get link "max downloads" element meta.
*
* @return array
*/
protected function getMaxDownloadsColumn()
Expand All @@ -431,6 +454,7 @@ protected function getMaxDownloadsColumn()
'label' => __('Max. Downloads'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => 60,
];
$numberOfDownloadsField['arguments']['data']['config'] = [
'formElement' => Form\Element\Input::NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier;

use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Catalog\Model\Locator\LocatorInterface;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Downloadable\Model\Product\Type;
use Magento\Downloadable\Model\Source\TypeUpload;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Framework\Stdlib\ArrayManager;
use Magento\Ui\Component\DynamicRows;
use Magento\Framework\UrlInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Ui\Component\Container;
use Magento\Ui\Component\DynamicRows;
use Magento\Ui\Component\Form;

/**
* Class adds a grid with samples
* Class adds a grid with samples.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Samples extends AbstractModifier
Expand Down Expand Up @@ -77,7 +79,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function modifyData(array $data)
{
Expand All @@ -90,7 +92,7 @@ public function modifyData(array $data)
}

/**
* {@inheritdoc}
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function modifyMeta(array $meta)
Expand Down Expand Up @@ -135,6 +137,8 @@ public function modifyMeta(array $meta)
}

/**
* Get sample rows meta.
*
* @return array
*/
protected function getDynamicRows()
Expand All @@ -155,6 +159,8 @@ protected function getDynamicRows()
}

/**
* Get single sample row meta.
*
* @return array
*/
protected function getRecord()
Expand Down Expand Up @@ -192,6 +198,8 @@ protected function getRecord()
}

/**
* Get sample title meta.
*
* @return array
*/
protected function getTitleColumn()
Expand All @@ -203,6 +211,7 @@ protected function getTitleColumn()
'showLabel' => false,
'label' => __('Title'),
'dataScope' => '',
'sortOrder' => 10,
];
$titleField['arguments']['data']['config'] = [
'formElement' => Form\Element\Input::NAME,
Expand All @@ -218,6 +227,8 @@ protected function getTitleColumn()
}

/**
* Get sample element meta.
*
* @return array
*/
protected function getSampleColumn()
Expand All @@ -229,6 +240,7 @@ protected function getSampleColumn()
'label' => __('File'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => 20,
];
$sampleType['arguments']['data']['config'] = [
'formElement' => Form\Element\Select::NAME,
Expand Down

0 comments on commit 3b9b259

Please sign in to comment.