GithubHelp home page GithubHelp logo

Comments (4)

talldan avatar talldan commented on July 20, 2024

I think it's a long (possibly painful) story why it's implemented this way.

@scruffian might be able to tell you more.

from gutenberg.

scruffian avatar scruffian commented on July 20, 2024

This is what I did at first but then we moved it back: #57979

See also:
https://core.trac.wordpress.org/ticket/59867#comment:4
#58429

In summary, there are several competing wishes...

On the one hand we want to put code into private functions inside classes so that they can't be used elsewhere in WordPress which would give us a larger surface to maintain with respect to backwards compatibility. Static classes are a good way to achieve this.

On the other hand, at the moment all the PHP rendering code for blocks lives in the block library package, and is back-ported automatically. We are reluctant to start moving block specific code outside of this package.

An ideal solution would allow us to keep all the PHP code inside the block-library package, and also to find a mechanism to keep functions clearly namespaced and not exposed globally for everyone to use. PHP namespaces could be an alternative to a static class.

from gutenberg.

swissspidy avatar swissspidy commented on July 20, 2024

I‘m not suggesting to move this class out of the package, just into a separate file next to index.php. That doesn‘t change anything about the API surface at all.

from gutenberg.

scruffian avatar scruffian commented on July 20, 2024

I think that would be great but it involves making some changes to the way that the PHP files are built for the block library package. Hopefully someone is able to work on that soon!

from gutenberg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.