Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions plugins/baser-core/src/View/Helper/BcBaserHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,8 @@ public function getContentsName($detail = false, $options = [])
if (isset($url[1])) $url1 = $url[1];
if (isset($url[2])) $url2 = $url[2];

// 固定ページの場合
if (!BcUtil::isAdminSystem()) {
// 固定ページの場合(プラグインルーティング時を除く)
if (!BcUtil::isAdminSystem() && (!$plugin || $plugin === 'BaserCore')) {
$pageUrl = h($request->getPath());
if ($pageUrl === false) $pageUrl = '/';

Expand All @@ -758,7 +758,7 @@ public function getContentsName($detail = false, $options = [])
$aryUrl = explode('/', $pageUrl);
} else {
// プラグインルーティングの場合
if ((($url1 == '' && in_array($action, ['index', 'mobile_index', 'smartphone_index'])) || ($url1 == $action)) && $url2 != $action && $plugin) {
if ((($url1 == '' && in_array($action, ['index', 'mobile_index', 'smartphone_index'], true)) || ($url1 == $action)) && $url2 != $action && $plugin) {
$prefix = $plugin = '';
$controller = $url0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,17 @@ public function testGetContentsName($expects, $url, $detail = false, $options =

if (!empty($options['language'])){
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = $options['language'];
unset($options['device']);
unset($options['language']);
}

$request = $this->getRequest($url);
if (!empty($options['requestParams'])) {
$request = $request->withAttribute('params', array_merge((array) $request->getAttribute('params'), $options['requestParams']));
unset($options['requestParams']);
}

$this->BcBaser = new BcBaserHelper(new View());
$this->BcBaser->getView()->setRequest($this->getRequest($url));
$this->BcBaser->getView()->setRequest($request);

if (!empty($options['error'])) {
$reflectionClass = new ReflectionClass(get_class($this->BcBaser->getView()));
Expand Down Expand Up @@ -616,6 +622,9 @@ public static function getContentsNameDataProvider()
['Hoge', '/about', false, ['default' => 'Hoge']],
['service_service1', '/service/service1', true, ['underscore' => true]],
['Error!!!', '/', false, ['error' => 'Error!!!']],
// プラグイン(フロント)
['MailMessages', '/mail_messages', false, ['requestParams' => ['plugin' => 'BcMail', 'controller' => 'MailMessages', 'action' => 'index']]],
['MailMessagesIndex', '/mail_messages', true, ['requestParams' => ['plugin' => 'BcMail', 'controller' => 'MailMessages', 'action' => 'index']]],
// スマートフォン
['Home', '/s/', false, ['device' => 'iPhone']],
// 英語サイト
Expand Down
Loading