Commit ddbbc43e authored by Truls Steenstrup Yggeseth's avatar Truls Steenstrup Yggeseth
Browse files

Merge remote-tracking branch 'upstream/8.x-3.x' into fix/flag

parents fec7073f 29dd5337
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ use Drupal\Core\Url;
use Drupal\group\Entity\Group;
use Drupal\group\Entity\GroupContent;
use Drupal\node\Entity\Node;
use Drupal\Core\Language\LanguageInterface;

/**
 * Implements hook_token_info().
@@ -119,6 +120,10 @@ function activity_logger_tokens($type, $tokens, array $data, array $options, Bub
              // If it's a group.. add it in the arguments.
              if (isset($group) && $group instanceof Group) {
                if ($name === 'gtitle') {
                  $curr_langcode = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId();
                  if ($group->isTranslatable() && $group->hasTranslation($curr_langcode)) {
                    $group = $group->getTranslation($curr_langcode);
                  }
                  $replacements[$original] = $group->label();
                }
                if ($name === 'gurl') {
+4 −14
Original line number Diff line number Diff line
@@ -6,8 +6,6 @@
 */

use Drupal\Core\Form\FormStateInterface;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
use Drupal\node\NodeInterface;
use Drupal\image\Entity\ImageStyle;
use Drupal\Core\Url;
@@ -73,7 +71,7 @@ function template_preprocess_page_hero_data(array &$variables) {
    }

    // Add node edit url for management.
    if ($node instanceof Node) {
    if ($node instanceof NodeInterface) {
      // Get the current route name to check if the user is on the
      // edit or delete page.
      $route = \Drupal::routeMatch()->getRouteName();
@@ -338,19 +336,11 @@ function social_core_menu_local_tasks_alter(&$data, $route_name) {
    }
  }

  $node = \Drupal::service('current_route_match')->getParameter('node');

  if (!is_null($node) && !is_object($node)) {
    $node = Node::load($node);
  }

  // Check for all active node types.
  if ($node instanceof Node && array_key_exists($node->getType(), NodeType::loadMultiple())) {
    // Remove Edit tab. Edit will always go through Floating Edit Button.
  // Remove node Edit tab. Edit will always go through Floating Edit Button.
  if (isset($data['tabs'][0]['entity.node.edit_form'])) {
    unset($data['tabs'][0]['entity.node.edit_form']);
  }
  }

  // Change the default 'View' tab title.
  if (isset($data['tabs'][0]['entity.node.canonical']['#link'])) {
    $data['tabs'][0]['entity.node.canonical']['#link']['title'] = t('Details');
+5 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ use Drupal\Component\Utility\Html as HtmlUtility;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\bootstrap\Bootstrap;
use Drupal\node\Entity\Node;
use Drupal\Core\Language\LanguageInterface;

// Include all files from the includes directory.
$includes_path = dirname(__FILE__) . '/includes/*.inc';
@@ -41,6 +42,10 @@ function socialbase_group_link($node) {
        'type' => $group_type_id . '-group_node-' . $node->getType(),
      ]);
    if (!empty($group_content)) {
      $curr_langcode = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId();
      if ($group->isTranslatable() && $group->hasTranslation($curr_langcode)) {
        $group = $group->getTranslation($curr_langcode);
      }
      $group_link = $group->link();
    }
  }