• Resolved Taiko Media

    (@taiko-media)


    Hi,

    following the Setup Methods example, I receive this error:

    ( ! ) Fatal error: Uncaught Error: Class 'Complex_Field' not found in /srv/www/mysite.dev/current/web/app/plugins/laniakea-page-builder/carbonfields/post-meta.php on line 17
    ( ! ) Error: Class 'Complex_Field' not found in /srv/www/mysite.dev/current/web/app/plugins/laniakea-page-builder/carbonfields/post-meta.php on line 17
    Call Stack
    #	Time	Memory	Function	Location
    1	0.0005	414840	{main}( )	.../post.php:0
    2	0.0011	458000	require_once( '/srv/www/mysite.dev/current/web/wp/wp-admin/admin.php' )	.../post.php:12
    3	0.0014	470640	require_once( '/srv/www/mysite.dev/current/web/wp/wp-load.php' )	.../admin.php:31
    4	0.0019	472792	require_once( '/srv/www/mysite.dev/current/web/wp-config.php' )	.../wp-load.php:42
    5	0.0068	665224	require_once( '/srv/www/mysite.dev/current/web/wp/wp-settings.php' )	.../wp-config.php:9
    6	0.2834	21304152	do_action( )	.../wp-settings.php:413
    7	0.2835	21304600	Carbon_Fields\Helper\Helper->trigger_fields_register( )	.../plugin.php:525
    8	0.2835	21304600	do_action( )	.../Helper.php:51
    9	0.2835	21305640	crb_register_custom_fields( )	.../plugin.php:525
    10	0.2846	21310672	include_once( '/srv/www/mysite.dev/current/web/app/plugins/laniakea-page-builder/carbonfields/post-meta.php' )	.../laniakea.php:15

    Could this be related to my previous problem? This is my post-meta.php code:

    <?php
    use Carbon_Fields\Container\Container;
    use Carbon_Fields\Field\Field;
    
    $employees_labels = array(
    	'plural_name' => 'Employees',
    	'singular_name' => 'Employee',
    );
    
    Container::make('post_meta', 'Custom Data')
    	->show_on_post_type('page')
    	->add_fields(array(
    
    		Field::make('complex', 'crb_employee_data')
    			->setup_labels($employees_labels)
    			->set_layout(Complex_Field::LAYOUT_TABLE)
    			->add_fields(array(
    				Field::make('text', 'name')->help_text('Name of employee'),
    				Field::make('text', 'position')->help_text('Position title'),
    				Field::make('image', 'image'),
    				Field::make('rich_text', 'description'),
    			))
    	));

    https://ww.wp.xz.cn/plugins/carbon-fields/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author htmlBurger

    (@htmlburger)

    Hey,

    It appears that this was a mistake in our documentation.

    We’ve now updated this example in the documentation – it was missing a use Carbon_Fields\Field\Complex_Field; statement.

    Also, please note that the set_layout() method is deprecated, so we’ve removed it from the example as well.

    Feel free to have a look at the latest code in the example.

    Thread Starter Taiko Media

    (@taiko-media)

    Thanks!

    Is there a way to set the contents of a group to either a row or a column display? Or would this be best achieved assigning custom field classes and writing a little CSS for the WP admin area?

    I’ve got to say I really love the Carbon Fields so far, a hidden gem! With a little polishing in the docs and more example codes, I’m convinced this plugin will become huge 🙂

    Cheers,
    Richard

    Plugin Author htmlBurger

    (@htmlburger)

    Hey again,

    Yes, you can set the contents of a group to be displayed either in rows or columns.

    Basically, the default layout of complex field groups is in columns, each field taking 100% width, and each next field positioned below the previous one.

    But if you wish, you can position some of the fields of a group (or all of them) in a row. This can be achieved by using the set_width() method of each field. With this method you specify a percentage of the entire width that you wish this field to take.

    For example, calling set_width(33) to all 3 fields in a group would position all three fields on one line. This gives you the option to position the fields in your groups as you wish – some of them can be on rows, taking 33% or 50% of the width, and some of them can be full width.

    You can read more about this in the Fields -> Usage documentation article: http://carbonfields.net/docs/fields-usage/

    And we’re really glad you like the plugin 🙂

    Thread Starter Taiko Media

    (@taiko-media)

    Yes, I’m aware of the set_width method. I was actually hoping for a way to enable automatic equal width columns for a particular (nested) group/complex field. So that when a user adds 2 entries, each column becomes 50% wide, or 33% when he adds 3 entries and so on. This feature will be great for creating a complex page builder with lots of nested complex fields (for the html markup of sections>rows>columns>content blocks etc.), yet maintaining a compact and sensible UI for the end user.

    Plugin Author htmlBurger

    (@htmlburger)

    Thanks for the idea.

    This is a feature that we will probably consider implementing in a future version.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Fatal error: Uncaught Error: Class 'Complex_Field' not found’ is closed to new replies.