corcel / corcel/acf

ACF Group

Open
#87 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
132
Forks
102
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.