Code Monkey home page Code Monkey logo

Comments (5)

lubiah avatar lubiah commented on June 2, 2024 1

@justlevine , there is no documentation though I can provide you with information where you can find them.
If you have the Wordpress codebase downloaded on your computer, a simple search for wp_style_add_data or wp_script_add_data or add_data in your code editor can help you to find where it's being used.

The WP_Scripts class and WP_Styles class both inherit the WP_Dependencies class which has a method called add_data.
The method is responsible for adding data to the extra so wherever it's being called can give you a hint of the possible types.
Would you need any more info??

from wp-graphql.

justlevine avatar justlevine commented on June 2, 2024

Source:

The problem is that $extra is array<string, mixed>, not sure if we can just encode the value as type String 🤔. What sort of data usually gets stored here?

from wp-graphql.

lubiah avatar lubiah commented on June 2, 2024

Source:

The problem is that $extra is array<string, mixed>, not sure if we can just encode the value as type String 🤔. What sort of data usually gets stored here?

It stores data about about the styles or scripts.

For scripts,

  • data
  • group
  • strategy

For styles

  • rlt
  • suffix
  • path
  • conditional

from wp-graphql.

lubiah avatar lubiah commented on June 2, 2024

@justlevine , I suggest we create two new ObjectTypes for the extra found in an enqueuedScript and for that found in an enqueuedStyle

from wp-graphql.

justlevine avatar justlevine commented on June 2, 2024

Source:

The problem is that $extra is array<string, mixed>, not sure if we can just encode the value as type String 🤔. What sort of data usually gets stored here?

It stores data about about the styles or scripts.

For scripts,

  • data
  • group
  • strategy

For styles

  • rlt
  • suffix
  • path
  • conditional

@lubiah any chance you could point me to some documentation or a source of truth in the codebase for any of these? I need to understand the possible types and shapes in order to get this into core.
(I tried searching myself, and the best I could come up with is a script _WP_Dependency also using the $extra['conditional'] var over here. )

from wp-graphql.

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.