ajout des class popsu au view des ressources
This commit is contained in:
		@@ -1382,8 +1382,9 @@ footer {
 | 
			
		||||
      margin-bottom: 1rem; }
 | 
			
		||||
    .path-centre-de-ressources .views-view-grid .views-col .views-field-field-type-de-ressource {
 | 
			
		||||
      text-transform: uppercase;
 | 
			
		||||
      font-size: 500;
 | 
			
		||||
      margin-bottom: .5rem; }
 | 
			
		||||
      font-size: 600;
 | 
			
		||||
      margin-bottom: .5rem;
 | 
			
		||||
      font-size: 0.45rem; }
 | 
			
		||||
    .path-centre-de-ressources .views-view-grid .views-col .views-field-title {
 | 
			
		||||
      font-style: italic; }
 | 
			
		||||
    .path-centre-de-ressources .views-view-grid .views-col .views-field-field-sous-titre {
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -27,17 +27,16 @@ function popsu_preprocess_views_view_unformatted(&$variables) {
 | 
			
		||||
            $variables['rows'][$id]['attributes']->addClass("popsu-node-".$c);
 | 
			
		||||
            //kint($variables['rows'][$id]['content']["#row"]->nid);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  }else{
 | 
			
		||||
    if ($view->current_display == "block_1") {
 | 
			
		||||
        $rows = $variables['rows'];
 | 
			
		||||
        foreach ($rows as $id => $row) {
 | 
			
		||||
            $variables['rows'][$id]['attributes'] = new Attribute();
 | 
			
		||||
            $c = $variables['rows'][$id]['content']["#row"]->nid;
 | 
			
		||||
            $variables['rows'][$id]['attributes']->addClass("popsu-node-".$c);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  // else{
 | 
			
		||||
  //   if ($view->current_display == "block_1") {
 | 
			
		||||
  //       $rows = $variables['rows'];
 | 
			
		||||
  //       foreach ($rows as $id => $row) {
 | 
			
		||||
  //           $variables['rows'][$id]['attributes'] = new Attribute();
 | 
			
		||||
  //           $c = $variables['rows'][$id]['content']["#row"]->nid;
 | 
			
		||||
  //           $variables['rows'][$id]['attributes']->addClass("popsu-node-".$c);
 | 
			
		||||
  //       }
 | 
			
		||||
  //   }
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
@@ -70,9 +69,18 @@ function popsu_preprocess_region(&$variables) {
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_preprocess_block().
 | 
			
		||||
 */
 | 
			
		||||
// function popsu_preprocess_block(&$variables) {
 | 
			
		||||
//   $t="t";
 | 
			
		||||
// }
 | 
			
		||||
 | 
			
		||||
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);die();
 | 
			
		||||
      // $variables['row']['attributes'] = new Attribute();
 | 
			
		||||
      // $variables['row']['attributes']->addClass("pouet-node-".$target_id);     
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function popsu_preprocess_views_view_field(&$variables){
 | 
			
		||||
  // check if link to entoty option is true
 | 
			
		||||
@@ -80,14 +88,16 @@ function popsu_preprocess_views_view_field(&$variables){
 | 
			
		||||
  if (isset($settings['link_to_entity']) && $settings['link_to_entity']) {
 | 
			
		||||
    // get the entity and build the classes
 | 
			
		||||
    $entity = $variables['row']->_entity;
 | 
			
		||||
    // $target_id = $entity;
 | 
			
		||||
 | 
			
		||||
    // build new classes
 | 
			
		||||
    $new_classes = array(
 | 
			
		||||
      $entity->getEntityTypeId(),
 | 
			
		||||
      $entity->getEntityTypeId().'-'.$entity->bundle(),
 | 
			
		||||
      $entity->getEntityTypeId().'-'.$entity->bundle().'-'.$entity->id()
 | 
			
		||||
      $entity->getEntityTypeId().'-'.$entity->bundle().'-'.$entity->id(),
 | 
			
		||||
    );
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    // get the entity link and url
 | 
			
		||||
    $link = $entity->toLink(); 
 | 
			
		||||
    $url = $entity->toLink()->getUrl();
 | 
			
		||||
 
 | 
			
		||||
@@ -56,8 +56,9 @@
 | 
			
		||||
			}
 | 
			
		||||
			.views-field-field-type-de-ressource{
 | 
			
		||||
				text-transform: uppercase;
 | 
			
		||||
				font-size: 500;
 | 
			
		||||
				font-size: 600;
 | 
			
		||||
				margin-bottom: .5rem;
 | 
			
		||||
				font-size: $font-small;
 | 
			
		||||
			}
 | 
			
		||||
			.views-field-title{
 | 
			
		||||
				font-style: italic;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user