-
Notifications
You must be signed in to change notification settings - Fork 89
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 #687 from akeneo/release/104.3.7
Release/104.3.7
- Loading branch information
Showing
5 changed files
with
82 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,27 +4,53 @@ | |
|
||
namespace Akeneo\Connector\Block\Adminhtml\System\Config\Form\Field; | ||
|
||
use Akeneo\Connector\Helper\Config; | ||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray; | ||
use Magento\Framework\Data\Form\Element\Factory as ElementFactory; | ||
|
||
/** | ||
* @author Agence Dn'D <[email protected]> | ||
* @copyright 2004-present Agence Dn'D | ||
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @link https://www.dnd.fr/ | ||
*/ | ||
class Gallery extends AbstractFieldArray | ||
{ | ||
/** | ||
* Initialise form fields | ||
* | ||
* @return void | ||
*/ | ||
protected function _construct() | ||
public function __construct( | ||
private ElementFactory $elementFactory, | ||
Context $context, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
} | ||
|
||
protected function _construct(): void | ||
{ | ||
$this->addColumn('attribute', ['label' => __('Akeneo Attribute')]); | ||
$this->_addAfter = false; | ||
$this->addColumn('type', ['label' => __('Assign to')]); | ||
$this->_addAfter = false; | ||
$this->_addButtonLabel = __('Add'); | ||
|
||
parent::_construct(); | ||
} | ||
|
||
public function renderCellTemplate($columnName): string | ||
{ | ||
if ($columnName !== 'type') { | ||
return parent::renderCellTemplate($columnName); | ||
} | ||
|
||
$options = [ | ||
Config::PRODUCT_IMAGE_TYPE_ALL => __('All'), | ||
Config::PRODUCT_IMAGE_TYPE_PARENT => __('Parent'), | ||
Config::PRODUCT_IMAGE_TYPE_CHILD => __('Child'), | ||
]; | ||
$element = $this->elementFactory->create('select'); | ||
$element->setForm( | ||
$this->getForm() | ||
)->setName( | ||
$this->_getCellInputElementName($columnName) | ||
)->setHtmlId( | ||
$this->_getCellInputElementId('<%- _id %>', $columnName) | ||
)->setValues( | ||
$options | ||
); | ||
|
||
return str_replace("\n", '', $element->getElementHtml()); | ||
} | ||
} |
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
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