Pickles 2 の設定項目のうち、CMSの動作を制御する設定項目 $conf->plugins->px2dt について説明します。
$conf->plugins->px2dt は、 CMS の動作を制御する設定情報を格納します。
Pickles 2 を操作するCMSには、 Clover CMS や Pickles 2 Desktop Tool (babycorn) などがあります。
これらの設定は、pickles2/px2-px2dthelper プラグインが参照したり、 CMS機能が直接参照したり、様々な機能から参照され、適切に振る舞います。
$conf->plugins->px2dt->paths_module_templateモジュールセットのパスを設定します。 連想配列のキーは、モジュールのパッケージIDとして使われます。
// 例:
$conf->plugins->px2dt->paths_module_template = array(
"package_id_001" => "./path/to/module_package_001/",
"package_id_002" => "./path/to/module_package_002/",
);
$conf->plugins->px2dt->path_module_templates_dirモジュールセットが格納されているディレクトリへのパスを設定します。
// 例:
$conf->plugins->px2dt->path_module_templates_dir = "../px-files/modules/";
$conf->plugins->px2dt->contents_area_selectorテーマから提供されるHTML内で、コンテンツエリアとして認識するべき要素を示す条件を、セレクタで指定します。
// 例:
$conf->plugins->px2dt->contents_area_selector = '[data-contents-area]';
この例のように設定した場合、 data-contents-area 属性がついている要素が、コンテンツの編集可能領域であると認識されます。
複数の要素がマッチすることも許容されますが、各要素に名前を与えて区別できるようになっている必要があります。
$conf->plugins->px2dt->contents_bowl_name_by に設定する属性名で、コンテンツエリアの名前を記述するようにします。
空白された場合は、 main という名前で識別されます。
$conf->plugins->px2dt->contents_bowl_name_byコンテンツエリアの名前を取得する属性名を設定します。
// 例:
$conf->plugins->px2dt->contents_bowl_name_by = 'data-contents-area';
この例のように設定した場合、 $conf->plugins->px2dt->contents_area_selector から検索された要素についている data-contents-area 属性の値を取得し、これをコンテンツエリアの名前として認識します。
コンテンツエリア名が空白の場合、デフォルトで main という名前で識別します。
$conf->plugins->px2dt->publish_patternsよく使うパブリッシュ設定を登録することができます。
ここで登録したパブリッシュ設定は、パブリッシュ画面から選択して自動入力できます。
// 例:
$conf->plugins->px2dt->publish_patterns = array(
array(
'label'=>'すべて',
'paths_region'=> array('/'),
'paths_ignore'=> array(),
'keep_cache'=>false,
),
array(
'label'=>'共有リソース',
'paths_region'=> array('/common/'),
'paths_ignore'=> array(),
'keep_cache'=>false,
),
array(
'label'=>'ブログ (一覧のみ)',
'paths_region'=> array('/blog/'),
'paths_ignore'=> array('/blog/articles/'),
'keep_cache'=>true,
),
);
$conf->plugins->px2dt->path_contents_templates_dirコンテンツテンプレートが格納されているディレクトリへのパスを設定します。
// 例:
$conf->plugins->px2dt->path_contents_templates_dir = "../px-files/contents_templates/";
$conf->plugins->px2dt->guieditor$conf->plugins->px2dt->guieditor->dropped_file_operator// 例:
$droppedImageOperator = \pickles2\px2style\utils::droppedFileOperator('image');
$conf->plugins->px2dt->guieditor->dropped_file_operator = array(
'png' => $droppedImageOperator,
'gif' => $droppedImageOperator,
'jpg' => $droppedImageOperator,
'svg' => $droppedImageOperator,
'application/svg+xml' => $droppedImageOperator,
);
$conf->plugins->px2dt->guieditor->path_data_dir// 例:
$conf->plugins->px2dt->guieditor->path_data_dir = '{$dirname}/{$filename}_files/guieditor.ignore/';
$conf->plugins->px2dt->guieditor->path_resource_dir// 例:
$conf->plugins->px2dt->guieditor->path_resource_dir = '{$dirname}/{$filename}_files/resources/';
$conf->plugins->px2dt->guieditor->custom_fields// 例:
$conf->plugins->px2dt->guieditor->custom_fields = array(
// フィールド設定例
'foobar' => array(
'backend'=>array(
'class' => 'class_name\\of\\php_version',
'require' => './path/to/js_version.js',
),
'frontend'=>array(
'dir' => './path/to/frontend_resources/',
'file' => array(
'foobar.css',
'foobar.js',
),
'function' => 'window.BroccoliFieldFoobar'
),
),
// 設定済みの名前から参照する例
'hogefuga' => "foobar",
);
$conf->plugins->px2dt->guieditor->field_config// 例:
$conf->plugins->px2dt->guieditor->field_config = array(
// image フィールドを設定
'image' => array(
'filenameAutoSetter' => 'random', // random = 画像ファイル名をランダムに自動命名する。
),
);
$conf->plugins->px2dt->guiEngine次の値のいずれかを設定します。
legacy = 旧GUI編集ツール。(廃止)broccoli-html-editor = NodeJSで実装された broccoli-html-editor を使用。(非推奨)broccoli-html-editor-php = PHPで実装された broccoli-html-editor を使用。これは、古い設定項目です。
かつてブロックエディタに複数のバージョンが検討されていたときに、それを選択する設定でした。 2023/1/14 現在、 broccoli-html-editor-php のみが引き続きサポートされています。
$conf->plugins->px2dt->custom_console_extensions管理画面の拡張項目を設定します。
// 例
/**
* CMS画面に追加するカスタム管理画面を登録する
*/
$conf->plugins->px2dt->custom_console_extensions = array(
'sample' => 'yourVendorName\customConsoleExtensions\sample\main',
);
詳しくは、管理画面拡張のページを参照してください。