BentoBox

The BentoBox2 Developer Hub

Welcome to the BentoBox2 developer hub. You'll find comprehensive guides and documentation to help you start working with BentoBox2 as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Developer Documentation

Box Configuration

Boxes are defined by a JSON file in /config/boxes. The file name determines how instances of the box will be accessible in the front-end context. For exampe, /config/boxes/flavors.json would be accessible in a template at {{ boxes.flavors.all }}.

This is a sample configuration file for a Menus box that uses all settings currently available. All of these settings are optional.

/*
   Sample Menus Box Configuration File
   /config/boxes/menus.json
*/

{
  
  name: "Menus",
  /* The name of this box wherever referenced in the administrator
    panel, such the Boxes fly-out menu. If this value isn't specified,
    BentoBox will infer a name by replacing the filename's underscores
    with spaces and capitalizing each word. */
  
  engine: "menu",
  /* The engine which this box utilizes. Note that no more than one engine 			may be used by a box, and each engine may only be used by one box per 		 theme. Some engines allow for additional configuration. */
  
  fields: { additional_file: "file" },
  /* Custom fields that are editable on each menu box. The assigned
     values can be referenced at 'fields'. For example, you may access
     {{ boxes.menus.all.0.fields.additional_file }} See the "Custom
     Fields" section of the documentation for more information
     on how to define these fields. */
  
  has_categories: true,
  /* If set to true, this exposes a category picker on this box's
     interface, adds a 'categories' attribute to each menu box,
     and adds 'categories' and 'by_category_slug' to
     {{ boxes.menus }}. */
  
  has_locations: true,
  /* If set to true, this exposes a "Locations" picker on this box's interface.
     The locations picker is populated with the boxes with engine "locations"
     that are available on this site. The user can then pick which location(s)
     the content item belongs to. Then, in the context, any location will have
     a 'related' key, where any boxes that belong to that location will be
     available.
  */
  
  has_featured: true,
  /* If set to true, this exposes a featured toggle on this box's
     interface, adds a 'featured' attribute to each Menu box,
     and adds 'featured' and 'not_featured' to {{ boxes.menus }}.  */
  
  order: 2
  /* The place at which this box should be listed in the Boxes
     fly-out menu. If this value isn't specified and this box
     has an engine, it will be prioritized based on the relative
     order its corresponding engine appears under the "Engines"
     page of the documentation. If it does not have an engine, it will be 		 placed at the bottom of the fly-out menu. */

}

Box Configuration