hex-digital / acf-migrations Goto Github PK
View Code? Open in Web Editor NEWAn easy way to migrate local fields and field groups using readable object oriented syntax (without the need for huge arrays)
License: MIT License
An easy way to migrate local fields and field groups using readable object oriented syntax (without the need for huge arrays)
License: MIT License
As shown in #7, there is some missing functionality that this plugin does not support, and instead provides hard-coded, default values for.
This issue aims to collect that information, and record the progress of implementing it.
The following functionality has been identified as missing:
Field [addField()]
Field Group [addFieldGroup()]
Layout [addLayout()]
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"
]
]
],
...
When you have a blank migrations file, with just:
<?php
$migrations = new Migrations;
and run the executable, the script returns a PHP error:
PHP Warning: Invalid argument supplied for foreach() in phar:///Users/oliver/Sites/test/acf-migrations.phar/generate.php on line 484
Warning: Invalid argument supplied for foreach() in phar:///Users/oliver/Sites/test/acf-migrations.phar/generate.php on line 484
--> Successfully generated migrations export file
The compiled phar, with the new repeater in repeater functionality, is unable to run on our servers. A Segmentation Fault is given. Likely to do with compilation of file
Search for diretory and it shall be discovered
Hi,
I'm using a repeater inside of a repeater in flexible content, and it's working just fine.
However, when I come to use it inside a field group for a page template, the second repeater isn't having it's subfields added inside of it, and no errors are flagged in the terminal on export.
Below is an isolated snippet to test:
<?php
$migrations = new Migrations;
$migrations->addFieldGroup( 'courses', [
'page_template',
'==',
'templates/courses.php'
], [
'hide_on_screen' => [ 'content_editor' ]
] )
->addField( 'repeater', 'Foo', [
'layout' => 'block',
'button_label' => 'Add Category',
'min' => 1
] )
->addSubField( 'repeater', 'Bar', 1, [
'layout' => 'block',
'button_label' => 'Add Category',
'min' => 1
] )
->addSubField( 'text', 'Group Title', 2 );
The exported snippet can be viewed in the following screenshot. The first set, with repeaters 'Foo' and 'Bar' are generated from the code above. The set beneath that are generated inside the 'Custom Fields' plugin on the site, to highlight that it should be possible, and therefore is most likely a bug in this generator plugin.
Cheers
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',
],
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.