{% extends "base/file.php.twig" %}

{% block file_path %}
{{ entity_name }}.page.inc{% endblock %}
{% block extra_info %}
 *
 * Page callback for {{ label }} entities.
{% endblock %}

{% block use_class %}
use Drupal\Core\Render\Element;
{% endblock %}

{% block file_methods %}
/**
 * Prepares variables for {{ label }} templates.
 *
 * Default template: {{ entity_name }}.html.twig.
 *
 * @param array $variables
 *   An associative array containing:
 *   - elements: An associative array containing the user information and any
 *   - attributes: HTML attributes for the containing element.
 */
function template_preprocess_{{ entity_name | machine_name }}(array &$variables) {
  // Fetch {{ entity_class }} Entity Object.
  ${{ entity_name | machine_name }} = $variables['elements']['#{{ entity_name }}'];

  // Helpful $content variable for templates.
  foreach (Element::children($variables['elements']) as $key) {
    $variables['content'][$key] = $variables['elements'][$key];
  }
}
{% endblock %}
