{#
    This Twig template include load vue_onthefly component.
    It push all variables from context in OnTheFly/App.vue.

    OPTIONS
    * targetEntity  {
          name:     string  'person', 'thirdparty'
          id:       integer
      }
    * action        string  'show', 'edit', 'create'
    * buttonText    string
    * displayBadge  boolean (default: false)  replace button by badge, need to define buttonText for content
    * parent        object  (optional)        pass parent context of the targetEntity (used for course resource comment)

#}
<span class="onthefly-container"

    data-target-name="{{ targetEntity.name|e('html_attr') }}"
    data-target-id="{{ targetEntity.id|e('html_attr') }}"

    {% if action is defined %}
        data-action="{{ action|e('html_attr') }}"
    {% else %}
        data-action="show"
    {% endif %}

    {% if buttonText is defined %}
        data-button-text="{{ buttonText|e('html_attr') }}"
    {% endif %}

    {% if displayBadge is defined and displayBadge == 1 %}
        data-display-badge="true"
    {% endif %}

    {% if parent is defined %}
        data-parent='{{ parent|json_encode }}'
    {% endif %}

></span>
