Skip to content

ACF Group #87

Description

@codemonkeynorth

would be good if we could get a Group field in the library

as far as I know it just prefixes groupname_ so if eg my Group is hero and my first field in the repeater is image then the field becomes hero_image

I had a go at adapting the Repeater field and it seemed to work using eg

protected function fetchPostsMeta($fieldName, $post) {
  ....
  $builder->where(function ($query) use ($fieldName) {
    $query->orWhere('meta_key', 'REGEXP', "^{$fieldName}_[a-z0-9]*$");
  });
protected function fetchFields ($fieldName, Builder $builder) {
  ...
  $name = str_replace($this->name."_", '', $name);
  $fields[$name] = $field->get();

I hope this of some use. It's mostly trial and error, I'm not quite sure how the whole thing fits together.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions