テーマとかjQueryライブラリィの読み込むときにpreloadに使う
DelegateManager::add の(なんちゃって解釈)
引用:
引用:
例
開発支援ツール
suin-xoops/xoopscube-cheatsheet
参考:デリゲート名の一覧(2017.05.17)
DelegateManager::add の(なんちゃって解釈)
引用:
void DelegateManager->add(string $delegate_name,callable $callback [, int $priority ] [, string $filepath ] );
void DelegateManager->add(string $delegate_name,callable $callback [, int $priority ] [, string $filepath ] );
$delgate_ename : 登録されているデリゲート名
'Site.JQuery.AddFunction'等
$callback : コールバック実行可能な書式 (参照 call_user_func_array)
記述例1
$this->mRoot->mDelegateManager->add('Site.JQuery.AddFunction',array(&$this, 'addScript'));
記述例2
$this->mRoot->mDelegateManager->add('Site.JQuery.AddFunction','jQuery_Pretty::addScript');
$priority :省略可 : 整数 省略時は XCUBE_DELEGATE_PRIORITY_NORMAL , 50
デリゲートがcallされたときに、
数字が小さい順にそのデリゲート名に、登録された関数が実行されます。
(数字が小さい方が優先)
定義済定数
XCUBE_DELEGATE_PRIORITY_FIRST , 1
XCUBE_DELEGATE_PRIORITY_NORMAL , 50
XCUBE_DELEGATE_PRIORITY_FINAL , 100
例
通常より実行を後にしたい場合 XCUBE_DELEGATE_PRIORITY_NORMAL + 1
他の普通の実行より先に実行したい場合 XCUBE_DELEGATE_PRIORITY_NORMAL - 1
補足
`Site.JQuery.AddFunction`で、jsライブラリィ,cssスタイルシートの指定を追加する場合
XCUBE_DELEGATE_PRIORITY_NORMAL - 1 と優先度を上げた場合
一般設定で指定している「jQuery指定jss,cssのすぐ後」にそれぞれ追加されます
たとえば、cssのリンクの呼び出しは、
ヘッダー内の指定順で同じスタイル記述は、後に指定したものが上書きする認識なので、
cssのリンクの指定の場合、
この実行順をXCUBE_DELEGATE_PRIORITY_NORMAL + 1 と優先度を下げた方が
他の指定より表示では有効となります。
$filepath : 省略可 : $callbackを実行する直前に読み込むファイルのパス(require_once)
事前に読み込んでないと実行できない場合に、必要なファイルのパス
引用:
'Site.JQuery.AddFunction を例にしてみます
参考:このフックポイントは、テーマの書き出しのfunction renderThemeの
ブロック、mainモジュールのデータ処理後
xoops_meta_keywords等のテーマ用assign前XCube_DelegateUtils::call('Site.JQuery.AddFunction', new XCube_Ref($mContext->mAttributes['headerScript']));
例
<?php
if (!defined('XOOPS_ROOT_PATH'))
{
exit();
}
class jQuery_Pretty extends XCube_ActionFilter
{
public function preBlockFilter()
{
$this->mRoot->mDelegateManager->add('Site.JQuery.AddFunction',array(&$this, 'addScript'));
$this->mRoot->mDelegateManager->add('Site.JQuery.AddFunction',array(&$this, 'addCss'),XCUBE_DELEGATE_PRIORITY_NORMAL + 1);
}
public function addScript(&$headerScript)
{
$headerScript->addLibrary('/common/prettyphoto/js/jquery.prettyPhoto.js', true);
$headerScript->addLibrary('/common/prettyphoto/js/jQuery_Pretty.4preload.js', true);
}
public function addCss(&$headerScript)
{
$headerScript->addStylesheet('/common/prettyphoto/css/prettyPhoto.css', true);
}
//class END
}
?>
開発支援ツール
suin-xoops/xoopscube-cheatsheet
参考:デリゲート名の一覧(2017.05.17)
array (size=74)
0 => string 'Legacypage.Notifications.Access' (length=31)
1 => string 'Legacyfunction.Notifications.Select' (length=35)
2 => string 'Legacypage.Search.Access' (length=24)
3 => string 'Legacypage.Imagemanager.Access' (length=30)
4 => string 'Legacypage.Backend.Access' (length=25)
5 => string 'Legacypage.Misc.Access' (length=22)
6 => string 'User_UserViewAction.GetUserPosts' (length=32)
7 => string 'XCube_ServiceManager.CreateClient' (length=33)
8 => string 'XCube_ServiceManager.CreateServer' (length=33)
9 => string 'Legacypage.Userinfo.Access' (length=26)
10 => string 'Legacypage.Edituser.Access' (length=26)
11 => string 'Legacypage.Register.Access' (length=26)
12 => string 'Legacypage.User.Access' (length=22)
13 => string 'Legacypage.Lostpass.Access' (length=26)
14 => string 'Site.CheckLogin' (length=15)
15 => string 'Site.CheckLogin.Success' (length=23)
16 => string 'Site.Logout' (length=11)
17 => string 'Legacypage.Top.Access' (length=21)
18 => string 'XoopsTpl.New' (length=12)
19 => string 'Legacy_Controller.GetLanguageName' (length=33)
20 => string 'Legacy.Event.GetHandler' (length=23)
21 => string 'Legacy_Controller.CreateLanguageManager' (length=39)
22 => string 'Legacy_Mailer.ConvertLocal' (length=26)
23 => string 'Legacy_TextFilter.MakeClickableConvertTable' (length=43)
24 => string 'Legacy_TextFilter.MakeXCodeConvertTable' (length=39)
25 => string 'Legacy_TextFilter.MakeXCodeCheckImgPatterns' (length=43)
26 => string 'Legacy_TextFilter.MakePreXCodeConvertTable' (length=42)
27 => string 'Legacy_TextFilter.MakePostXCodeConvertTable' (length=43)
28 => string 'MyTextSanitizer.MakeClickablePre' (length=32)
29 => string 'MyTextSanitizer.XoopsCodePre' (length=28)
30 => string 'Legacy_ThemeSelect.IsSelectableTheme' (length=36)
31 => string 'LegacyThemeHandler.GetInstalledThemes' (length=37)
32 => string 'XCube_Session.SetupSessionHandler' (length=33)
33 => string 'XCube_Session.GetSessionCookiePath' (length=34)
34 => string 'Site.JQuery.AddFunction' (length=23)
35 => string 'Legacy_RenderSystem.BeginRender' (length=31)
36 => string 'Legacy_ActionFrame.CreateAction' (length=31)
37 => string 'Module.xupdate.Global.Event.GetAssetManager' (length=43)
38 => string 'Legacy_Utils.CreateModule' (length=25)
39 => string 'Legacy_Utils.CreateBlockProcedure' (length=33)
40 => string 'Legacy.Admin.Event.ModuleListSave.Success' (length=41)
41 => string 'Legacy.Admin.Event.ModuleInstall.Success' (length=40)
42 => string 'Legacy.Admin.Event.ModuleUpdate.Success' (length=39)
43 => string 'Legacy.Admin.Event.ModuleUninstall.Success' (length=42)
44 => string 'Legacy_TagClient.GetClientList' (length=30)
45 => string 'Legacy_TagClient.xupdate.GetClientData' (length=38)
46 => string 'Legacyblock.Waiting.Show' (length=24)
47 => string 'Legacy_AdminControllerStrategy.SetupBlock' (length=41)
48 => string 'Legacypage.Admin.SystemCheck' (length=28)
49 => string 'Site.TextareaEditor.BBCode.Show' (length=31)
50 => string 'Site.TextareaEditor.HTML.Show' (length=29)
51 => string 'Site.TextareaEditor.None.Show' (length=29)
52 => string 'Legacy_ModuleInstallAction.InstallSuccess' (length=41)
53 => string 'Legacy_ModuleUpdateAction.UpdateSuccess' (length=39)
54 => string 'Legacy_ModuleUninstaller._fireNotifyUninstallTemplateBegun' (length=58)
55 => string 'Module.profile.Event.GetAssetManager' (length=36)
56 => string 'Legacy_Profile.SaveProfile' (length=26)
57 => string 'Legacy_Profile.GetDefinition' (length=28)
58 => string 'Legacy_Profile.GetProfile' (length=25)
59 => string 'Legacy_Profile.SetupActionForm' (length=30)
60 => string 'Legacy_Profile.LoadActionForm' (length=29)
61 => string 'Legacy.Event.UserDelete' (length=23)
62 => string 'Legacy.Admin.Event.UserDelete' (length=29)
63 => string 'Legacy_Controller.SetupUser' (length=27)
64 => string 'Legacy_RenderSystem.SetupXoopsTpl' (length=33)
65 => string 'Legacy_BackendAction.GetRSSItems' (length=32)
66 => string 'Ckeditor4.Utils.PreBuild_ckconfig' (length=33)
67 => string 'Myfriend.NewAlert' (length=17)
68 => string 'Legacypage.Viewpmsg.Access' (length=26)
69 => string 'Legacypage.Readpmsg.Access' (length=26)
70 => string 'Legacypage.Pmlite.Access' (length=24)
71 => string 'MyTextSanitizer.MakeClickablePostFilter' (length=39)
72 => string 'MyTextSanitizer.XoopsCodePostFilter' (length=35)
73 => string 'Legacy.SetupModuleContextSuccess' (length=32)
RedirectMessageJgrowl.class.php |
XCL2.2関連 |