config view

This commit is contained in:
2023-11-06 12:52:04 +01:00
parent ea38bdd02f
commit 8668a0438e
5 changed files with 138 additions and 25 deletions
+12 -12
View File
@@ -18,19 +18,19 @@ function rorschach_preprocess_html(&$variables) {
}
function rorschach_preprocess_node(&$variables){
$node = &$variables['node'];
$variables['attributes']['class'][] = 'node-type-' . $node->gettype();
if($node->gettype() == "actualite") {
$actu_type = $node->get('field_actu_type')->getString();
$variables['attributes']['class'][] = 'actu-type-' . $actu_type;
}
if($node->gettype() == "offre_de_service") {
$type_protagoniste = $node->get('field_type_de_protagoniste')->getString();
$variables['attributes']['class'][] = 'type-de-protagoniste-' . $type_protagoniste;
}
// function rorschach_preprocess_node(&$variables){
// $node = &$variables['node'];
// $variables['attributes']['class'][] = 'node-type-' . $node->gettype();
// if($node->gettype() == "actualite") {
// $actu_type = $node->get('field_actu_type')->getString();
// $variables['attributes']['class'][] = 'actu-type-' . $actu_type;
// }
// if($node->gettype() == "offre_de_service") {
// $type_protagoniste = $node->get('field_type_de_protagoniste')->getString();
// $variables['attributes']['class'][] = 'type-de-protagoniste-' . $type_protagoniste;
// }
}
// }
function rorschach_preprocess_field(&$variables) {
$node = \Drupal::routeMatch()->getParameter('node');
@@ -0,0 +1,23 @@
{#
/**
* @file
* Default theme implementation for a single node in a printer-friendly outline.
*
* Available variables:
* - node: Fully loaded node.
* - depth: Depth of the current node inside the outline.
* - title: Node title.
* - content: Node content.
* - children: All the child nodes recursively rendered through this file.
*
* @see template_preprocess_book_node_export_html()
*
* @ingroup themeable
*/
#}
<article>
<h1>{{ title }}</h1>
{{ depth }}
{{ content }}
{{ children }}
</article>
@@ -0,0 +1,39 @@
{#
/**
* @file
* Default theme implementation for the node title field.
*
* This is an override of field.html.twig for the node title field. See that
* template for documentation about its details and overrides.
*
* Available variables:
* - attributes: HTML attributes for the containing span element.
* - items: List of all the field items. Each item contains:
* - attributes: List of HTML attributes for each item.
* - content: The field item content.
* - entity_type: The entity type to which the field belongs.
* - field_name: The name of the field.
* - field_type: The type of the field.
* - label_display: The display settings for the label.
* - is_inline: If false, display an ordinary field.
* If true, display an inline format, suitable for inside elements such as
* <span>, <h2> and so on.
*
* @see field.html.twig
* @see node_preprocess_field__node()
*
* @ingroup themeable
*
* @todo Delete as part of https://www.drupal.org/node/3015623
*/
#}
{% if not is_inline %}
{% include "field.html.twig" %}
{% else %}
<span{{ attributes }}>
{%- for item in items -%}
{{ item.content }}
{%- endfor -%}
</span>
{% endif %}