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

ACF Group #87

Open
codemonkeynorth opened this issue Mar 4, 2020 · 0 comments
Open

ACF Group #87

codemonkeynorth opened this issue Mar 4, 2020 · 0 comments

Comments

@codemonkeynorth
Copy link

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.

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

No branches or pull requests

1 participant