Nebulius / grav-plugin-static-social-embeds

Grav plugin to embed social status (like tweets, instagram posts, toots, etc.) in articles without using their embed iframe, but rather statically without any dependency to the service.
MIT License
13 stars 2 forks source link

Fix issue around "Class 'Grav\Plugin\Shortcodes\Shortcode' not found". #5

Closed funilrys closed 4 years ago

funilrys commented 4 years ago

This patch fixes Nebulius/grav-plugin-static-social-embeds#4.

Context:

Before this patch (after 4.2.0 of shortcode-core), I could
not run Grav (bin/grav and webserver) anymore.

Indeed, I got "Class 'Grav\Plugin\Shortcodes\Shortcode' not found"
as error and asked for help on the discord server of the
Grav Core Team.

@mahagr & @rhukster tried to help me with a patch+release
(shortcode-core 4.2.1) but it still did not solve the issue.
So I decided to fix it myself.

Resolution:

I first followed the new structure by moving the shortcodes classes
inside the `classes` directory.
Same for `classes/SSEShortcode.php` which I moved to
`classes/plugin/SSEShortcode.php`.

In the `static-social-embeds.php` file, I just fixed the autoloader.
In particularly the `getSubscribedEvents()` method. From now,
`classes/plugin/SSEShortcode.php` is only loaded when we are not
in the admin section.

After, applying and testing those changes, onto my fresh development
environment (latest grav-admin+docker-compose), everything worked
back properly.
funilrys commented 4 years ago

@mahagr, fixed and tested.

AmauryCarrade commented 4 years ago

Thanks for the fix! I'll look into this this week-end :)

mahagr commented 4 years ago

Looks good to me on a quick look!

funilrys commented 4 years ago

ping @AmauryCarrade

Fortyseven commented 4 years ago

Just had this issue clobber my blog when I did an update. :(

AmauryCarrade commented 4 years ago

I totally forgot this issue and I'm sorry. Doing the QA now to check if everything is good, then I'll merge & publish.