Support Forum » User Profile

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: ACF Migrate Issue #36323
    Paul MiddletonPaul Middleton
    Participant

    Ok, I've submitted login info for a staging site where you can check things out.

    in reply to: ACF Migrate Issue #36280
    Paul MiddletonPaul Middleton
    Participant

    Here's the code:

    <?php
    add_filter( 'rwmb_meta_boxes', 'resource_data' );
    
    function resource_data( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = [
            'title'      => __( 'Resource Data', 'oslc' ),
            'id'         => 'acf_group_53e11a12c9378',
            'post_types' => ['resource', 'attachment'],
            'fields'     => [
                [
                    'name'       => __( 'Authors', 'oslc' ),
                    'id'         => $prefix . 'authors',
                    'type'       => 'group',
                    'clone'      => true,
                    'sort_clone' => true,
                    'max_clone'  => 0,
                    'add_button' => __( 'Add Row', 'oslc' ),
                    'fields'     => [
                        [
                            'name'     => __( 'Author Type', 'oslc' ),
                            'id'       => $prefix . 'author_type',
                            'type'     => 'select',
                            'options'  => [
                                'scientist' => __( 'OSLC Scientist', 'oslc' ),
                                'other'     => __( 'Other', 'oslc' ),
                            ],
                            'std'      => 'scientist',
                            'required' => true,
                        ],
                        [
                            'name'      => __( 'OSLC Scientist', 'oslc' ),
                            'id'        => $prefix . 'scientist',
                            'type'      => 'post',
                            'post_type' => ['scientist'],
                            'visible'   => [
                                'when'     => [['author_type', '=', 'scientist']],
                                'relation' => 'and',
                            ],
                        ],
                        [
                            'name'    => __( 'Other', 'oslc' ),
                            'id'      => $prefix . 'other',
                            'type'    => 'text',
                            'visible' => [
                                'when'     => [['author_type', '=', 'other']],
                                'relation' => 'and',
                            ],
                        ],
                    ],
                ],
                [
                    'name'        => __( 'Attachment Type', 'oslc' ),
                    'id'          => $prefix . 'attachment_type',
                    'type'        => 'select',
                    'options'     => [
                        'File' => __( 'File', 'oslc' ),
                        'Link' => __( 'Link', 'oslc' ),
                    ],
                    'placeholder' => __( '- Select -', 'oslc' ),
                ],
                [
                    'name'             => __( 'File', 'oslc' ),
                    'id'               => $prefix . 'file',
                    'type'             => 'file_advanced',
                    'max_file_uploads' => 1,
                    'visible'          => [
                        'when'     => [['attachment_type', '=', 'File']],
                        'relation' => 'and',
                    ],
                    'max_status'       => false,
                ],
                [
                    'name'    => __( 'Link Text', 'oslc' ),
                    'id'      => $prefix . 'link_text',
                    'type'    => 'text',
                    'visible' => [
                        'when'     => [['attachment_type', '=', 'Link']],
                        'relation' => 'and',
                    ],
                ],
                [
                    'name'    => __( 'Link URL', 'oslc' ),
                    'id'      => $prefix . 'link_url',
                    'type'    => 'text',
                    'visible' => [
                        'when'     => [['attachment_type', '=', 'Link']],
                        'relation' => 'and',
                    ],
                ],
            ],
        ];
    
        return $meta_boxes;
    }

    And here's a screenshot of the fields not being editable:

    screenshot

Viewing 2 posts - 1 through 2 (of 2 total)