Problem/Motivation

Update UI Example template in starterkit according to #3574276: Implement "category" property to organize UI Examples better.

As now we have to loop threw category key.

Proposed resolution

Before :

{% if examples is not empty %}
  {# List of available examples with anchor links. #}
  {% for example in examples %}
    <div class="py-8">
    <h2 class="text-3xl font-bold"><a href="{{ url('ui_examples.single', {'name': example.id}) }}">{{ example.label }}</a></h2>
    {% if example.description %}
      <p>{{ example.description }}</p>
    {% endif %}
    {% if example.render_links %}
      <ul>
        {% for link in example.render_links %}
          <li>{{ link }}</li>
        {% endfor %}
      </ul>
    {% endif %}
    </div>
  {% endfor %}

{% endif %}

After :

{% if examples is not empty %}
  {% for category_id, category in examples %}
    <div class="py-8">
      <h2 id="{{ category_id }}" class="text-3xl font-bold">{{ category.label }}</h2>
      {% for example in category.examples %}
        <div class="py-4">
          <h3 class="text-2xl font-semibold"><a href="{{ url('ui_examples.single', {'name': example.id}) }}">{{ example.label }}</a></h3>
          {% if example.description %}
            <p>{{ example.description }}</p>
          {% endif %}
          {% if example.render_links %}
            <ul>
              {% for link in example.render_links %}
                <li>{{ link }}</li>
              {% endfor %}
            </ul>
          {% endif %}
        </div>
      {% endfor %}
    </div>
  {% endfor %}
{% endif %}
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

g4mbini created an issue. See original summary.

g4mbini’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • g4mbini committed 55319c5a on 5.0.x
    feat: #3586741 [5.0.0-alpha7] Update UI Example template in starterkit...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.