Skip to content

Commit

Permalink
ServiceAlertTweet: fix block
Browse files Browse the repository at this point in the history
  • Loading branch information
protitude committed Dec 4, 2024
1 parent 2077f0f commit b3c00c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Plugin/Block/ServiceAlertTweet.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ public function build() {
$route_match = $this->routeMatchInterface->getRawParameters()->getIterator();
$node_title = $this->entityTypeManager->getStorage('node')->load($route_match['node'])->getTitle();
$node_type = $this->entityTypeManager->getStorage('node')->load($route_match['node'])->bundle();
$service_status = $node_type == 'service_alert' ? $this->entityTypeManager->getStorage('node')->load($route_match['node'])->get('field_service_alert_status')->value : '';
$service_status = $node_type == 'service_alert' ? $this->entityTypeManager->getStorage('node')->load($route_match['node'])->get('field_service_alert_status')->value . ': ' : '';
$host = $this->request->getCurrentRequest()->getSchemeAndHttpHost();
$current_path = $this->currentPathStack->getPath();
$tweet = urlencode($service_status . ': ' . $node_title . ' ' . $host . $current_path);
$tweet = urlencode($service_status . $node_title . ' ' . $host . $current_path);
$url = Url::fromUri('https://x.com/intent/tweet?text=' . $tweet);
$external_link = Link::fromTextAndUrl($this->t('𝕏'), $url)->toString();
return [
Expand Down

0 comments on commit b3c00c3

Please sign in to comment.