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

Block Registrations Utilize Full Use Statements #99

Open
tarecord opened this issue Dec 21, 2021 · 1 comment
Open

Block Registrations Utilize Full Use Statements #99

tarecord opened this issue Dec 21, 2021 · 1 comment

Comments

@tarecord
Copy link
Contributor

Our block registrations utilize full use statements so that we only use the Block's classname:

public function define(): array {
    return [
      self::TYPES => DI\add( [
        DI\get( Accordion::class ),
        // etc.
    ]
}

We should update this to match:

$definer_path = $this->src_path . 'Blocks/Blocks_Definer.php';
$type_registration = "\t\t\t\t" . sprintf( 'DI\get( Types\%1$s\%1$s::class ),', $class_name ) . "\n";
$allowlist_registration = "\t\t\t\t" . sprintf( "'acf/%s',", $type_name ) . "\n";

@defunctl
Copy link
Collaborator

defunctl commented Dec 21, 2021

I think this will be more difficult than it's worth, because we need a static line to always reference and also PHPCS wants use statements in alphabetical order.

However, we no longer need the $allowlist_registration = "\t\t\t\t" . sprintf( "'acf/%s',", $type_name ) . "\n"; line since we don't need to manually define acf blocks since moderntribe/square-one#837 but we should bump a minor version with that change as many older projects will no longer be compatible.

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

2 participants