Manifest.php のサンプル
出典: SugarForum.jp
Developer Guide に掲載されたサンプルは、エラーが多すぎて使えないので、整理したものを下記に記載します。
パラメータの設定方法については、モジュールローダを参照。
<?php
$manifest = array(
'acceptable_sugar_versions' => array(),
'is_uninstallable' => true,
'name' => 'Song Module',
'description' => 'A Module for all your song needs',
'author' => 'Ajay',
'published_date' => '2005/08/11',
'version' => '2.0',
'type' => 'module',
'icon' => ,
'dependencies' => array (
array ('id_name' => 'whale_pod', 'version' => '1.0'),
array ('id_name' => 'maps', 'version' => '1.5'),
),
);
$installdefs = array (
'id' => 'songs',
'image_dir' => '<basepath>/images',
'copy' => array (
array (
'from' => '<basepath>/module/Songs',
'to' => 'modules/Songs',
),
),
'language' => array (
array (
'from' => '<basepath>/administration/en_us.songsadmin.php',
'to_module' => 'Administration',
'language' => 'en_us'
),
),
'layoutdefs'=> array(
array(
'from' => '<basepath>/layoutdefs/contacts_layout_defs.php',
'to_module' => 'Contacts',
),
),
'vardefs'=> array(
array(
'from' => '<basepath>/vardefs/contacts_vardefs.php',
'to_module' => 'Contacts',
),
),
'administration'=> array (
array (
'from' => '<basepath>/administration/songsadminoption.php',
),
),
'beans'=> array (
array (
'module' => 'Songs',
'class' => 'Song',
'path' => 'modules/Songs/Song.php',
'tab'=> true,
),
),
'relationships'=>array (
array (
'module' => 'Contacts',
'meta_data' => '<basepath>/relationships/contacts_songsMetaData.php',
'module_vardefs' => '<basepath>/vardefs/contacts_vardefs.php',
'module_layoutdefs' => '<basepath>/layoutdefs/contactslayout_defs.php'
),
array (
'module' => 'Products',
'meta_data' => '<basepath>/relationships/products_songsMetaData.php',
'module_vardefs' => '<basepath>/vardefs/products_vardefs.php',
'module_layoutdefs' => '<basepath>/layoutdefs/productslayout_defs.php'
),
),
'custom_fields'=>array (
array (
'name' => 'music_name',
'label' => 'Music Name',
'type' => 'varchar',
'max_size'=>255,
'require_option' => 'optional',
'default_value' => ' ',
'ext1' => 'name',
'ext2' => 'Accounts',
'ext3' => ' ',
'audited'=>0,
'module' => 'Songs',
),
array (
'name' => 'label_company',
'label' => 'Label',
'type' => 'relate',
'max_size'=>36,
'require_option' => 'optional',
'default_value' => ,
'ext1' => 'name',
'ext2' => 'Accounts',
'ext3' => , 'audited'=>0,
'module' => 'Songs',
),
),
);
$upgrade_manifest = array (
'upgrade_paths' => array (
'1.0' => array(
'id' => 'songs',
'copy'=>array(
array (
'from' => '<basepath>/module/Songs',
'to' => 'modules/Songs',
),
),
),
'1.5' => array (
'id' => 'songs',
'copy' => array(
array (
'from' => '<basepath>/module/Songs',
'to' => 'modules/Songs',
),
),
),
);
?>