File Upload field do not show in admin Column

Support MB Admin Columns File Upload field do not show in admin ColumnResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #32117
    Régis EvennouRégis Evennou
    Participant

    Hi,
    I use the builder to create a field group. The File Upload field shows well when i create the field, but when i change the field order in the group, it does no show any more.
    How can i fix it ?
    Thank you

    #32129
    Long NguyenLong Nguyen
    Moderator

    Hi,

    I do not see that issue on my end. Can you please share the code that creates the file upload field before and after re-ordering?

    #32138
    Régis EvennouRégis Evennou
    Participant

    Hi,
    Here is the code.
    Thank you 🙂

    <?php
    add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
    
    function your_prefix_function_name( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = [
            'title'      => __( 'Demande de résidence', 'your-text-domain' ),
            'id'         => 'cie-submit',
            'post_types' => ['espace-cie'],
            'fields'     => [
                [
                    'name' => __( 'Description du projet de résidence', 'your-text-domain' ),
                    'id'   => $prefix . 'description_du_projet_de_residence',
                    'type' => 'wysiwyg',
                ],
                [
                    'name'          => __( 'Nom de l\'auteur', 'your-text-domain' ),
                    'id'            => $prefix . 'nom_de_l\'auteur',
                    'type'          => 'text',
                    'desc'          => __( 'Le nom de l\'auteur du texte', 'your-text-domain' ),
                    'admin_columns' => 'after discipline_artistique',
                ],
                [
                    'name' => __( 'Distribution / Equipe', 'your-text-domain' ),
                    'id'   => $prefix . 'distribution_equipe',
                    'type' => 'wysiwyg',
                ],
                [
                    'name'          => __( 'Période souhaitée', 'your-text-domain' ),
                    'id'            => $prefix . 'periode_souhaitee',
                    'type'          => 'text',
                    'admin_columns' => 'after partenaires_du_projet',
                ],
                [
                    'name'          => __( 'Discipline artistique', 'your-text-domain' ),
                    'id'            => $prefix . 'discipline_artistique',
                    'type'          => 'text',
                    'admin_columns' => 'after title',
                ],
                [
                    'name'          => __( 'Image', 'your-text-domain' ),
                    'id'            => $prefix . 'artiste_image',
                    'type'          => 'image',
                    'admin_columns' => 'after title',
                ],
                [
                    'name' => __( 'Partenaires du projet', 'your-text-domain' ),
                    'id'   => $prefix . 'partenaires_du_projet',
                    'type' => 'wysiwyg',
                ],
                [
                    'id'                => $prefix . 'hidden_cie_name',
                    'type'              => 'hidden',
                    'admin_columns'     => [
                        'position'   => 'after title',
                        'title'      => 'Nom de la cie',
                        'sort'       => true,
                        'searchable' => true,
                        'filterable' => true,
                    ],
                    'sanitize_callback' => 'nom_de_la_cie',
                ],
                [
                    'name'          => __( 'File Upload ok', 'your-text-domain' ),
                    'id'            => $prefix . 'file_upload_ok',
                    'type'          => 'file_upload',
                    'admin_columns' => [
                        'position' => 'after artiste_image',
                        'title'    => 'Dossier',
                    ],
                ],
            ],
        ];
    
        return $meta_boxes;
    }

    ---- AFTER -------------------------------

    <?php
    add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
    
    function your_prefix_function_name( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = [
            'title'      => __( 'Demande de résidence', 'your-text-domain' ),
            'id'         => 'cie-submit',
            'post_types' => ['espace-cie'],
            'fields'     => [
                [
                    'name' => __( 'Description du projet de résidence', 'your-text-domain' ),
                    'id'   => $prefix . 'description_du_projet_de_residence',
                    'type' => 'wysiwyg',
                ],
                [
                    'name'          => __( 'File Upload ok', 'your-text-domain' ),
                    'id'            => $prefix . 'file_upload_ok',
                    'type'          => 'file_upload',
                    'admin_columns' => [
                        'position' => 'after artiste_image',
                        'title'    => 'Dossier',
                    ],
                ],
                [
                    'name'          => __( 'Nom de l\'auteur', 'your-text-domain' ),
                    'id'            => $prefix . 'nom_de_l\'auteur',
                    'type'          => 'text',
                    'desc'          => __( 'Le nom de l\'auteur du texte', 'your-text-domain' ),
                    'admin_columns' => 'after discipline_artistique',
                ],
                [
                    'name' => __( 'Distribution / Equipe', 'your-text-domain' ),
                    'id'   => $prefix . 'distribution_equipe',
                    'type' => 'wysiwyg',
                ],
                [
                    'name'          => __( 'Période souhaitée', 'your-text-domain' ),
                    'id'            => $prefix . 'periode_souhaitee',
                    'type'          => 'text',
                    'admin_columns' => 'after partenaires_du_projet',
                ],
                [
                    'name'          => __( 'Discipline artistique', 'your-text-domain' ),
                    'id'            => $prefix . 'discipline_artistique',
                    'type'          => 'text',
                    'admin_columns' => 'after title',
                ],
                [
                    'name'          => __( 'Image', 'your-text-domain' ),
                    'id'            => $prefix . 'artiste_image',
                    'type'          => 'image',
                    'admin_columns' => 'after title',
                ],
                [
                    'name' => __( 'Partenaires du projet', 'your-text-domain' ),
                    'id'   => $prefix . 'partenaires_du_projet',
                    'type' => 'wysiwyg',
                ],
                [
                    'id'                => $prefix . 'hidden_cie_name',
                    'type'              => 'hidden',
                    'admin_columns'     => [
                        'position'   => 'after title',
                        'title'      => 'Nom de la cie',
                        'sort'       => true,
                        'searchable' => true,
                        'filterable' => true,
                    ],
                    'sanitize_callback' => 'nom_de_la_cie',
                ],
            ],
        ];
    
        return $meta_boxes;
    }
    #32154
    Long NguyenLong Nguyen
    Moderator

    Hi,

    I see the issue. You need to register the field artiste_image before the field file_upload_ok to show the admin column after the field artiste_image.

    function your_prefix_function_name( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = [
            'title'      => __( 'Demande de résidence', 'your-text-domain' ),
            'id'         => 'cie-submit',
            'post_types' => ['espace-cie'],
            'fields'     => [
                [
                    'name' => __( 'Description du projet de résidence', 'your-text-domain' ),
                    'id'   => $prefix . 'description_du_projet_de_residence',
                    'type' => 'wysiwyg',
                ],
                [
                    'name'          => __( 'Image', 'your-text-domain' ),
                    'id'            => $prefix . 'artiste_image',
                    'type'          => 'image',
                    'admin_columns' => 'after title',
                ],
                [
                    'name'          => __( 'File Upload ok', 'your-text-domain' ),
                    'id'            => $prefix . 'file_upload_ok',
                    'type'          => 'file_upload',
                    'admin_columns' => [
                        'position' => 'after artiste_image',
                        'title'    => 'Dossier',
                    ],
                ],
                ...
            ],
        ];
    
        return $meta_boxes;
    }
    #32180
    Régis EvennouRégis Evennou
    Participant

    Ok thx 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.