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

Prevent plugins from using core block namespaces #2241

Closed
wants to merge 4 commits into from

Conversation

nylen
Copy link
Member

@nylen nylen commented Aug 5, 2017

Fixes #333.

This PR prohibits plugins from registering blocks in the core or core-* namespaces (we currently use core-embed).

We should reserve these for future usage by core.

The PR works by setting an ALLOW_CORE_NAMESPACES flag when registering our core blocks, then unsetting it later. Because this flag is completely internal to the blocks module, it is not accessible by third-party code.

@codecov
Copy link

codecov bot commented Aug 5, 2017

Codecov Report

Merging #2241 into master will increase coverage by 0.43%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2241      +/-   ##
==========================================
+ Coverage   24.23%   24.67%   +0.43%     
==========================================
  Files         142      143       +1     
  Lines        4460     4486      +26     
  Branches      756      757       +1     
==========================================
+ Hits         1081     1107      +26     
  Misses       2854     2854              
  Partials      525      525
Impacted Files Coverage Δ
blocks/library/index.js 100% <100%> (ø)
blocks/api/registration.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4a59869...f442853. Read the comment docs.

@aduth aduth added the [Feature] Block API API that allows to express the block paradigm. label Aug 7, 2017
@youknowriad
Copy link
Contributor

This should be way easier to do since we introduced the registerCoreBlocks function. Any plans on updating this, maybe we can take over @gziolo

@youknowriad youknowriad added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Jan 30, 2018
@gziolo
Copy link
Member

gziolo commented Jan 30, 2018

This should be way easier to do since we introduced the registerCoreBlocks function. Any plans on updating this, maybe we can take over @gziolo

Yes, it sounds like a great idea. We can enable such flag at the beginning registerCoreBlocks and disable at the end. It would allow adding additional logic which would be fully limited to the core blocks. 💯

@gziolo gziolo added the [Feature] Extensibility The ability to extend blocks or the editing experience label Jan 31, 2018
@gziolo
Copy link
Member

gziolo commented Feb 6, 2018

Let's close it and implement it as part of #4841. Most likely it will have to be done on PHP side.

@gziolo gziolo closed this Feb 6, 2018
@gziolo gziolo deleted the update/reserve-core-namespaces branch February 6, 2018 13:07
ceyhun pushed a commit that referenced this pull request Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Extensibility The ability to extend blocks or the editing experience [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants