Custom Fields
Support Meta Box Builder Setting Render Options to PHP for Block

  • Creator
  • #20705
    Resolved badabingbreda

    Hi, I'm saving a block with the Meta Box Builder and am setting the Render Options to use a PHP function. I can set the render_callback successfully. It does use the callback as specified;

    However, two minor issues:

    1. When I enter a callback that uses a namespace, like "\TimberMetaboxBlocks\timber_blocks_callback"
      the generated code displays it with TWO backslashes: "\TimberMetaboxBlocks\timber_blocks_callback"
    2. When going back to the settings, the render options automatically open on the "Code" settings panel. (PHP callback is still used correctly)
Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #20706

    LOL, double slashes were automatically removed in my post. They were there where I mentioned them, I swear!

    Long Nguyen

    Hi Didou,

    1. Because Meta Box Builder generates the function callback as the string so it uses one backslash to escape the string "\". Don't worry about this.
      'render_callback' => '\\MetaBox_Block\\my_team_member'
    2. You can follow this topic for more information

    3. Thank you for pointing this out. I'm going to create a feature request to improve this case, save the state PHP function instead of Code.
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.