本文整理汇总了PHP中Field::collection方法的典型用法代码示例。如果您正苦于以下问题:PHP Field::collection方法的具体用法?PHP Field::collection怎么用?PHP Field::collection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field::collection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
$options = Page::make('options', 'Configuration SLHB')->set(['capability' => 'manage_options', 'icon' => 'dashicons-hammer', 'position' => 50, 'tabs' => true]);
// Partenaires Section
$sections[] = Section::make('section-slhb-options', 'Paramètres généraux');
$options->addSections($sections);
$settings['section-slhb-options'] = [Field::collection('logos', ['title' => 'Logos des partenaires']), Field::text('facebook_url', ['title' => 'Url Facebook']), Field::text('gmap_url', ['title' => 'Url vers la page de contact', 'default' => '/infos-utiles'])];
$options->addSettings($settings);
示例2: __
<?php
$cat = Taxonomy::make('product-category', 'products', __('Product Categories', THEME_TEXT_DOMAIN), __('Product Category', THEME_TEXT_DOMAIN))->set(['public' => true, 'show_in_nav_menus' => true, 'hierarchical' => true, 'show_tagcloud' => true, 'show_in_quick_edit' => true]);
$tag = Taxonomy::make('product-tag', 'products', __('Product Tags', THEME_TEXT_DOMAIN), __('Product Tag', THEME_TEXT_DOMAIN))->set(['public' => true, 'show_in_nav_menus' => true, 'hierarchical' => true, 'show_tagcloud' => true, 'show_in_quick_edit' => true]);
$products = PostType::make('products', __('Products', THEME_TEXT_DOMAIN), __('Product', THEME_TEXT_DOMAIN))->set(['public' => true, 'labels' => ['add_item' => __('Add', THEME_TEXT_DOMAIN)], 'supports' => array('title', 'excerpt', 'thumbnail', 'revisions'), 'taxonomies' => array('product-category', 'product-tag')]);
$infos = Metabox::make('Informations', $products->getSlug())->set(array(Field::textarea('description'), Field::collection('images', ['type' => 'images']), Field::infinite('info', [Field::text('title'), Field::textarea('value')])));
/*-----------------------------------------------------------------------*/
// Book info validation
/*-----------------------------------------------------------------------*/
$infos->validate(array());
示例3: __
<?php
$cat = Taxonomy::make('gallery-category', 'galleries', __('Gallery Categories', THEME_TEXT_DOMAIN), __('Gallery Category', THEME_TEXT_DOMAIN))->set(['public' => true, 'show_in_nav_menus' => true, 'hierarchical' => true, 'show_tagcloud' => true, 'show_in_quick_edit' => true]);
$tag = Taxonomy::make('gallery-tag', 'galleries', __('Gallery Tags', THEME_TEXT_DOMAIN), __('Gallery Tag', THEME_TEXT_DOMAIN))->set(['public' => true, 'show_in_nav_menus' => true, 'hierarchical' => true, 'show_tagcloud' => true, 'show_in_quick_edit' => true]);
$galleries = PostType::make('galleries', __('Galleries', THEME_TEXT_DOMAIN), __('Gallery', THEME_TEXT_DOMAIN))->set(['public' => true, 'labels' => ['add_item' => __('Add', THEMOSIS_TEXTDOMAIN)], 'supports' => array('title', 'excerpt', 'thumbnail', 'revisions'), 'taxonomies' => ['gallery-category', 'gallery-tag']]);
$infos = Metabox::make('Informations', $galleries->getSlug())->set(array(Field::collection('images', ['type' => 'images'])));
/*-----------------------------------------------------------------------*/
// Book info validation
/*-----------------------------------------------------------------------*/
//$infos->validate(array(
// 'title' => array('textfield', 'min:5')
//));
示例4: array
<?php
$team = PostType::make('slhb_team', 'Les équipes', 'équipe')->set(array('public' => true, 'menu_position' => 20, 'supports' => array('title', 'editor'), 'rewrite' => false, 'query_var' => false, 'labels' => ['add_new_item' => 'Ajouter une nouvelle équipe', 'add_new' => 'Ajouter une équipe', 'add_item' => 'Ajouter une équipe', 'all_items' => 'Toutes les équipes', 'edit_item' => 'Modifier une équipe']));
/*-----------------------------------------------------------------------*/
// Team informations
/*-----------------------------------------------------------------------*/
$infos = Metabox::make('Informations sur l\'équipe', $team->get('name'))->set(array(Field::media('profile', ['title' => 'Photo de groupe de l\'équipe ']), Field::select('Niveau', [['Excellence Région', 'Honneur Région', 'Pré-Région', 'Deuxième division']], ['title' => 'Quelle division? ']), Field::collection('gallery')));