GithubHelp home page GithubHelp logo

cmb2-grid's People

Contributors

aydin41k avatar belenski avatar codiceovvio avatar jimboobrien avatar jmarceli avatar jrfnl avatar maarten00 avatar mikeill avatar mte90 avatar pablo-sg-pacheco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cmb2-grid's Issues

This just wont load.

I installed as a plugin. but then I get, Fatal error: Uncaught Error: Class 'Cmb2Grid\Grid\Cmb2Grid' not found on my metabox page. I do not have CMB2 as a plugin, but within my own plugin. If that matters.

Is there something I am missing? Not sure what else to say, seems pretty straight forward in usage. Install plugin add code: $cmb2Grid = new \Cmb2Grid\Grid\Cmb2Grid($cmb); ect...

Grid in group fields

Hi, thank you for this awesome plugin !

I was wondering if it was possible to use it in group fields because i don't manage to do it.
I'm assigning a name to each field of the group, and add it to the column array, but nothing happens (no warning neither).

Thanks in advance for your answer !

Empty field with settings page

i'm using the settings page example settings page

and when using the CMBS-Grid the fields return empty, i'm think that ist's bacause i can't set my prefix on the cmb2_get_option( myprefix_admin()->key, $key, $default ); in the cmb2-grid code i can't find the cmb2_get_option so iyou probably use another method, but looking on the code i don't found a way to make work

PS: sou br, mas como todas as outras perguntas estavam em inglês to perguntando em inglês mesmo, n sei se ficou claro meu problema.

Some inputs are pre-filled in post-new.php

Hi there!

I'm experimenting a bug using this plugin. When I am inserting a new post in my custom post type, I'm getting some fields pre-filled with data from the very first entry in that custom post-type.

image

I think it is CMB2-grid related because if I disable for example the first input, I get a blank input (as expected).

image

Also, I've double checked that without CMB2-grid the input still works when editing an existing entry:

image

Have anyone experienced something similar? Is there any quick knowed fix that I could implement to save my project?

Travis & WordPress coding standards

Would you be open to me adding a travis file which will run a PHP lint and do a code style check against the WP Coding standards sniffs ?
This would include some minor changes to make the current code comply with the coding standards.

How to include it inside another plugin?

This is more of a question than an issue. Is there a way to include this plugin inside another plugin, like we can do with cmb2 itself (by including the init.php) or cmb2-conditionals.

I really like this plugin and it would be great if I could use it in another plugin.

And, thanks for the great work!!

grid row missing default formatting

Needs padding and border bottom like other fields to standardize formatting.

Can be achieved by adding default cmb2 class 'cmb-row' to line 29 of cmb1-grid/Grid/Row.php when row is generated.

ie.
$field->args['before_row'] .= '<div class="row cmb2GridRow">';
->
$field->args['before_row'] .= '<div class="cmb-row row cmb2GridRow">';

Box level `show_names` not respected

You can set the show_names property when creating a new CMB2 metabox and it will be used for all fields within that box.

However, when using CMB2 Grid, this properly seem to not be respected.

Screenshot metabox without using grid:
screenshot

Screenshot same metabox with using grid:
screenshot

composer.json file

Would you consider adding (or accepting a PR) which adds a composer.json file for this add-on? I'd like to use it within another plugin I'm building and would like to include it as a dependency (and also autoload the class).

Thoughts?

Groups in a row

Hey,

i'm a php rookie. I need to have a group field with 2 boxes beside each other my actual result looks like this: https://gyazo.com/3ad285902e3d68115eb044bf1cf949a2 But i need the two boxes in a row.

Pls help me thank you.

Lasko

This is my Code for this. Feel free to give me tips and advices

<?php

add_action( 'cmb2_admin_init', 'pb_Metabox1' );


function pb_metabox1() {
    
    $prefix      = '_yourprefix_group_';
            $cmb_group   = new_cmb2_box(array(
                'id'             => $prefix . 'metabox',
                'title'          => __('Repeating Field Group', 'cmb2'),
                'object_types'   => array('rezepte',),
            ));
            $field1      = $cmb_group->add_field(array(
                'name'   => __('Test Text', 'cmb2'),
                'desc'   => __('field description (optional)', 'cmb2'),
                'id'     => $prefix . 'text',
                'type'   => 'text',
            ));
            $field2      = $cmb_group->add_field(array(
                'name'   => __('Test Text Small', 'cmb2'),
                'desc'   => __('field description (optional)', 'cmb2'),
                'id'     => $prefix . 'textsmall',
                'type'   => 'text',
            ));

            // $group_field_id is the field id string, so in this case: $prefix . 'demo'
            $group_field_id  = $cmb_group->add_field(array(
                'id'         => $prefix . 'demo',
                'type'       => 'group',
                'options'    => array(
                    'group_title'    => __('Entry {#}', 'cmb2'), // {#} gets replaced by row number
                    'add_button'     => __('Add Another Entry', 'cmb2'),
                    'remove_button'  => __('Remove Entry', 'cmb2'),
                    'sortable'       => true,
                ),
            ));
            $gField1         = $cmb_group->add_group_field($group_field_id, array(
                'name'   => __('Entry Title', 'cmb2'),
                'id'     => 'title',
                'type'   => 'text_email',
            ));
            $gField2         = $cmb_group->add_group_field($group_field_id, array(
                'name'           => __('Description', 'cmb2'),
                'description'    => __('Write a short description for this entry', 'cmb2'),
                'id'             => 'description',
                'type'           => 'text_email',
            ));
    
           if (!is_admin()) {
                return;
            }

            //Create a default grid
            $cmb2Grid = new \Cmb2Grid\Grid\Cmb2Grid($cmb_group);

            //Create now a Grid of group fields
            $cmb2GroupGrid   = $cmb2Grid->addCmb2GroupGrid($group_field_id);
            $row             = $cmb2GroupGrid->addRow();
            $row->addColumns(array(
                $gField1, $gField2
            ));

            //Now setup your columns like you generally do, even with group fields
            $row = $cmb2Grid->addRow();
            $row->addColumns(array(
                $field1, $field2
            ));
            $row = $cmb2Grid->addRow();
            $row->addColumns(array(
                $cmb2GroupGrid // Can be $group_field_id also
            ));
    
   
    
    
    
    
}

Support PHP 5.2

In my plugin boilerplate https://github.com/Mte90/WordPress-Plugin-Boilerplate-Powered I use CMB2 Grid but after a scanning with PHP CompatInfo:

Data Source Analysed

Directories                                         42
Files                                               84

Extensions Analysis

    Extension Matches REF      EXT min/Max PHP min/Max PHP all 
    Core              Core                 4.0.0       5.1.0   
    ctype             ctype    4.0.4       4.0.4               
    date              date     4.0.0       4.0.0       5.2.0   
    json              json     5.2.0       5.2.0       5.4.0   
    pcre              pcre     4.0.0       4.0.0               
    spl               spl      5.1.2       5.1.2               
    standard          standard 4.0.0       4.0.0       5.1.2   
    Total [7]                              5.2.0       5.4.0   

Namespaces Analysis

    Namespace               Matches REF  EXT min/Max PHP min/Max PHP all 
    +global                         Core             4.0.0       5.2.0   
    Cmb2Grid                        user             5.3.0               
    Cmb2Grid\Cmb2                   user             5.3.0               
    Cmb2Grid\DesignPatterns         user             5.3.0               
    Cmb2Grid\Grid                   user             5.3.0               
    Cmb2Grid\Grid\Group             user             5.3.0               
    Cmb2Grid\Test                   user             5.3.0               
    Total [7]                                        5.3.0               

No interface found

No trait found

Classes Analysis

    Class                             Matches REF  EXT min/Max PHP min/Max PHP all 
 C  Cmb2Grid\Cmb2GridPlugin           1       user             5.3.0               
 C  Cmb2Grid\Cmb2\Utils               8       user             5.3.0               
 C  Cmb2Grid\DesignPatterns\Singleton 1       user             5.3.0               
 C  Cmb2Grid\Grid\Cmb2Grid            7       user             5.3.0               
 C  Cmb2Grid\Grid\Column              2       user             5.3.0               
 C  Cmb2Grid\Grid\Group\Cmb2GroupGrid 1       user             5.3.0               
 C  Cmb2Grid\Grid\Group\GroupColumn   1       user             5.3.0               
 C  Cmb2Grid\Grid\Group\GroupRow      1       user             5.3.0               
 C  Cmb2Grid\Grid\Row                 2       user             5.3.0               
 C  Cmb2Grid\Test\Test                1       user             5.3.0               
    DateTime                          3       date 5.2.0       5.2.0               
    DateTimeZone                      3       date 5.2.0       5.2.0               
    Total [12]                                                 5.2.0               

Functions Analysis

    Function    Matches REF  EXT min/Max PHP min/Max  
    date_create 1       date 5.2.0       5.2.0        
    json_decode 1       json 5.2.0       5.2.0        
    json_encode 6       json 5.2.0       5.2.0        
    Total [3]                            5.2.0        

Constants Analysis

    Constant          Matches REF  EXT min/Max PHP min/Max  
    JSON_PRETTY_PRINT 1       json 5.4.0       5.4.0        
    Total [1]                                  5.4.0        

Conditions Analysis

    Condition                                       Matches REF  EXT min/Max PHP min/Max  
    class_exists(CMB2)                              1       user             4.0.0        
    class_exists(CMB2_Bootstrap_212)                1       user             4.0.0        
    class_exists(CPT_Core)                          1       user             4.0.0        
    class_exists(CPT_columns)                       1       user             4.0.0        
    class_exists(Cmb2Grid\Cmb2GridPlugin)           1       user             5.3.0        
    class_exists(Cmb2Grid\Cmb2\Utils)               1       user             5.3.0        
    class_exists(Cmb2Grid\DesignPatterns\Singleton) 1       user             5.3.0        
    class_exists(Cmb2Grid\Grid\Cmb2Grid)            1       user             5.3.0        
    class_exists(Cmb2Grid\Grid\Column)              1       user             5.3.0        
    class_exists(Cmb2Grid\Grid\Group\Cmb2GroupGrid) 1       user             5.3.0        
    class_exists(Cmb2Grid\Grid\Group\GroupColumn)   1       user             5.3.0        
    class_exists(Cmb2Grid\Grid\Group\GroupRow)      1       user             5.3.0        
    class_exists(Cmb2Grid\Grid\Row)                 1       user             5.3.0        
    class_exists(Cmb2Grid\Test\Test)                1       user             5.3.0        
    class_exists(CronPlus)                          1       user             4.0.0        
    class_exists(Fake_Page)                         1       user             4.0.0        
    class_exists(PN_Debug_Panel)                    1       user             4.0.0        
    class_exists(Plugin_Requirements)               1       user             4.0.0        
    class_exists(PointerPlus)                       1       user             4.0.0        
    class_exists(Shortcode_Button)                  1       user             4.0.0        
    class_exists(Taxonomy_Core)                     1       user             4.0.0        
    class_exists(WPH_Widget)                        1       user             4.0.0        
    class_exists(WP_Admin_Notice)                   1       user             4.0.0        
    class_exists(WP_Contextual_Help)                3       user             4.0.0        
    defined(ABSPATH)                                2       user             4.0.0        
    defined(CMB2_DIR)                               1       user             4.0.0        
    defined(CMB2_LOADED)                            1       user             4.0.0        
    defined(CMB2_VERSION)                           1       user             4.0.0        
    defined(DOING_AJAX)                             1       user             4.0.0        
    defined(DOING_AUTOSAVE)                         1       user             4.0.0        
    defined(ICL_LANGUAGE_CODE)                      1       user             4.0.0        
    defined(PHPUNIT_RUNNER)                         1       user             4.0.0        
    defined(SCRIPT_DEBUG)                           4       user             4.0.0        
    defined(WPINC)                                  3       user             4.0.0        
    defined(WP_DEBUG)                               2       user             4.0.0        
    defined(WP_UNINSTALL_PLUGIN)                    1       user             4.0.0        
    function_exists(cmb2_metabox_form)              2       user             4.0.0        
    function_exists(cml_get_browser_lang)           1       user             4.0.0        
    function_exists(deregister_string)              1       user             4.0.0        
    function_exists(get_language)                   1       user             4.0.0        
    function_exists(get_string)                     1       user             4.0.0        
    function_exists(icl_register_string)            1       user             4.0.0        
    function_exists(icl_t)                          1       user             4.0.0        
    function_exists(icl_unregister_string)          1       user             4.0.0        
    function_exists(is_multisite)                   2       user             4.0.0        
    function_exists(pl_my_register_widget)          1       user             4.0.0        
    function_exists(pll__)                          1       user             4.0.0        
    function_exists(pll_current_language)           1       user             4.0.0        
    function_exists(pll_register_string)            1       user             4.0.0        
    function_exists(register_string)                1       user             4.0.0        
    function_exists(register_via_cpt_core)          1       user             4.0.0        
    function_exists(register_via_taxonomy_core)     1       user             4.0.0        
    Total [52]                                                               5.3.0        

Requires PHP 5.3.0 (min), PHP 5.3.0 (all)

I see that is not supported on PHP 5.2 that is the version supported on legacy system by WordPress (https://wordpress.org/about/requirements/), is possible add that support or a system to not activate that library if there is that PHP version?

CMB2-grid group classes not working

Hi!
I have a CMB2 Group and want to use Grid with class for the group fields but it shows me an error

Code for grid

$cmb2Grid = new \Cmb2Grid\Grid\Cmb2Grid($cmb_options);
$cmb2GroupGrid = $cmb2Grid->addCmb2GroupGrid($group_field_id);
$row           = $cmb2GroupGrid->addRow();
$row->addColumns(array(array($field1, 'class' => 'col-md-6'), array($field2, 'class' => 'col-md-6')));
$row = $cmb2Grid->addRow();
$row->addColumns(array($cmb2GroupGrid));

ERROR:
Argument 1 passed to Cmb2Grid\Grid\Group\GroupRow::openGroupRow() must be an instance of CMB2_Field, boolean given, called in C:\htdocs\site\wp-content\plugins\grid\Grid\Group\GroupRow.php on line 60 and defined in C:\htdocs\site\wp-content\plugins\grid\Grid\Group\GroupRow.php on line 47

Can someone please tell me what's wrong and what is the right way to do it?

Waiting for your reply...

composer installer support

Would you consider adding support for composer/installers? I'm using this with Trellis and because CMB2-grid doesn't use installers and specify "type": "wordpress-plugin", composer is installing it to the default directory with other dev dependencies.

Undefined function cmb2_get_metabox

Getting this error:

Fatal error: Call to undefined function cmb2_get_metabox() in C:\xampp\htdocs[REDACTED]\wp-content\plugins\CMB2-grid-master\Grid\Cmb2Grid.php on line 22

I have CMB2 and this plugin installed and enabled.

<?php
function vn_bike_review_metaboxes() {

        // Start with an underscore to hide fields from custom fields list
        $prefix = '_vn_bike_review_';

        /**
         * Initiate the metabox
         */
        $cmb_bikes = new_cmb2_box( array(
            'id' => 'bike_review',
            'title' => __( 'Bike Reviews', 'vn' ),
            'object_types' => array( 'bike-reviews', ), // Post type
            'context' => 'normal',
            'priority' => 'high',
            'show_names' => true, // Show field names on the left
            'closed' => false,
        ) );



        // Scoring fields
        // text
        $scoring1 = $cmb_bikes->add_field( array(
            'name'    => 'LAB Score',
            'id'      => $prefix . 'bike_lab_score',
            'type'    => 'text',
            'desc'    => 'Out of 20',
        ) );

        // text
        $scoring2 = $cmb_bikes->add_field( array(
            'name'    => 'BUILD Score',
            'id'      => $prefix . 'bike_build_score',
            'type'    => 'text',
            'desc'    => 'Out of 15',
        ) );

        // text
        $scoring3 = $cmb_bikes->add_field( array(
            'name'    => 'COMFORT Score',
            'id'      => $prefix . 'bike_comfort_score',
            'type'    => 'text',
            'desc'    => 'Out of 15',
        ) );

        // text
        $scoring4 = $cmb_bikes->add_field( array(
            'name'    => 'VALUE Score',
            'id'      => $prefix . 'bike_value_score',
            'type'    => 'text',
            'desc'    => 'Out of 15',
        ) );

        // text
        $scoring5 = $cmb_bikes->add_field( array(
            'name'    => 'HANDLING Score',
            'id'      => $prefix . 'bike_handling_score',
            'type'    => 'text',
            'desc'    => 'Out of 15',
        ) );

        // text
        $scoring6 = $cmb_bikes->add_field( array(
            'name'    => 'PEDALING RESPONSE Score',
            'id'      => $prefix . 'bike_pedaling_score',
            'type'    => 'text',
            'desc'    => 'Out of 15',
        ) );

        // text
        $scoring7 = $cmb_bikes->add_field( array(
            'name'    => 'AESTHETICS Score',
            'id'      => $prefix . 'bike_aesthetics_score',
            'type'    => 'text',
            'desc'    => 'Out of 5',
        ) );

        // text
        $scoring8 = $cmb_bikes->add_field( array(
            'name'    => 'ASCENDING Score',
            'id'      => $prefix . 'bike_ascending_score',
            'type'    => 'text',
            'desc'    => 'Out of 15',
        ) );

        // text
        $scoring9 = $cmb_bikes->add_field( array(
            'name'    => 'DESCENDING Score',
            'id'      => $prefix . 'bike_descending_score',
            'type'    => 'text',
            'desc'    => 'Out of 15',
        ) );

        // text
        $scoring10 = $cmb_bikes->add_field( array(
            'name'    => 'VERSATILITY Score',
            'id'      => $prefix . 'bike_versatility_score',
            'type'    => 'text',
            'desc'    => 'Out of 15',
        ) );

        // text
        $cmb_bikes->add_field( array(
            'name'    => 'OVERALL Score',
            'id'      => $prefix . 'bike_overall',
            'type'    => 'text',
            'desc'    => 'Out of 100',
        ) );
}
add_action( 'cmb2_init', 'vn_bike_review_metaboxes' );

if(!is_admin()){
    return;
}
$cmb2Grid = new \Cmb2Grid\Grid\Cmb2Grid($cmb_bikes);
$row = $cmb2Grid->addRow();
$row->addColumns( array(
    $scoring1,
    $scoring2,
    $scoring3,
));

Feature Request: Implementing CMB2-grid in a theme

Feature Request: I'm sure I'll figure this out, but it would be nice if in the README there were instructions to include this in theme development.

I would think that would be very very common? Maybe not. Not sure.

How to assign columns to repeatable groups

I was just wondering, is it possible to assign columns to repeatable groups ?

I did something like this:

            $prefix      = '_group_columns_test';
            $cmb_group   = new_cmb2_box( array(
                'id'             => $prefix . 'metabox',
                'title'          => __( 'Repeating Field Group using a Grid', 'cmb2' ),
                'object_types'   => array( 'page' ),
            ) );
            // $group_field_id is the field id string, so in this case: $prefix . 'demo'
            $group_field_id  = $cmb_group->add_field( array(
                'id'         => $prefix . 'demo',
                'type'       => 'group',
                'options'    => array(
                    'group_title'    => __( 'Entry {#}', 'cmb2' ), // {#} gets replaced by row number.
                    'add_button'     => __( 'Add Another Entry', 'cmb2' ),
                    'remove_button'  => __( 'Remove Entry', 'cmb2' ),
                    'sortable'       => true,
                ),
            ) );
            $gField1         = $cmb_group->add_group_field( $group_field_id, array(
                'name'   => __( 'Entry Title', 'cmb2' ),
                'id'     => 'title',
                'type'   => 'text',
            ) );
            $gField2         = $cmb_group->add_group_field( $group_field_id, array(
                'name'           => __( 'Description', 'cmb2' ),
                'description'    => __( 'Write a short description for this entry', 'cmb2' ),
                'id'             => 'description',
                'type'           => 'textarea_small',
            ));

            $cmb2Grid = new \Cmb2Grid\Grid\Cmb2Grid( $cmb_group );
            // Create now a Grid of group fields.
            $cmb2GroupGrid   = $cmb2Grid->addCmb2GroupGrid( $group_field_id );

            $row = $cmb2Grid->addRow();
            $row->addColumns( array(
                $cmb2GroupGrid
            ) );

This way the group comes up fine, but it takes up full width.

If I change the last line to :

            $row->addColumns( array(
                array( $cmb2GroupGrid, 'class' => 'col-md-6' ),
            ) );

then it gives me fatal error:

Fatal error: Cannot use object of type Cmb2Grid\Grid\Group\Cmb2GroupGrid as array

Now if I add another group to make my code look like this:

            $prefix      = '_group_columns_test';
            $cmb_group   = new_cmb2_box( array(
                'id'             => $prefix . 'metabox',
                'title'          => __( 'Repeating Field Group using a Grid', 'cmb2' ),
                'object_types'   => array( 'page' ),
            ) );
            // $group_field_id is the field id string, so in this case: $prefix . 'demo'
            $group_field_id  = $cmb_group->add_field( array(
                'id'         => $prefix . 'demo',
                'type'       => 'group',
                'options'    => array(
                    'group_title'    => __( 'Entry {#}', 'cmb2' ), // {#} gets replaced by row number.
                    'add_button'     => __( 'Add Another Entry', 'cmb2' ),
                    'remove_button'  => __( 'Remove Entry', 'cmb2' ),
                    'sortable'       => true,
                ),
            ) );
            $gField1         = $cmb_group->add_group_field( $group_field_id, array(
                'name'   => __( 'Entry Title', 'cmb2' ),
                'id'     => 'title',
                'type'   => 'text',
            ) );
            $gField2         = $cmb_group->add_group_field( $group_field_id, array(
                'name'           => __( 'Description', 'cmb2' ),
                'description'    => __( 'Write a short description for this entry', 'cmb2' ),
                'id'             => 'description',
                'type'           => 'textarea_small',
            ));



            $group_field_id2     = $cmb_group->add_field( array(
                'id'         => $prefix . 'demo2',
                'type'       => 'group',
                'options'    => array(
                    'group_title'    => __( 'DEntry {#}', 'cmb2' ), // {#} gets replaced by row number.
                    'add_button'     => __( 'Add Another DEntry', 'cmb2' ),
                    'remove_button'  => __( 'Remove Entry', 'cmb2' ),
                    'sortable'       => true,
                ),
            ) );
            $gField12        = $cmb_group->add_group_field( $group_field_id2, array(
                'name'   => __( 'DEntry Title', 'cmb2' ),
                'id'     => 'title2',
                'type'   => 'text',
            ) );
            $gField22        = $cmb_group->add_group_field( $group_field_id2, array(
                'name'           => __( 'Description', 'cmb2' ),
                'description'    => __( 'Write a short description for this entry', 'cmb2' ),
                'id'             => 'description2',
                'type'           => 'textarea_small',
            ));


            if ( ! is_admin() ) {
                return;
            }
            // Create a default grid.
            $cmb2Grid = new \Cmb2Grid\Grid\Cmb2Grid( $cmb_group );
            // Create now a Grid of group fields.
            $cmb2GroupGrid   = $cmb2Grid->addCmb2GroupGrid( $group_field_id );      

            $cmb2GroupGrid2  = $cmb2Grid->addCmb2GroupGrid( $group_field_id2 );

            $row = $cmb2Grid->addRow();
            $row->addColumns( array(
                $cmb2GroupGrid, // Can be $group_field_id also.
                $cmb2GroupGrid2
                //array( $cmb2GroupGrid, 'class' => 'col-md-8' ),
                //array( $cmb2GroupGrid2, 'class' => 'col-md-4' )
            ) );

then the groups come fine in 2 columns.
However, the problem is that if I click on add button to create one more type of the group. then the new instance comes just below it, it does not come to the next available column.

Perhaps a screenshot would explain better:

gridcolumns

Group field grids causes errors if not before_row and after_row are set

If not before_row and after_row gets set to an empty string when defining the field it will cause errors when in the admin ui. The code for prepending and appending html to the fields only do .= and never initializes the strings, only append to what is already there. A check should be implemented to initialize the string if it's empty.

Composer autoloading issue since recent update

Hi!

Thanks so much for writing and maintaining this add-on. It's super useful.

We've been using it in a project for months, not as a separate plugin, but as a requirement within another plugin. Here's how we had it set up

"require": {
        "jjgrainger/wp-custom-post-type-class": "dev-master",
        "webdevstudios/cmb2": "dev-master",
        "origgami/CMB2-grid": "dev-master",
        "mustardBees/cmb-field-select2": "dev-master",
        "stomp-php/stomp-php": "4.*"
    },
    "minimum-stability": "dev",
    "autoload": {
        "psr-0": {
            "UBC": "src/",
            "UBC\\Press\\Tests": "tests/"
        },
        "files": [
            "vendor/webdevstudios/cmb2/init.php",
            "vendor/origgami/CMB2-grid/Cmb2GridPlugin.php",
            "vendor/mustardBees/cmb-field-select2/cmb-field-select2.php"
        ]
    }

However, since a recent composer update we've been getting a fatal error in the dashboard

Fatal error: Uncaught Error: Class 'Cmb2Grid\Grid\Cmb2Grid' not found in /srv/www/snip/path/wp-content/mu-plugins/ubc-press/src/UBC/Press/Metaboxes/Setup.php:206

That line (206) is $grid_layout = new \Cmb2Grid\Grid\Cmb2Grid( $section_description ); and hasn't changed.

Any ideas what has changed recently that would cause this?

The plugin as standalone

Hello!

Firstly, I wanna thank you for the plug-in.

I am using cmb2 not as a plug-in.

in my function.php

require_once ('inc/cmb2/init.php');
require_once ('inc/Cmb2Grid/Cmb2GridPlugin.php');

How can I incoporate your plug-in in my Theme without installing it.

Greetings Rob!

Group Grid - Bootstrap Classes not working

Hi,

I have a CMB2 Group and want to use Grid for the group fields. Following code works without error...

$cluster_row = $clusterGroupGrid->addRow();
        $cluster_row->addColumns(array(
![2016-01-11_14-02-20](https://cloud.githubusercontent.com/assets/2541944/12229343/de848718-b86c-11e5-98fe-873c07b89336.jpg)

            $gField1, $gField2
        ));

But when I try to specify Bootstrap classes (like in the code below)...

$cluster_row = $clusterGroupGrid->addRow();
        $cluster_row->addColumns(array(
            array($gField1, 'class' => 'col-sm-4'),
            array($gField2, 'class' => 'col-sm-8'),
        ));

... I get following error:

Catchable fatal error: Argument 1 passed to Cmb2Grid\Grid\Group\GroupRow::openGroupRow() must be an instance of CMB2_Field, boolean given, called in cmb2grid\Grid\Group\GroupRow.php on line 56 and defined in cmb2grid\Grid\Group\GroupRow.php on line 45.

Can someone please tell me what's wrong and what is the right way to do it? I checked example file but it does not declare field array with Bootstrap Classes.

Waiting for your reply...

Cheers,

Ruturaaj.

UPDATE:
My IDE shows following error:
2016-01-11_14-02-20

Group Field Grid Issue

Could not add array( $gField1, 'class' => 'col-md-8' ),array( $gField2, 'class' => 'col-md-4' ), like this . It just count the fields and set the col automatically . It will be great if we can use user defined grid column link the normal fields type.

Missing class_exist

Is possible add in Cmb2GridPlugin a check for class_exist?
If two plugin load the same class there is an error.

I've patched with this code

if ( ! class_exists( 'Cmb2Grid\Cmb2GridPlugin' ) ) 
{
///the class code with the initialization
}

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.