- 2020.07.08
- 조회수 211
- 댓글수 0
artisan으로 스킨을 만들었습니다.
$ php artisan make:skin helloworld HelloProfile member/profile
음,... 그런데, 관리자 페이지를 아무리 뒤적여봐도 이걸 적용해볼 방법이 ... ??
메뉴얼에서는 회원 아코디언 메뉴를 열면 설정 메뉴가 있어서 거기 들어가서 스킨을 변경할 수 있을 거라고 기술하고 있는데, 스킨을 변경할 수 있는 메뉴를 도무지 찾을 수가 없어요. 어디서 찾아 볼 수 있을까요?
![]()
P.S.
기능 자체가 구현되어 있는건 확인 했습니다.
--> app/Http/Sections/SkinSection.php
얘가 어딘가에서 인스턴싱을 해줘야 메뉴얼대로 동작할거 같은데,
/**
* SkinSection constructor.
*
* @param string $target target
* @param string|null $instanceId instance id
*/
public function __construct($target, $instanceId = null)
{
$this->target = $target;
$this->instanceId = $instanceId;
throw new \Exception();
}
이렇게 해줘도 예외가 발생하지 않는다는건 얘를 어디에서도 인스턴싱하고 있지 않다는 의미겠죠....?
근데 어디서 해주는지 알수가 없... 흑... ㅠ_ㅠ
동작하는 친구(ToggleMenuSection)한테 throw new Exception 이 코드를 옮겨서 터트려 봤더니 SettingController라는 클래스에서 걔를 인스턴싱 하는걸 발견했습니다. 근데 그 위치를 추적하기가 조금 난해하네요.
in ToggleMenuSection.php line 55
at ToggleMenuSection->__construct()
in SettingController.php line 231
at SettingController->editToggleMenu()
at call_user_func_array()
in Controller.php line 54
at Controller->callAction()
in ControllerDispatcher.php line 45
at ControllerDispatcher->dispatch()
in Route.php line 212
P.S. 2.
찾긴 찾았는데, 다시 원점이네요....
j94k@j94k:/j94k/var/www$ find -type f | grep SettingController.php
./plugins/comment/src/Controllers/SettingController.php
./plugins/ckeditor/components/EditorTools/IframeTool/SettingController.php
./app/Http/Controllers/User/Settings/SettingController.php
/**
* edit Skin setting
*
* @return \Xpressengine\Presenter\Presentable
*/
public function editSkin()
{
$authSkinSection = new SkinSection('user/auth');
$settingsSkinSection = new SkinSection('user/settings');
$profileSkinSection = new SkinSection('user/profile');
return XePresenter::make(
'user.settings.setting.skin',
compact('authSkinSection', 'settingsSkinSection', 'profileSkinSection')
);
}
/**
* edit ToggleMenu setting
*
* @return \Xpressengine\Presenter\Presentable
*/
public function editToggleMenu()
{
$toggleMenuSection = new ToggleMenuSection('user');
return XePresenter::make(
'user.settings.setting.usermenu',
compact('toggleMenuSection')
);
}
저 메서드를 어디서 메뉴에 등록하는지를 추적할 수가...ㅠ_ㅠ
----
목표를 변경했습니다.
core/src/Xpressengine/Settings/SettingsMenu.php 파일에 addChild 메서드가 있더군요.
/**
* addChild
*
* @param NodeInterface $item one child node - menu item
*
* @return void
*/
public function addChild(NodeInterface $item)
{
$this->childItems[$item->id] = $item;
throw new \Exception();
}
여기서 예외를 발생시켜서 추적하면 될거 같은 기분이 듭니다.
여기서도 별다른 소득이 없었습니다.
SettingsHandler에서 addChild 메서드를 호출하는걸 발견하긴 했는데, 얘 또한 $this->router를 참조하므로 의미가 없었...
--
찾은거 같아요. SettingsHandler도 같은 방법으로 터트려서
in SettingsHandler.php line 94
at SettingsHandler->__construct()
at call_user_func_array()
in ProxyTrait.php line 69
at Proxy_Xpressengine_Settings_SettingsHandler->_proxyMethodCall()
in Proxy_Xpressengine_Settings_SettingsHandler.php line 10
at Proxy_Xpressengine_Settings_SettingsHandler->__construct()
in SettingsServiceProvider.php line 52
at SettingsServiceProvider->App\Providers\{closure}()
in Container.php line 749
SettingsServiceProvider.php 이 친구가 그 메뉴들을 등록해주는 메서드를 데리고 있는걸 확인했습니다.
/**
* Register the setting menus.
*
* @return void
*/
private function registerSettingsMenus()
{
$menus = $this->app['config']->get('xe.settings.menus');
$register = $this->app['xe.register'];
foreach ($menus as $id => $menu) {
$register->push('settings/menu', $id, $menu);
}
}
FINAL.
너무 멀리 돌아갔네요 ㅇ_ㅇ...
등잔 밑이 어둡다고 해야하나... 너무도 찾기 쉬운곳에 그 관련 설정이 있었습니다.
config/xe.php............
하하.... 그걸 기반으로 메뉴 등록 루틴을 찾아서 저 메뉴를 되살려야 겠습니다.
이걸 관리하게될 사람이 이 파일을 수정할 수 있을리 없으니까요...ㅡ_ㅠ;
머리가 부서질거 같아요.ㅠ_ㅠ
FINAL. 2.
메뉴 위치가 메뉴얼과 다르더라구요.
"테마 디자인 -> 글로벌 메뉴 스킨"
..........
그런데, 여전히 새로 추가한 스킨이 목록에 뜨지 않아요...
REALLY FINAL
문제를 찾았습니다.
--
위의 예시에서 생성한 스킨의 아이디는 member/profile/skin/my_plugin@profile입니다.
--
공식 가이드 문서에서 member/profile이라고 소개를 하고 있는데,
XE3 구현부에서 참조하는 실제 스킨의 아이디는 user/profile/skin/my_plugin@profile 여야 합니다.
그런데 artisan은 이 스킨의 ID를 member/profile/... 으로 생성을 하고 있습니다.
--> 이건 제가 공식 가이드 문서를 기준으로 명령을 내려서 그런거더라구요...;; 하하;;
이 부분을 주의하셔야 할 것 같네요.
... 흑...
+ 추가하고 노출되게 만드려면
$ php artisan make:skin [Plugin Name] [Skin Name] user/settings
1. user/settings: 사용자 마이페ㅐ이지
2. user/auth: 사용자 회원 가입/로그인
3. user/profile: 사용자 프로필
$ php artisan cache:clear
$ php artisan view:clear
$ php artisan plugin:sync-composer
이렇게 명령을 주고 나서 익스텐션 메뉴에 가서 [Plugin Name] 플러그인을 비활성 시켰다가, 다시 활성화 시켜줘야 목록에 뜹니다.
![]()
0개 댓글