Skip to content

Commit

Permalink
fix for custom actions
Browse files Browse the repository at this point in the history
  • Loading branch information
shershennm committed Apr 29, 2019
1 parent ec4f561 commit 9ac1af6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions Seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,26 @@ public function setMeta($viewEvent)
private function executeSeoControllerAction($viewEvent)
{
$seoController = Yii::createObject($this->buildSeoControllerClassName());

if (!property_exists($this->controller->action, 'actionMethod')) {
return false;
}

$actionMethod = $this->controller->action->actionMethod;

if (method_exists($seoController, $actionMethod)) {
$seoController->controller = $this->controller;
$seoController->view = $viewEvent->sender;
if (!method_exists($seoController, $actionMethod)) {
return false;
}

$meta = $seoController->$actionMethod($viewEvent->params);
$seoController->controller = $this->controller;
$seoController->view = $viewEvent->sender;

$this->addMeta($viewEvent->sender, $meta);
$this->addTitle($viewEvent->sender, $seoController->title);
$meta = $seoController->$actionMethod($viewEvent->params);

return true;
}
$this->addMeta($viewEvent->sender, $meta);
$this->addTitle($viewEvent->sender, $seoController->title);

return false;
return true;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "shershennm/yii2-seo",
"description": "Yii2 extension for simple generating keywords and description",
"version": "3.1.0",
"version": "3.1.1",
"type": "yii2-extension",
"keywords": ["yii2", "seo", "keywords", "meta", "link"],
"homepage": "https://github.com/shershennm/yii2-seo",
Expand Down

0 comments on commit 9ac1af6

Please sign in to comment.