You are here

SocialUserSearchContentBlockAlter.php in Open Social 10.0.x

Namespace

Drupal\social_user

File

modules/social_features/social_user/src/SocialUserSearchContentBlockAlter.php
View source
<?php

namespace Drupal\social_user;

use Drupal\Core\Security\TrustedCallbackInterface;

/**
 * Provides a trusted callback to alter the system branding block.
 *
 * @see social_user_block_view_search_content_block_alter()
 */
class SocialUserSearchContentBlockAlter implements TrustedCallbackInterface {

  /**
   * Pre render for the search content in the header. This will add javascript.
   */
  public static function preRender($build) {

    // Attach the social_search library defined in social_search.libraries.yml.
    $build['#attached'] = [
      'library' => [
        'social_search/navbar-search',
      ],
    ];
    return $build;
  }

  /**
   * {@inheritdoc}
   */
  public static function trustedCallbacks() {
    return [
      'preRender',
    ];
  }

}

Classes

Namesort descending Description
SocialUserSearchContentBlockAlter Provides a trusted callback to alter the system branding block.