hex-digital / acf-migrations

An easy way to migrate local fields and field groups using readable object oriented syntax (without the need for huge arrays)
MIT License
3 stars 1 forks source link

Locations parameter in addFieldGroup function does not support multiple arrays #3

Closed olivertappin closed 7 years ago

olivertappin commented 7 years ago

When creating a new field group with multiple locations, the exported code is in the wrong format. For example:

$migrations->addFieldGroup( 'global', [
        [
            'param' => 'post_type',
            'operator' => '==',
            'value' => 'page'
        ],
        [
            'param' => 'post_type',
            'operator' => '==',
            'value' => 'portfolio'
        ]
    ], [
        'hide_on_screen' => ['content_editor']
    ] )
    ->addField( 'image', 'Hero image' );

produces the following code within the export file:

...
"location" => [
    [
        [
            "param" => "post_type",
            "operator" => "==",
            "value" => "page"
        ],
        [
            "param" => "post_type",
            "operator" => "==",
            "value" => "portfolio"
        ]
    ]
],
...

when the arrays should be one level back, like so:

...
"location" => [
    [
        [
            "param" => "post_type",
            "operator" => "==",
            "value" => "page"
        ]
    ],
    [
        [
            "param" => "post_type",
            "operator" => "==",
            "value" => "portfolio"
        ]
    ]
],
...