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

Having occurence number for each layout in layouts list #196

Open
barnemax-pilotin opened this issue Mar 10, 2022 · 0 comments
Open

Having occurence number for each layout in layouts list #196

barnemax-pilotin opened this issue Mar 10, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@barnemax-pilotin
Copy link
Contributor

barnemax-pilotin commented Mar 10, 2022

Is your feature request related to a problem? Please describe.
Being able to have visibility about the number of occurences of each layout on a website

2022-03-10_11h46_14

Describe the solution you'd like
An idea would to be to use these filters on the different flexibles :
acf/update_value/name=pip_flexible_header
acf/update_value/name=pip_flexible_footer
acf/update_value/name=pip_flexible

With these filters, counting the numbers of layouts per page and updating an option with an array of the following structure

$occurences = array(
    [post_id] => array( 
        'menu-contained-nemo'           => 1,
        'checkerboard-contained-nemo'   => 9,
        'menu-discus-blabla'            => 0
    ),
    [post_id] => array( 
        'menu-contained-nemo'           => 0,
        'checkerboard-contained-nemo'   => 2,
        'menu-discus-blabla'            => 3
    ),
   [...]
);

On delete_post removing the index of the post ID in the option.

Then maybe having another option that stocks the results of the number of layouts all across the site (using a foreach and doing the sum of all the same indexes), so we don't calculate everything on the layouts listings (edit.php?post_type=acf-field-group&layouts=1) - idk what's better performance wise for this.

@barnemax-pilotin barnemax-pilotin added the enhancement New feature or request label Mar 10, 2022
@ghost ghost changed the title Having occurence number for each layout Having occurence number for each layout in layouts list May 27, 2022
@maelys-pilotin maelys-pilotin added this to the 0.4.6 milestone Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants