StoutLogic / acf-builder

An Advanced Custom Field Configuration Builder
GNU General Public License v2.0
793 stars 62 forks source link

How to implement an ACF add on plugin like "Advanced Custom Fields: Table Field"? #100

Open ferremek opened 5 years ago

ferremek commented 5 years ago

Hi guys,

Since the day I got into the acf-builder I never looked back, it is awesome and changed the way I do WP development!

A client of mine has a lot of tables in their website and I would like the add on plugin Advanced Custom Fields: Table Field for it, this seems perfect. How do I approach adding in an external add-on plugin in acf-builder? Is it possible in any way?

Thanks in advance!

DalkMania commented 4 years ago

@ferremek ... If you have the Table Field installed. It should be something like this:

TablePress Table

$attributes = [
    'allow_null' => 0,
    'return_format' => 'table_id' || 'rendered_html'
];
$group->addField('my_field_name', 'tablepress_field', $attributes);

This code above is for a similar plugin called tablepress. But check the source code of the table field plugin and adjust accordingly.

eballeste commented 4 years ago

this is so fucking amazing, worked like a charm

mjatzgit commented 1 year ago

I struggled getting "Advanced Custom Fields: Table Field" to work using Acf-Builder Nothing showed up in admin, but all debugging indicated it loaded properly.

ACF 5 Pro - Version 6.0.7 Advanced Custom Fields: Table Field - Version 1.3.20

But adding the "type" prop made it work :-)

$attributes = [
      'type' => 'table', // important
      'use_header' => 1,
      'use_caption' => 1
  ];
$group->addField('my_field_name', 'jh_acf_field_table', $attributes )