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

Error when activating plugin: Cannot use reserved class name 'RemoteDataBlocks\REST\true' #43

Closed
arunsathiya opened this issue Sep 12, 2024 · 4 comments

Comments

@arunsathiya
Copy link

Following README instructions, I tried activating this plugin on a dev site, but I get the following error upon clicking Activate button:

Fatal error: Cannot use 'RemoteDataBlocks\REST\true' as class name as it is reserved in /var/www/html/wp-content/plugins/remote-data-blocks/inc/rest/datasource-crud/datasource-crud.php on line 26
@jblz
Copy link
Member

jblz commented Sep 12, 2024

Hi, @arunsathiya.

Thanks so much for giving the Remote Data Blocks plugin a try! Please note that it’s still in early stages of development and not yet suitable for production use, but we’re really glad you’ve taken it for a spin and uncovered this issue.

It looks like that error was caused by the return type declaration here:

public static function validate_slug( string $slug, string $uuid = '' ): WP_Error|true {

Per https://www.php.net/manual/en/language.types.declarations.php, support for the literal type true was only added in PHP 8.2.

We’ll update the declaration to allow this to work in 8.1 as well and add some testing to catch this sort of thing in the future (#44).

In the meantime, please let us know if you give it a try in 8.2+ and have any feedback.

@arunsathiya
Copy link
Author

Thanks for sharing that information, @jblz—great to see it being improved. I could successfully install on PHP 8.2+, and I configured Airtable as a source under Settings > Remote Data Blocks, but after this step, I cannot yet see Remote Data Blocks or Airtable in the page/post editor.

@jblz
Copy link
Member

jblz commented Sep 13, 2024

@arunsathiya I appreciate you following up.

The UI for configuring data sources is not yet hooked into the block registration piece. Some of that work has been shared in #17, but it's not quite ready yet.

For now, the data sources have to be hard-coded in a companion plugin. Here are a couple of examples:

https://github.com/Automattic/remote-data-blocks/tree/8526923e0852a0b18c409d2ce4c523c2bd2b5fb1/example/airtable

Cheers.

@maxschmeling
Copy link
Contributor

@arunsathiya really appreciate the early engagement.

Just so you're aware, we've just gotten our documentation site online, but there's not much content yet (and we're working on a real design). Through the rest of September you should start seeing more content show up there and the API and workflows will solidify a bit as part of that process.

Please keep sending us any issues or feedback. And also feel free to contribute if you're so inclined, we'd be glad to take a look at any PRs.

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

3 participants