#2168 palpite
This commit is contained in:
parent
db549739a7
commit
22650273d2
@ -43,6 +43,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: top
|
region: top
|
||||||
weight: -3
|
weight: -3
|
||||||
uuid: 6319006a-015c-459c-996b-79d404f7455f
|
uuid: 6319006a-015c-459c-996b-79d404f7455f
|
||||||
@ -54,8 +55,9 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -4
|
weight: -2
|
||||||
uuid: 2ca2f1a3-98b4-41bf-bb67-e17fdd93f1f2
|
uuid: 2ca2f1a3-98b4-41bf-bb67-e17fdd93f1f2
|
||||||
4fc90a5b-8a2d-4f21-9718-e65b9982d59a:
|
4fc90a5b-8a2d-4f21-9718-e65b9982d59a:
|
||||||
id: 'views_block:programme_toc-block_4'
|
id: 'views_block:programme_toc-block_4'
|
||||||
@ -65,6 +67,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -7
|
weight: -7
|
||||||
uuid: 4fc90a5b-8a2d-4f21-9718-e65b9982d59a
|
uuid: 4fc90a5b-8a2d-4f21-9718-e65b9982d59a
|
||||||
@ -76,6 +79,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: top
|
region: top
|
||||||
weight: -4
|
weight: -4
|
||||||
uuid: eb6ccc12-1ccc-4996-9797-be755e42b297
|
uuid: eb6ccc12-1ccc-4996-9797-be755e42b297
|
||||||
@ -87,6 +91,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: bottom
|
region: bottom
|
||||||
weight: 0
|
weight: 0
|
||||||
uuid: 9dbcea4e-26fe-4d78-a245-b192012bd799
|
uuid: 9dbcea4e-26fe-4d78-a245-b192012bd799
|
||||||
@ -135,8 +140,9 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -3
|
weight: -1
|
||||||
uuid: 9f70ea8b-3a5f-4e48-97b0-2b3d5e5e7d03
|
uuid: 9f70ea8b-3a5f-4e48-97b0-2b3d5e5e7d03
|
||||||
232f18ef-a92c-451e-b917-e436b6cbc195:
|
232f18ef-a92c-451e-b917-e436b6cbc195:
|
||||||
id: 'views_block:programme_toc-block_9'
|
id: 'views_block:programme_toc-block_9'
|
||||||
@ -146,8 +152,9 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -5
|
weight: -3
|
||||||
uuid: 232f18ef-a92c-451e-b917-e436b6cbc195
|
uuid: 232f18ef-a92c-451e-b917-e436b6cbc195
|
||||||
b564145a-2058-4710-8204-50569d4f0bf0:
|
b564145a-2058-4710-8204-50569d4f0bf0:
|
||||||
id: 'views_block:programme_toc-block_13'
|
id: 'views_block:programme_toc-block_13'
|
||||||
@ -157,8 +164,9 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -6
|
weight: -4
|
||||||
uuid: b564145a-2058-4710-8204-50569d4f0bf0
|
uuid: b564145a-2058-4710-8204-50569d4f0bf0
|
||||||
b84fe2f8-7c0b-4976-aa63-d8dc5ae66fc0:
|
b84fe2f8-7c0b-4976-aa63-d8dc5ae66fc0:
|
||||||
id: 'views_block:programme_toc-block_16'
|
id: 'views_block:programme_toc-block_16'
|
||||||
@ -168,12 +176,13 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
arguments:
|
arguments:
|
||||||
nid:
|
nid:
|
||||||
type: node_nid
|
type: node_nid
|
||||||
value: '[node:nid]'
|
value: '[node:nid]'
|
||||||
region: first
|
region: first
|
||||||
weight: -1
|
weight: 0
|
||||||
uuid: b84fe2f8-7c0b-4976-aa63-d8dc5ae66fc0
|
uuid: b84fe2f8-7c0b-4976-aa63-d8dc5ae66fc0
|
||||||
532e0e26-eab4-476f-a964-fd68221d5619:
|
532e0e26-eab4-476f-a964-fd68221d5619:
|
||||||
id: prog_exode_urbain_link
|
id: prog_exode_urbain_link
|
||||||
@ -185,6 +194,16 @@ variant_settings:
|
|||||||
weight: -6
|
weight: -6
|
||||||
uuid: 532e0e26-eab4-476f-a964-fd68221d5619
|
uuid: 532e0e26-eab4-476f-a964-fd68221d5619
|
||||||
link_title: 'Exode Urbain'
|
link_title: 'Exode Urbain'
|
||||||
|
698f5eef-78b0-44a3-851b-3adcddfcd119:
|
||||||
|
id: prog_palpite_link
|
||||||
|
label: 'Le Palmarès Palpite'
|
||||||
|
label_display: '0'
|
||||||
|
provider: popsu_link_block
|
||||||
|
context_mapping: { }
|
||||||
|
region: first
|
||||||
|
weight: -5
|
||||||
|
uuid: 698f5eef-78b0-44a3-851b-3adcddfcd119
|
||||||
|
link_title: 'Le Palmarès Palpite'
|
||||||
page_title: ''
|
page_title: ''
|
||||||
layout: layout_threecol_25_50_25
|
layout: layout_threecol_25_50_25
|
||||||
layout_settings:
|
layout_settings:
|
||||||
|
@ -95,6 +95,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -3
|
weight: -3
|
||||||
uuid: 8b03ade6-e854-4bb0-8a9b-34722a2854a3
|
uuid: 8b03ade6-e854-4bb0-8a9b-34722a2854a3
|
||||||
@ -157,6 +158,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -2
|
weight: -2
|
||||||
uuid: c4929f5b-0062-4e02-b61e-c2433a85ac26
|
uuid: c4929f5b-0062-4e02-b61e-c2433a85ac26
|
||||||
|
@ -360,6 +360,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -9
|
weight: -9
|
||||||
uuid: a62c7914-d906-4dfa-aec5-8b58fe51046d
|
uuid: a62c7914-d906-4dfa-aec5-8b58fe51046d
|
||||||
@ -371,6 +372,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -8
|
weight: -8
|
||||||
uuid: a6dd71ed-49c0-4166-b952-7f8269fc0536
|
uuid: a6dd71ed-49c0-4166-b952-7f8269fc0536
|
||||||
@ -382,6 +384,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -7
|
weight: -7
|
||||||
uuid: 92053447-9110-481c-a48d-45abe5289a1e
|
uuid: 92053447-9110-481c-a48d-45abe5289a1e
|
||||||
|
@ -234,6 +234,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -7
|
weight: -7
|
||||||
uuid: 7fd3954d-4223-48fd-8ed9-f719cdb706f0
|
uuid: 7fd3954d-4223-48fd-8ed9-f719cdb706f0
|
||||||
@ -245,6 +246,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -5
|
weight: -5
|
||||||
uuid: b12c9988-1636-44e6-8de3-9f1d07a0561e
|
uuid: b12c9988-1636-44e6-8de3-9f1d07a0561e
|
||||||
@ -266,6 +268,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: 'Ressources liées'
|
views_label: 'Ressources liées'
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
arguments:
|
arguments:
|
||||||
nid:
|
nid:
|
||||||
type: node_nid
|
type: node_nid
|
||||||
@ -281,6 +284,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: ''
|
views_label: ''
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
region: first
|
region: first
|
||||||
weight: -6
|
weight: -6
|
||||||
uuid: 40dfc621-4e0d-4d06-9567-1fb89f13c22b
|
uuid: 40dfc621-4e0d-4d06-9567-1fb89f13c22b
|
||||||
|
@ -308,6 +308,7 @@ variant_settings:
|
|||||||
context_mapping: { }
|
context_mapping: { }
|
||||||
views_label: Collection
|
views_label: Collection
|
||||||
items_per_page: none
|
items_per_page: none
|
||||||
|
exposed: { }
|
||||||
arguments:
|
arguments:
|
||||||
tid:
|
tid:
|
||||||
type: taxonomy
|
type: taxonomy
|
||||||
|
@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\popsu_link_block\Plugin\Block;
|
||||||
|
|
||||||
|
use Drupal\Core\Block\BlockBase;
|
||||||
|
use Drupal\Core\Form\FormStateInterface;
|
||||||
|
use Drupal\Core\Url;
|
||||||
|
use Drupal\Core\Link;
|
||||||
|
// use Drupal\Core\Utility\Token;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a 'ProgExodeurbainLink' block.
|
||||||
|
*
|
||||||
|
* @Block(
|
||||||
|
* id = "prog_palpite_link",
|
||||||
|
* admin_label = @Translation("Prog palpite link"),
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
class ProgPalpiteLink extends BlockBase {
|
||||||
|
|
||||||
|
public function blockForm($form, FormStateInterface $form_state) {
|
||||||
|
$form = parent::blockForm($form, $form_state);
|
||||||
|
|
||||||
|
$config = $this->getConfiguration();
|
||||||
|
|
||||||
|
$form['link_title_wrapper'] = [
|
||||||
|
'#type' => 'container'
|
||||||
|
];
|
||||||
|
|
||||||
|
$form['link_title_wrapper']['link_title'] = [
|
||||||
|
'#type' => 'textfield',
|
||||||
|
'#title' => 'Link title',
|
||||||
|
'#default_value' => isset($config['link_title']) ? $config['link_title'] : "Ressources",
|
||||||
|
'#element_validate' => array('token_element_validate'),
|
||||||
|
'#token_types' => array('node'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$form['link_title_wrapper']['token_tree'] = array(
|
||||||
|
'#theme' => 'token_tree_link',
|
||||||
|
'#token_types' => array('node'),
|
||||||
|
'#show_restricted' => TRUE,
|
||||||
|
'#global_types' => FALSE,
|
||||||
|
'#weight' => 90,
|
||||||
|
);
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function blockSubmit($form, FormStateInterface $form_state)
|
||||||
|
{
|
||||||
|
parent::blockSubmit($form, $form_state);
|
||||||
|
$values = $form_state->getValues();
|
||||||
|
$link_title = $values['link_title_wrapper']['link_title'];
|
||||||
|
$this->configuration['link_title'] = $link_title;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function build() {
|
||||||
|
// $config = $this->getConfiguration();
|
||||||
|
$build = [];
|
||||||
|
$node = \Drupal::routeMatch()->getParameter('node');
|
||||||
|
if ($node instanceof \Drupal\node\Entity\Node) {
|
||||||
|
// check if programme
|
||||||
|
if($node->bundle() == 'programme'){
|
||||||
|
// if yes get id
|
||||||
|
// todo set the hardcoded nid number as a parameter somewhere
|
||||||
|
$nid = $node->id() == 6 ? $node->id() : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($nid){
|
||||||
|
$title = "Le Palmarès Palpite";
|
||||||
|
$url = Url::fromRoute('entity.node.canonical');
|
||||||
|
// todo make the the hardcoded target nid as a parameter somewhere (recorded on the node ?)
|
||||||
|
$url->setRouteParameter("node", 912);
|
||||||
|
$url->setOption('attributes', array("class"=>array('prog-palpite-link')));
|
||||||
|
$build['prog_palpite_link'] = array(
|
||||||
|
'#title' => $title,
|
||||||
|
'#type' => 'link',
|
||||||
|
'#url' => $url
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $build;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user