{% extends 'IgniterPromotionBundle::index.html.twig' %}
{% set og_url = generate_og_url(collection, page) %}
{% set component = page.component %}

{% block meta %}
    {{ parent() }}
    <meta property="og:title" content="{{ page.og_title }}" />
    <meta property="og:url" content="{{ og_url }}" />
  {% if page.og_image_asset is defined %}
        <meta property="og:image" content="{{ (asset_base_url ~ page.og_image_asset.file_path ~ '_m.' ~ page.og_image_asset.file_extension)|ensure_protocol }}" />
    {% endif %}
    {% if page.og_description %}
        <meta property="og:description" content="{{ page.og_description }}" />
    {% endif %}
{% endblock %}

{% block content %}
    {# Initialize our page variables #}

    {# EXAMPLE LABEL #}
    {% if component.example_label.contentblock.content is defined %}
        {%  set exampleLabel = component.example_label.contentblock.content %}
    {% else %}
        {%  set exampleLabel = '' %}
    {% endif %}
    
    {# EXAMPLE CONTENT #}
    {% if component.example_content.contentblock.content is defined %}
        {%  set exampleContent = component.example_content.contentblock.content %}
    {% else %}
        {%  set exampleContent = '' %}
    {% endif %}

    {# EXAMPLE LINK LABEL #}
    {% if component.example_link.name is defined %}
        {% set exampleLinkName = (component.example_link.name != '') ? component.example_link.name : '' %}
    {% else %}
        {% set exampleLinkName = '' %}
    {% endif %}

    {# EXAMPLE LINK URL #}
    {% if component.example_link.url is defined %}
        {% set exampleLinkURL = (component.example_link.url != '') ? component.example_link.url : '' %}
    {% else %}
        {% set exampleLinkURL = '' %}
    {% endif %}
    
    <p>
        <ul>
            <li>Label: {{ exampleLabel }}</li>
            <li>Link: <a href="{{ exampleLinkURL }}">{{ exampleLinkName }}</a></li>
            <li>Content: {{ exampleContent }}</li>
        </ul>
    </p>
    
    <div class="row mtxl">
        <div class="small-12 columns">
            <form data-abide>
                <div class="name-field">
                    <label>Your name
                        <small>required</small>
                    </label>
                    <input type="text" required pattern="[a-zA-Z]+" placeholder="Full name">
                    <small class="error">Name is required and must be a string.</small>
                </div>
                <div class="email-field">
                    <label>Email
                        <small>required</small>
                    </label>
                    <input type="email" required>
                    <small class="error">An email address is required.</small>
                </div>
                <button type="submit">Submit</button>
            </form>
        </div>
    </div>

{% endblock %}