Skip to content

Commit

Permalink
Merge branch 'main' into trait-sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored Jan 18, 2025
2 parents 804caff + 5496d8a commit 9f13287
Show file tree
Hide file tree
Showing 15 changed files with 99 additions and 58 deletions.
13 changes: 11 additions & 2 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"files": [
"README.md"
],
"imageSize": 35,
"imageSize": 100,
"commit": true,
"commitConvention": "none",
"contributorsPerLine": 20,
"contributorsPerLine": 7,
"contributorTemplate": "<a href=\"<%= contributor.profile %>\"><img src=\"<%= contributor.avatar_url %>\" loading=\"lazy\" width=\"<%= options.imageSize %>\" alt=\"\"/><br /><sub><b><%= contributor.name %></b></sub></a>",
"badgeTemplate": "<a href=\"#contributors-\"><img src=\"https://img.shields.io/badge/all_contributors-<%= contributors.length %>-orange.svg\" alt=\"All Contributors\"></a>",
"wrapperTemplate": "\n<table>\n <tbody><%= bodyContent %> </tbody>\n<%= tableFooterContent %></table>\n\n",
Expand Down Expand Up @@ -1475,6 +1475,15 @@
"contributions": [
"code"
]
},
{
"login": "bucha",
"name": "Alexander Buch",
"avatar_url": "https://avatars.githubusercontent.com/u/1931120?v=4",
"profile": "http://www.cartware.de",
"contributions": [
"code"
]
}
],
"commitType": "docs"
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ on:
jobs:
phpstan:
name: Analyze
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4', '8.4']
runs-on: [ubuntu-latest]

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
php-version: 7.4

- uses: actions/checkout@v4

Expand All @@ -40,7 +36,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: .phpstan.cache
key: phpstan-result-cache-${{ matrix.php-versions }}-${{ github.run_id }}
key: phpstan-result-cache-${{ github.run_id }}
restore-keys: |
phpstan-result-cache-
Expand All @@ -52,4 +48,4 @@ jobs:
if: always()
with:
path: .phpstan.cache
key: phpstan-result-cache-${{ matrix.php-versions }}-${{ github.run_id }}
key: phpstan-result-cache-${{ github.run_id }}
3 changes: 3 additions & 0 deletions .phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ includes:
- .phpstan.dist.baseline.neon
- phar://phpstan.phar/conf/bleedingEdge.neon
parameters:
phpVersion:
min: 70433
max: 80499
magentoRootPath: %currentWorkingDirectory%
fileExtensions:
- php
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<tr>
<td align="center" valign="top" width="5%"><a href="https://www.vianetz.com/"><img src="https://avatars.githubusercontent.com/u/26252058?v=4" loading="lazy" width="35" alt=""/><br /><sub><b>Christoph Massmann</b></sub></a></td>
<td align="center" valign="top" width="5%"><a href="https://github.com/ragnese"><img src="https://avatars.githubusercontent.com/u/7927565?v=4" loading="lazy" width="35" alt=""/><br /><sub><b>Rob Agnese</b></sub></a></td>
<td align="center" valign="top" width="5%"><a href="http://www.cartware.de"><img src="https://avatars.githubusercontent.com/u/1931120?v=4" loading="lazy" width="35" alt=""/><br /><sub><b>Alexander Buch</b></sub></a></td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function _prepareForm()

$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$fieldset->setRenderer($renderer);
$field->setRenderer($renderer);
}
} else {
$fieldset->addField('store_id', 'hidden', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function(v, elem){

$renderer = $this->getLayout()->createBlock('adminhtml/customer_edit_renderer_newpass');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$fieldset->setRenderer($renderer);
$field->setRenderer($renderer);
}

// Prepare customer confirmation control (only for existing customers)
Expand Down Expand Up @@ -209,7 +209,7 @@ function(v, elem){

$renderer = $this->getLayout()->createBlock('adminhtml/customer_edit_renderer_adminpass');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$fieldset->setRenderer($renderer);
$field->setRenderer($renderer);
}
}
}
Expand All @@ -233,7 +233,7 @@ function(v, elem){

$renderer = $this->getLayout()->createBlock('adminhtml/customer_edit_renderer_newpass');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$fieldset->setRenderer($renderer);
$field->setRenderer($renderer);
}

// Prepare send welcome email checkbox
Expand Down
5 changes: 4 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,10 @@ public function addColumnDefaultData(array $column): array
{
$config = $this->getConfigDefaultColumnSettings();
$columnHasIndex = array_key_exists('index', $column);
if ($columnHasIndex && array_key_exists($column['index'], $config['index'])) {
if ($columnHasIndex &&
!is_array($column['index']) &&
array_key_exists($column['index'], $config['index'])
) {
$column += $config['index'][$column['index']];
}

Expand Down
3 changes: 3 additions & 0 deletions app/code/core/Mage/Adminhtml/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@
<sortable>false</sortable>
<width>40</width>
</action>
<concat>
<separator> </separator>
</concat>
<currency>
<align>right</align>
<index>price</index>
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api/Model/Server/Handler/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ protected function _prepareResourceModelName($resource)
* Login user and Retrieve session id
*
* @param string $username
* @param string|null $apiKey
* @param string $apiKey
* @return stdClass|string|void
*/
public function login($username, $apiKey = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function resultAction()
->setQueryParams($this->getRequest()->getQuery())
->getUrl('*/*/'),
);
return;
}
$this->_initLayoutMessages($this->getCatalogSessionStorage());
$this->renderLayout();
Expand Down
42 changes: 24 additions & 18 deletions app/code/core/Mage/Rule/Model/Action/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,52 +254,58 @@ public function getTypeElement()
*/
public function getAttributeElement()
{
$renderer = Mage::getBlockSingleton('rule/editable');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$this->getForm()::setFieldsetRenderer($renderer);
}

return $this->getForm()->addField('action:' . $this->getId() . ':attribute', 'select', [
$element = $this->getForm()->addField('action:' . $this->getId() . ':attribute', 'select', [
'name' => 'rule[actions][' . $this->getId() . '][attribute]',
'values' => $this->getAttributeSelectOptions(),
'value' => $this->getAttribute(),
'value_name' => $this->getAttributeName(),
]);

$renderer = Mage::getBlockSingleton('rule/editable');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$element->setRenderer($renderer);
}

return $element;
}

/**
* @return Varien_Data_Form_Element_Abstract
*/
public function getOperatorElement()
{
$renderer = Mage::getBlockSingleton('rule/editable');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$this->getForm()::setFieldsetRenderer($renderer);
}

return $this->getForm()->addField('action:' . $this->getId() . ':operator', 'select', [
$element = $this->getForm()->addField('action:' . $this->getId() . ':operator', 'select', [
'name' => 'rule[actions][' . $this->getId() . '][operator]',
'values' => $this->getOperatorSelectOptions(),
'value' => $this->getOperator(),
'value_name' => $this->getOperatorName(),
]);

$renderer = Mage::getBlockSingleton('rule/editable');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$element->setRenderer($renderer);
}

return $element;
}

/**
* @return Varien_Data_Form_Element_Abstract
*/
public function getValueElement()
{
$renderer = Mage::getBlockSingleton('rule/editable');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$this->getForm()::setFieldsetRenderer($renderer);
}

return $this->getForm()->addField('action:' . $this->getId() . ':value', 'text', [
$element = $this->getForm()->addField('action:' . $this->getId() . ':value', 'text', [
'name' => 'rule[actions][' . $this->getId() . '][value]',
'value' => $this->getValue(),
'value_name' => $this->getValueName(),
]);

$renderer = Mage::getBlockSingleton('rule/editable');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$element->setRenderer($renderer);
}

return $element;
}

/**
Expand Down
14 changes: 8 additions & 6 deletions app/code/core/Mage/Rule/Model/Action/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,18 @@ public function asHtml()
*/
public function getNewChildElement()
{
$renderer = Mage::getBlockSingleton('rule/newchild');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$this->getForm()::setFieldsetRenderer($renderer);
}

return $this->getForm()->addField('action:' . $this->getId() . ':new_child', 'select', [
$element = $this->getForm()->addField('action:' . $this->getId() . ':new_child', 'select', [
'name' => 'rule[actions][' . $this->getId() . '][new_child]',
'values' => $this->getNewChildSelectOptions(),
'value_name' => $this->getNewChildName(),
]);

$renderer = Mage::getBlockSingleton('rule/newchild');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$element->setRenderer($renderer);
}

return $element;
}

/**
Expand Down
14 changes: 8 additions & 6 deletions app/code/core/Mage/Rule/Model/Condition/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,17 +509,19 @@ public function getAttributeElement()
}
}

$renderer = Mage::getBlockSingleton('rule/editable');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$this->getForm()::setFieldsetRenderer($renderer);
}

return $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() . '__attribute', 'select', [
$element = $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() . '__attribute', 'select', [
'name' => 'rule[' . $this->getPrefix() . '][' . $this->getId() . '][attribute]',
'values' => $this->getAttributeSelectOptions(),
'value' => $this->getAttribute(),
'value_name' => $this->getAttributeName(),
]);

$renderer = Mage::getBlockSingleton('rule/editable');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$element->setRenderer($renderer);
}

return $element;
}

/**
Expand Down
28 changes: 16 additions & 12 deletions app/code/core/Mage/Rule/Model/Condition/Combine.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,19 @@ public function getAggregatorElement()
}
}

$renderer = Mage::getBlockSingleton('rule/editable');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$this->getForm()::setFieldsetRenderer($renderer);
}

return $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() . '__aggregator', 'select', [
$element = $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() . '__aggregator', 'select', [
'name' => 'rule[' . $this->getPrefix() . '][' . $this->getId() . '][aggregator]',
'values' => $this->getAggregatorSelectOptions(),
'value' => $this->getAggregator(),
'value_name' => $this->getAggregatorName(),
]);

$renderer = Mage::getBlockSingleton('rule/editable');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$element->setRenderer($renderer);
}

return $element;
}
/* end aggregator methods */

Expand Down Expand Up @@ -308,16 +310,18 @@ public function asHtml()
*/
public function getNewChildElement()
{
$renderer = Mage::getBlockSingleton('rule/newchild');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$this->getForm()::setFieldsetRenderer($renderer);
}

return $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() . '__new_child', 'select', [
$element = $this->getForm()->addField($this->getPrefix() . '__' . $this->getId() . '__new_child', 'select', [
'name' => 'rule[' . $this->getPrefix() . '][' . $this->getId() . '][new_child]',
'values' => $this->getNewChildSelectOptions(),
'value_name' => $this->getNewChildName(),
]);

$renderer = Mage::getBlockSingleton('rule/newchild');
if ($renderer instanceof Varien_Data_Form_Element_Renderer_Interface) {
$element->setRenderer($renderer);
}

return $element;
}

/**
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/Mage/Adminhtml/Block/Widget/GridTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ public function provideAddColumnDefaultData(): Generator
'type' => 'text',
],
];
yield 'index array - ref #4475' => [
[
'index' => ['firstname', 'lastname'],
'type' => 'concat',
'separator' => ' ',
],
[
'index' => ['firstname', 'lastname'],
'type' => 'concat',
],
];
yield 'type action' => [
[
'type' => 'action',
Expand Down

0 comments on commit 9f13287

Please sign in to comment.