Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Position is not able to be changed #7

Closed
Jamiewarb opened this issue Jun 12, 2017 · 2 comments
Closed

Position is not able to be changed #7

Jamiewarb opened this issue Jun 12, 2017 · 2 comments
Assignees
Labels

Comments

@Jamiewarb
Copy link
Member

Jamiewarb commented Jun 12, 2017

When using the position attribute to move a group to the sidebar of the edit page, I've encountered an error with the migrations script.

It appears that the option is added always as position => normal, even when position => side is declared, as shown below.

The expected outcome as created in Custom Fields plugin:

acf_add_local_field_group(array (
    ...
    'menu_order' => 0,
    'position' => 'side',
    'style' => 'default',
    'label_placement' => 'top',
    'instruction_placement' => 'label',
    'hide_on_screen' => '',
    'active' => 1,
    'description' => '',
));

The actual outcome in export.php:

...
"options" => [
    "position" => "normal",
    "hide_on_screen" => ""
],
"menu_order" => 0,
"position" => "side",
"style" => "default",
"label_placement" => "top",
"instruction_placement" => "label",
"hide_on_screen" => "",
"active" => 1,
"description" => ""

The problem persists even when explicitly defining the options array in migrations:

'position' => 'side',
'options' => [
    'position' => 'side',
],
@Jamiewarb
Copy link
Member Author

Jamiewarb commented Jun 14, 2017

The same is also true for the menu_order flag:

The following code:

$migrations->addFieldGroup( 'Dynamic Content', [
        'page_template',
        '==',
        'templates/homepage.php',
    ], [
        'menu_order' => 1,
        'style' => 'default',
        'label_placement' => 'top',
        'instruction_placement' => 'label',
    ] );

Results in this output:

function acf_migrations_add_local_field_groups() {

    acf_add_local_field_group( [
        "key" => "group_3c4e0a6",
        "title" => "Dynamic Content",
        "location" => [
            [
                [
                    "param" => "page_template",
                    "operator" => "==",
                    "value" => "templates/homepage.php"
                ]
            ]
        ],
        "options" => [
            "position" => "normal",
            "hide_on_screen" => ""
        ],
        "menu_order" => 0, // Here's the offending value
        "style" => "default",
        "label_placement" => "top",
        "instruction_placement" => "label"

@Jamiewarb
Copy link
Member Author

This will be picked up in #12 from now on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants