Skip to content

Commit

Permalink
sort order added to downloable product links column
Browse files Browse the repository at this point in the history
  • Loading branch information
mahesh-rajawat committed Feb 15, 2019
1 parent 63a874f commit c9a9d64
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,22 +208,23 @@ protected function getRecord()
'children',
$record,
[
'container_link_title' => $this->getTitleColumn(),
'container_link_price' => $this->getPriceColumn(),
'container_file' => $this->getFileColumn(),
'container_sample' => $this->getSampleColumn(),
'is_shareable' => $this->getShareableColumn(),
'max_downloads' => $this->getMaxDownloadsColumn(),
'container_link_title' => $this->getTitleColumn(10),
'container_link_price' => $this->getPriceColumn(20),
'container_file' => $this->getFileColumn(30),
'container_sample' => $this->getSampleColumn(40),
'is_shareable' => $this->getShareableColumn(50),
'max_downloads' => $this->getMaxDownloadsColumn(60),
'position' => $recordPosition,
'action_delete' => $recordActionDelete,
]
);
}

/**
* @param int $sortOrder
* @return array
*/
protected function getTitleColumn()
protected function getTitleColumn($sortOrder)
{
$titleContainer['arguments']['data']['config'] = [
'componentType' => Container::NAME,
Expand All @@ -232,6 +233,7 @@ protected function getTitleColumn()
'label' => __('Title'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => $sortOrder,
];
$titleField['arguments']['data']['config'] = [
'formElement' => Form\Element\Input::NAME,
Expand All @@ -247,9 +249,10 @@ protected function getTitleColumn()
}

/**
* @param int $sortOrder
* @return array
*/
protected function getPriceColumn()
protected function getPriceColumn($sortOrder)
{
$priceContainer['arguments']['data']['config'] = [
'componentType' => Container::NAME,
Expand All @@ -258,6 +261,7 @@ protected function getPriceColumn()
'label' => __('Price'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => $sortOrder,
];
$priceField['arguments']['data']['config'] = [
'formElement' => Form\Element\Input::NAME,
Expand All @@ -281,9 +285,10 @@ protected function getPriceColumn()
}

/**
* @param int $sortOrder
* @return array
*/
protected function getFileColumn()
protected function getFileColumn($sortOrder)
{
$fileContainer['arguments']['data']['config'] = [
'componentType' => Container::NAME,
Expand All @@ -292,6 +297,7 @@ protected function getFileColumn()
'label' => __('File'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => $sortOrder,
];
$fileTypeField['arguments']['data']['config'] = [
'formElement' => Form\Element\Select::NAME,
Expand Down Expand Up @@ -344,9 +350,10 @@ protected function getFileColumn()
}

/**
* @param int $sortOrder
* @return array
*/
protected function getSampleColumn()
protected function getSampleColumn($sortOrder)
{
$sampleContainer['arguments']['data']['config'] = [
'componentType' => Container::NAME,
Expand All @@ -355,6 +362,7 @@ protected function getSampleColumn()
'label' => __('Sample'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => $sortOrder,
];
$sampleTypeField['arguments']['data']['config'] = [
'formElement' => Form\Element\Select::NAME,
Expand Down Expand Up @@ -403,26 +411,29 @@ protected function getSampleColumn()
}

/**
* @param int $sortOrder
* @return array
*/
protected function getShareableColumn()
protected function getShareableColumn($sortOrder)
{
$shareableField['arguments']['data']['config'] = [
'label' => __('Shareable'),
'formElement' => Form\Element\Select::NAME,
'componentType' => Form\Field::NAME,
'dataType' => Form\Element\DataType\Number::NAME,
'dataScope' => 'is_shareable',
'sortOrder' => $sortOrder,
'options' => $this->shareable->toOptionArray(),
];

return $shareableField;
}

/**
* @param int $sortOrder
* @return array
*/
protected function getMaxDownloadsColumn()
protected function getMaxDownloadsColumn($sortOrder)
{
$maxDownloadsContainer['arguments']['data']['config'] = [
'componentType' => Container::NAME,
Expand All @@ -431,6 +442,7 @@ protected function getMaxDownloadsColumn()
'label' => __('Max. Downloads'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => $sortOrder,
];
$numberOfDownloadsField['arguments']['data']['config'] = [
'formElement' => Form\Element\Input::NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,19 @@ protected function getRecord()
'children',
$record,
[
'container_sample_title' => $this->getTitleColumn(),
'container_sample' => $this->getSampleColumn(),
'container_sample_title' => $this->getTitleColumn(10),
'container_sample' => $this->getSampleColumn(20),
'position' => $recordPosition,
'action_delete' => $recordActionDelete,
]
);
}

/**
* @param int $sortOrder
* @return array
*/
protected function getTitleColumn()
protected function getTitleColumn($sortOrder)
{
$titleContainer['arguments']['data']['config'] = [
'componentType' => Container::NAME,
Expand All @@ -203,6 +204,7 @@ protected function getTitleColumn()
'showLabel' => false,
'label' => __('Title'),
'dataScope' => '',
'sortOrder' => $sortOrder,
];
$titleField['arguments']['data']['config'] = [
'formElement' => Form\Element\Input::NAME,
Expand All @@ -218,9 +220,10 @@ protected function getTitleColumn()
}

/**
* @param int $sortOrder
* @return array
*/
protected function getSampleColumn()
protected function getSampleColumn($sortOrder)
{
$sampleContainer['arguments']['data']['config'] = [
'componentType' => Container::NAME,
Expand All @@ -229,6 +232,7 @@ protected function getSampleColumn()
'label' => __('File'),
'showLabel' => false,
'dataScope' => '',
'sortOrder' => $sortOrder,
];
$sampleType['arguments']['data']['config'] = [
'formElement' => Form\Element\Select::NAME,
Expand Down

0 comments on commit c9a9d64

Please sign in to comment.