Submit a request
Submit a request

Understanding Question Editor Attribute Paths for Templating and i18n

Each attribute in Question Editor has a path. For example, the path for the below attribute is validation.valid_response.value[0][0].options.setThousandsSeparator[1]
 

Why do you need to know about attribute paths?

It's helpful to know the path of an attribute because it then allows you to hide/show/set the defaults for the attribute using question type templates

 

Attribute paths for label bundles

When adding label bundles, you also need to specify an attribute path. As label bundles do not map exactly to attributes (e.g. there are labels for non-attributes like the add button and content of modal dialogs), the attribute paths for label bundles are slightly different from normal attribute paths. See the docs below for how to find label bundle paths.

 

Finding attribute paths

There are two ways to find attribute paths.

  • Use the debug global layout: if you initialize Question Editor with debug as the global layout (refer to global layout docs for a guide), the attribute path is displayed above every input. This is the preferred option as it also shows you paths for sections which you can hide using hidden_sections
    Here's an example: 
  • Inspect the HTML: if you inspect the HTML, you'll note that the parent div of an input has the attribute data-lrn-qe-input-path

Finding label bundle paths

To find the paths for label bundles, initialize Question Editor with the label_bundle.debug flag set to true.

"label_bundle": {
    // debug flag
    "debug": true
}

This will reveal the paths for all label bundle keys on the page. You can override the label for any of these Items using label_bundle config. 
Was this article helpful?
0 out of 0 found this helpful