Feature request - edit the php in the builder

Support MB Builder Feature request - edit the php in the builder

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #43285
    YasmineYasmine
    Participant

    Hey recently I have found the builder to be very slow. I am finding it really hard to drag fields into the right space, they take some seconds to shift and often go to the wrong spot (I have a very big form). And I am also finding it hard to open the fields to edit their settings. I therefore copied the php and did all my edits on that. I now realise I should have made them on a json file..

    It would be incredible if we could replace the php generated on the builder with an edited version. Or edit directly into the code, and for those changes to then show in the builder! Not sure if possible - but would be very handy.

    #43297
    PeterPeter
    Moderator

    Hello,

    If you have too many fields in a field group the processing time maybe slowdown. You can generate the field group to PHP code and add the code to the file functions.php in the theme/child theme folder and manage the fields.
    Read more in the documentation https://docs.metabox.io/extensions/meta-box-builder/#getting-php-code

    #43313
    YasmineYasmine
    Participant

    Ok, thanks Peter. I will use the php.

    However, I now have two questions:

    1. For my radio fields it generates like 'options' => [__( 'One{/translate}', '{translate}Multiple', 'your-text-domain' )], - without my values. But my conditional logic is based on the values not the labels. Is this an error and do I need to edit the php to be something like: 'options' => [
    '0' => __( 'One', 'your-text-domain' ),
    '1' => __( 'Multiple', 'your-text-domain' )
    ],

    2. Are the fields still serialized when I do it this way?

    Thanks,
    Yasmine

    #43330
    PeterPeter
    Moderator

    Hello,

    1. Yes, you should add the option like that

    'options' => [
    '0' => __( 'One', 'your-text-domain' ),
    '1' => __( 'Multiple', 'your-text-domain' )
    ],

    2. Yes, the field value is not affected when you use the gettext function to display the label.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.