Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `<?php
- add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
- function your_prefix_function_name( $meta_boxes ) {
- $prefix = '';
- $meta_boxes[] = [
- 'title' => __( 'command-form', 'your-text-domain' ),
- 'id' => 'command-form',
- 'post_types' => ['commande-en-ligne'],
- 'fields' => [
- [
- 'name' => __( 'Votre Nom', 'your-text-domain' ),
- 'id' => $prefix . 'name',
- 'type' => 'text',
- 'required' => 1,
- 'admin_columns' => [
- 'position' => 'replace title',
- 'title' => 'De:',
- ],
- 'columns' => 4,
- ],
- [
- 'name' => __( 'Téléphone', 'your-text-domain' ),
- 'id' => $prefix . 'telephone',
- 'type' => 'text',
- 'required' => 1,
- 'columns' => 4,
- 'save_field' => 1,
- ],
- [
- 'name' => __( 'Courriel', 'your-text-domain' ),
- 'id' => $prefix . 'courriel',
- 'type' => 'text',
- 'required' => 1,
- 'admin_columns' => [
- 'position' => 'after name',
- 'title' => 'Courriel',
- ],
- 'columns' => 8,
- 'save_field' => 1,
- ],
- [
- 'name' => __( 'Commande', 'your-text-domain' ),
- 'id' => $prefix . 'commande',
- 'type' => 'group',
- 'clone' => 1,
- 'add_button' => __( 'Ajouter +', 'your-text-domain' ),
- 'save_field' => 1,
- 'fields' => [
- [
- 'name' => __( 'Item', 'your-text-domain' ),
- 'id' => $prefix . 'item',
- 'type' => 'text',
- 'required' => 1,
- 'columns' => 4,
- 'class' => 'pile-up',
- 'save_field' => 1,
- ],
- [
- 'name' => __( 'Quantité', 'your-text-domain' ),
- 'id' => $prefix . 'qty',
- 'type' => 'number',
- 'min' => 1,
- 'std' => 1,
- 'required' => 1,
- 'columns' => 2,
- 'save_field' => 1,
- ],
- [
- 'name' => __( 'Code BMR', 'your-text-domain' ),
- 'id' => $prefix . 'code_bmr',
- 'type' => 'text',
- 'columns' => 2,
- 'save_field' => 1,
- ],
- ],
- ],
- [
- 'name' => __( 'Réception', 'your-text-domain' ),
- 'id' => $prefix . 'reception',
- 'type' => 'radio',
- 'options' => [
- 'cueillette' => __( 'Cueillette', 'your-text-domain' ),
- 'livraison' => __( 'Livraison', 'your-text-domain' ),
- ],
- 'required' => 1,
- 'admin_columns' => [
- 'position' => 'after courriel',
- 'title' => 'Réception',
- ],
- 'save_field' => 1,
- 'inline' => false,
- ],
- [
- 'name' => __( 'Destination', 'your-text-domain' ),
- 'id' => $prefix . 'destination',
- 'type' => 'group',
- 'save_field' => 1,
- 'fields' => [
- [
- 'name' => __( 'Adresse', 'your-text-domain' ),
- 'id' => $prefix . 'adresse',
- 'type' => 'text',
- 'columns' => 8,
- 'save_field' => 1,
- ],
- [
- 'name' => __( 'Ville', 'your-text-domain' ),
- 'id' => $prefix . 'ville',
- 'type' => 'text',
- 'columns' => 5,
- 'save_field' => 1,
- ],
- [
- 'name' => __( 'Code postal', 'your-text-domain' ),
- 'id' => $prefix . 'code_postal',
- 'type' => 'text',
- 'columns' => 3,
- 'save_field' => 1,
- ],
- ],
- 'hidden' => [
- 'when' => [['reception', '!=', 'livraison']],
- 'relation' => 'or',
- ],
- ],
- [
- 'name' => __( 'Méthode de Paiement', 'your-text-domain' ),
- 'id' => $prefix . 'paiement',
- 'type' => 'checkbox_list',
- 'options' => [
- 'comptant' => __( 'Comptant', 'your-text-domain' ),
- 'credit' => __( 'Crédit', 'your-text-domain' ),
- 'telephone' => __( 'Téléphone (crédit)', 'your-text-domain' ),
- ],
- 'save_field' => 1,
- ],
- ],
- ];
- return $meta_boxes;
- }`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement