GithubHelp home page GithubHelp logo

Comments (8)

pablo-sg-pacheco avatar pablo-sg-pacheco commented on August 16, 2024

Hello,

How are you using Cmb2-grid? Can you put your code here?

PS: Sou br tb :) Legal saber

from cmb2-grid.

alfaex avatar alfaex commented on August 16, 2024

for the test i'm using exactly the example of the link on the first comment

`$telefone = $cmb->add_field( array(
'name' => 'Telefone',
//'desc' => 'field description (optional)',
//'default' => 'standard value (optional)',
'id' => 'telefone',
'type' => 'text',
) );

$telefoneBg = $cmb->add_field( array(
'name' => __( 'Test Color Picker', 'myprefix' ),
//'desc' => __( 'field description (optional)' ),
'id' => 'telefoneBg',
'type' => 'colorpicker',
//'default' => '#bada55',
) );

$cmb2Grid = new \Cmb2Grid\Grid\Cmb2Grid($cmb);
$row = $cmb2Grid->addRow();
$row->addColumns(array($telefone, $telefoneBg));
`

to replicate you can paste the code above in line 142

from cmb2-grid.

pablo-sg-pacheco avatar pablo-sg-pacheco commented on August 16, 2024

Try to use the field id instead, like this:

$row->addColumns(array('telefone', 'telefoneBg'));

from cmb2-grid.

alfaex avatar alfaex commented on August 16, 2024

same thing with $row->addColumns(array('telefone', 'telefoneBg'));

from cmb2-grid.

pablo-sg-pacheco avatar pablo-sg-pacheco commented on August 16, 2024

Actually i don't know if cmb2-grid works on a page. I've only tested it as a metabox inside a custom post type. Can you try that? Change this new_cmb2_box() to a default one as a custom post type and tell me if it works

from cmb2-grid.

alfaex avatar alfaex commented on August 16, 2024

I will try.
Using as a setting page i need to explicity use cmb2_get_option( 'myprefix', 'id-of-the-field' ); otherwise will not work.

i will try to look if i find a way to modify the code to work with settings page, but it may take a while.

from cmb2-grid.

alfaex avatar alfaex commented on August 16, 2024

setting up with 'object_types' => array( 'page') worked fine.

Thanks anyway, i will try to look under the hood later,maybe i can modify to make it work.

from cmb2-grid.

pablo-sg-pacheco avatar pablo-sg-pacheco commented on August 16, 2024

That's good to know. Thanks

from cmb2-grid.

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.