preprocess pour grid ressources
This commit is contained in:
@@ -6,13 +6,6 @@
|
||||
|
||||
use Drupal\Core\Template\Attribute;
|
||||
|
||||
/* implements template_preprocess_views_view() */
|
||||
|
||||
// function popsu_preprocess_views_view(&$vars) {
|
||||
// $view = $vars['view'];
|
||||
// kint($view);die();
|
||||
// }
|
||||
|
||||
|
||||
/* implements template_preprocess_views_view_unformatted() */
|
||||
|
||||
@@ -42,19 +35,33 @@ function popsu_preprocess_region(&$variables) {
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_block().
|
||||
* Implements hook_preprocess_page().
|
||||
*/
|
||||
|
||||
function popsu_preprocess_views_view_fields(&$variables){
|
||||
|
||||
$entity = $variables['row']->_entity;
|
||||
if($entity->hasField('field_programme')){
|
||||
$target_id = $entity->get('field_programme')->getString();
|
||||
//kint($variables['row']);die();
|
||||
// $variables['row']['attributes'] = new Attribute();
|
||||
// $variables['row']['attributes']->addClass("pouet-node-".$target_id);
|
||||
// function popsu_preprocess_page(&$variables){
|
||||
// $rows = $variables['rows'];
|
||||
// }
|
||||
|
||||
function popsu_preprocess_views_view_grid(&$variables){
|
||||
$rows = $variables['rows'];
|
||||
|
||||
foreach ($rows as $id => $row) {
|
||||
|
||||
$entity = $row["#row"]->_entity;
|
||||
$prog_id = $entity->get('field_programme')->getString();
|
||||
|
||||
// une fois qu'on obtient l'id du programme
|
||||
// on crée une class pour chaque colonne
|
||||
$options = $row["#view"]->style_plugin->options;
|
||||
//V0
|
||||
$options['col_class_custom'] = "popsu-node-".$prog_id;
|
||||
|
||||
//notes
|
||||
// $attrs['class'] = "popsu-node-".$prog_id;
|
||||
// $rows[$id]["#options"]["col_class_custom"] = new Attribute($attrs);
|
||||
//$rows[$id]["#options"]["col_class_custom"] = 'class';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function popsu_preprocess_views_view_field(&$variables){
|
||||
|
Reference in New Issue
Block a user