Skip to content

Commit 2b02aac

Browse files
Merge branch 'master' into 12/form-label-fix
2 parents fd4a942 + ef5775d commit 2b02aac

77 files changed

Lines changed: 136 additions & 90 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/static-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@ jobs:
5858
test -f /tmp/magento/phpstan.neon || echo 'parameters:' > /tmp/magento/phpstan.neon
5959
echo "Testing for PHPStan level $PHPSTAN_LEVEL"
6060
cd /tmp/magento
61-
php -d memory_limit=4G vendor/bin/phpstan analyse --level $PHPSTAN_LEVEL ${GITHUB_WORKSPACE}
61+
export MODULE_PATH=$(realpath vendor/${COMPOSER_NAME})
62+
php -d memory_limit=4G vendor/bin/phpstan analyse --level $PHPSTAN_LEVEL $MODULE_PATH
6263

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.5.2] - 28 January 2026
10+
### Fixed
11+
- Add hidden-attribute to field-blocks
12+
- Fix new field types not having proper interface
13+
- Fix when there are no fieldset definitions
14+
- Allow Options-model to be either string or object
15+
- #8 Allow to set label for the base fieldset @rajeev-k-tomy
16+
- #4 Custom fields configured via layout xml file are not appearing in the form @rajeev-k-tomy
17+
- Resolve select field options from the Select field type class
18+
- #3 Create an abstract FieldType class to give access Field instance in every FieldType @rajeev-k-tomy
19+
920
## [0.5.1] - 23 January 2026
1021
### Fixed
1122
- Do not escape JSON

Component/Grid/GridRepository.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
use Loki\AdminComponents\ProviderHandler\ProviderHandlerListing;
1414
use Loki\Components\Component\ComponentRepository;
1515

16+
/**
17+
* @method GridViewModel getViewModel()
18+
*/
1619
class GridRepository extends ComponentRepository
1720
{
1821
public function __construct(
@@ -25,7 +28,7 @@ public function __construct(
2528

2629
public function getNamespace(): string
2730
{
28-
return $this->getComponent()->getViewModel()->getNamespace();
31+
return $this->getViewModel()->getNamespace();
2932
}
3033

3134
// @todo: Remove the requirement for this
@@ -47,7 +50,7 @@ public function getPrimaryKey(): string
4750

4851
public function getItems(): array
4952
{
50-
$searchableFields = $this->getComponent()->getViewModel()->getSearchableFields();
53+
$searchableFields = $this->getViewModel()->getSearchableFields();
5154
$this->getState()->setSearchableFields($searchableFields);
5255

5356
return $this->getProviderHandler()->getItems($this->getProvider(), $this->getState());
@@ -102,7 +105,7 @@ protected function getState(): State
102105

103106
protected function getBlock(): AbstractBlock
104107
{
105-
return $this->getComponent()->getViewModel()->getBlock();
108+
return $this->getViewModel()->getBlock();
106109
}
107110

108111
public function getResourceModel(): ?AbstractDb

Form/Field/Field.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace Loki\AdminComponents\Form\Field;
55

66
use Loki\AdminComponents\Form\Field\FieldType\Editor;
7+
use Loki\AdminComponents\Form\Field\FieldType\Input;
78
use Magento\Framework\DataObject;
89
use Magento\Framework\View\Element\AbstractBlock;
910
use RuntimeException;
@@ -84,6 +85,10 @@ public function getFieldAttributes(): array
8485
$fieldAttributes['required'] = null;
8586
}
8687

88+
if ($this->isHidden() && $this->getFieldType() instanceof Input) {
89+
$fieldAttributes['type'] = 'hidden';
90+
}
91+
8792
return $fieldAttributes;
8893
}
8994

@@ -107,4 +112,14 @@ public function isVisible(): bool
107112

108113
return true;
109114
}
115+
116+
public function isHidden(): bool
117+
{
118+
$hidden = $this->getData('hidden');
119+
if (is_bool($hidden)) {
120+
return $hidden;
121+
}
122+
123+
return false;
124+
}
110125
}

Form/Field/FieldType/CustomerSelect.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
namespace Loki\AdminComponents\Form\Field\FieldType;
55

66
use Loki\AdminComponents\Form\Field\Field;
7-
use Loki\AdminComponents\Form\Field\FieldTypeInterface;
87
use Magento\Customer\Model\ResourceModel\Customer\Collection;
98

10-
class CustomerSelect implements FieldTypeInterface
9+
class CustomerSelect extends FieldTypeAbstract
1110
{
1211
public function getInputType(): string
1312
{

Form/Field/FieldType/EntitySelect.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44
namespace Loki\AdminComponents\Form\Field\FieldType;
55

6-
use Loki\AdminComponents\Form\Field\FieldTypeInterface;
7-
8-
class EntitySelect extends FieldTypeAbstract implements FieldTypeInterface
6+
class EntitySelect extends FieldTypeAbstract
97
{
108
public function getInputType(): string
119
{

Form/Field/FieldType/FieldTypeAbstract.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
namespace Loki\AdminComponents\Form\Field\FieldType;
66

77
use Loki\AdminComponents\Form\Field\Field;
8+
use Loki\AdminComponents\Form\Field\FieldTypeInterface;
89

9-
abstract class FieldTypeAbstract
10+
abstract class FieldTypeAbstract implements FieldTypeInterface
1011
{
1112
protected ?Field $field = null;
1213

Form/Field/FieldType/Input.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
namespace Loki\AdminComponents\Form\Field\FieldType;
44

5-
use Loki\AdminComponents\Form\Field\FieldTypeInterface;
6-
7-
class Input extends FieldTypeAbstract implements FieldTypeInterface
5+
class Input extends FieldTypeAbstract
86
{
97
public function getTemplate(): string
108
{

Form/Field/FieldType/ProductSelect.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
namespace Loki\AdminComponents\Form\Field\FieldType;
55

66
use Loki\AdminComponents\Form\Field\Field;
7-
use Loki\AdminComponents\Form\Field\FieldTypeInterface;
87
use Magento\Catalog\Model\ResourceModel\Product\Collection;
98

10-
class ProductSelect implements FieldTypeInterface
9+
class ProductSelect extends FieldTypeAbstract
1110
{
1211
public function getInputType(): string
1312
{

Form/Field/FieldType/Select.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public function getOptions(): array
3131
return [];
3232
}
3333

34-
$options = $this->objectManager->get($options);
34+
if (is_string($options)) {
35+
$options = $this->objectManager->get($options);
36+
}
3537

3638
if (!$options instanceof OptionSourceInterface) {
3739
return [];

0 commit comments

Comments
 (0)