deactivated popsu_monde links, sass needs to be compiled
This commit is contained in:
parent
3c1a1914bd
commit
38bcce6c82
@ -5,7 +5,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use Drupal\Core\Template\Attribute;
|
use Drupal\Core\Template\Attribute;
|
||||||
|
use Drupal\Core\Link;
|
||||||
|
use Drupal\Core\Url;
|
||||||
|
|
||||||
// function popsu_preprocess_views_view_list(&$variables){
|
// function popsu_preprocess_views_view_list(&$variables){
|
||||||
// kint($variables);die();
|
// kint($variables);die();
|
||||||
@ -133,12 +134,37 @@ function popsu_preprocess_views_view_grid(&$variables){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function popsu_preprocess_views_view_field(&$variables){
|
function popsu_preprocess_views_view_field(&$variables){
|
||||||
// check if link to entoty option is true
|
// check if link to entity option is true
|
||||||
$settings = isset($variables['field']->options['settings']) ? $variables['field']->options['settings'] : false;
|
$settings = isset($variables['field']->options['settings']) ? $variables['field']->options['settings'] : false;
|
||||||
if ($settings && isset($settings['link_to_entity']) && $settings['link_to_entity']) {
|
if ($settings && isset($settings['link_to_entity']) && $settings['link_to_entity']) {
|
||||||
// get the entity and build the classes
|
// get the entity and build the classes
|
||||||
$entity = $variables['row']->_entity;
|
$entity = $variables['row']->_entity;
|
||||||
|
// $entity_type = $entity->getEntityType();
|
||||||
|
if ($entity->getEntityType()->id() == "node" && $entity->id() == 5) {
|
||||||
|
// temporarely desactivate popsumonde link
|
||||||
|
// get the entity link and url
|
||||||
|
$link = $entity->toLink();
|
||||||
|
|
||||||
|
// // $url = $entity->toLink()->getUrl();
|
||||||
|
// $url = URL::fromUserInput('#');
|
||||||
|
// // update the url of the link
|
||||||
|
// $link->setUrl($url);
|
||||||
|
|
||||||
|
// overwrite the output
|
||||||
|
$variables['output'] = [
|
||||||
|
'#type' => 'html_tag',
|
||||||
|
'#tag' => 'span',
|
||||||
|
'#value' => $link->getText(),
|
||||||
|
'#attributes' => [
|
||||||
|
"class" => array(
|
||||||
|
$entity->getEntityTypeId(),
|
||||||
|
$entity->getEntityTypeId().'-'.$entity->bundle(),
|
||||||
|
$entity->getEntityTypeId().'-'.$entity->bundle().'-'.$entity->id(),
|
||||||
|
)
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
}else{
|
||||||
// build new classes
|
// build new classes
|
||||||
$new_classes = array(
|
$new_classes = array(
|
||||||
$entity->getEntityTypeId(),
|
$entity->getEntityTypeId(),
|
||||||
@ -146,8 +172,6 @@ function popsu_preprocess_views_view_field(&$variables){
|
|||||||
$entity->getEntityTypeId().'-'.$entity->bundle().'-'.$entity->id(),
|
$entity->getEntityTypeId().'-'.$entity->bundle().'-'.$entity->id(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// get the entity link and url
|
// get the entity link and url
|
||||||
$link = $entity->toLink();
|
$link = $entity->toLink();
|
||||||
$url = $entity->toLink()->getUrl();
|
$url = $entity->toLink()->getUrl();
|
||||||
@ -175,6 +199,8 @@ function popsu_preprocess_views_view_field(&$variables){
|
|||||||
|
|
||||||
// overwrite the output
|
// overwrite the output
|
||||||
$variables['output'] = $link->toRenderable();
|
$variables['output'] = $link->toRenderable();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: auto;
|
width: auto;
|
||||||
a{
|
a, span{
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user