Skip to content

Commit

Permalink
Bug fix with calling of dynamic method from class name by call_user_f…
Browse files Browse the repository at this point in the history
…unc()
  • Loading branch information
itstructure committed Apr 18, 2021
1 parent a8e16e0 commit 1752046
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Addition module description you can see in my [Personal site](https://pack-devel

Via composer:

`composer require itstructure/yii2-admin-module ~1.8.4`
`composer require itstructure/yii2-admin-module ~1.8.5`

## Usage

Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
### CHANGE LOG:

**1.8.5 April 18, 2021:**
- Bug fix with calling of dynamic method from class name by `call_user_func()`.

**1.8.4 April 17, 2021:**
- Bug fix: **Call to a member function validateCsrfToken() on string**.

Expand Down
12 changes: 8 additions & 4 deletions src/models/MultilanguageValidateModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ public function attributeLabels()
{
$dynamicAttributeLabels = [];
$staticAttributeLabels = [];
$translateAttributeLabels = [];

$translateAttributeLabels = call_user_func([
$this->mainModel->getTranslateModelName(),
'attributeLabels',
]);
$translateModelName = $this->mainModel->getTranslateModelName();

if (method_exists($translateModelName, 'attributeLabels')) {
/** @var Model $abstractTranslateModel */
$abstractTranslateModel = new $translateModelName();
$translateAttributeLabels = $abstractTranslateModel->attributeLabels();
}

foreach ($this->dynamicFields as $fieldConditions) {

Expand Down

0 comments on commit 1752046

Please sign in to comment.