Skip to content

Commit

Permalink
サイト編集時、テーマを変更しても、テーマ管理に反映されない問題を改善
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Dec 4, 2023
1 parent cdcf8ab commit 6a2fd35
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions plugins/baser-core/src/Model/Table/SitesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use BaserCore\Utility\BcUtil;
use BaserCore\Utility\BcAgent;
use Cake\Event\EventInterface;
use Cake\Routing\Router;
use Cake\Validation\Validator;
use BaserCore\Model\Entity\Site;
use Cake\Datasource\EntityInterface;
Expand Down Expand Up @@ -725,4 +726,25 @@ public function beforeSave(EventInterface $event, EntityInterface $entity, Array
return true;
}

/**
* 保存時に管理画面のセッション中のカレントサイトと同じデータの保存の場合、
* セッションにも反映する
*
* @param EntityInterface $entity
* @param array $options
* @return bool
* @checked
* @noTodo
*/
public function save(EntityInterface $entity, $options = [])
{
$success = parent::save($entity, $options);
$session = Router::getRequest()->getSession();
$currentSite = $session->read('BcApp.Admin.currentSite');
if($success->id === $currentSite->id) {
$session->write('BcApp.Admin.currentSite', $success);
}
return $success;
}

}

0 comments on commit 6a2fd35

Please sign in to comment.