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

Override palette with custom_colors setting #54

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mike-sheppard
Copy link
Contributor

Summary

Following up on #53 - this PR adds the ability to override the palette with custom_colors setting. It doesn't solve the issue of the ACF admin UI, which will probably need a lot more thought.

Example

$terms_options
    ->addField('using_theme_palette', 'editor_palette')
    ->addField('using_custom_colors', 'editor_palette', [
        'custom_colors' => [
            [
                'name' => 'Cyan',
                'slug' => 'cyan',
                'color' => '#00ffff',
            ],
            [
                'name' => 'Magenta',
                'slug' => 'magenta',
                'color' => '#ff00ff',
            ],
            [
                'name' => 'Yellow',
                'slug' => 'yellow',
                'color' => '#ffff00',
            ],
            [
                'name' => 'Black',
                'slug' => 'black',
                'color' => '#000000',
            ],
        ],
    ]);

Preview

2023-09-07 2019 - Google Chrome

@Log1x
Copy link
Owner

Log1x commented Sep 7, 2023

Added field settings for it. The repeater stuff is super jank though. Not sure if there's a better way to render the sub fields. 😩

I was forced to add _name, etc. to the sub fields which just feels bad.

Screenshot

@mike-sheppard
Copy link
Contributor Author

Ah nice, decent start!

@mike-sheppard
Copy link
Contributor Author

Sorry, I just realised my update doesn't take the update_value & validate_value methods into account 😬 looking into it now!

@mike-sheppard
Copy link
Contributor Author

mike-sheppard commented Sep 7, 2023

Ok all working after this update - not sure if this is a great way to do this or confusing things so pushed to another branch. Lemme know if worth bringing over 🙏

Update - merged that fix in so we can start using/testing on a real project.

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

Successfully merging this pull request may close these issues.

2 participants