You are here

SiteLogo.php in More Global Variables 8

File

src/Plugin/GlobalVariable/SiteLogo.php
View source
<?php

namespace Drupal\mgv\Plugin\GlobalVariable;

use Drupal\mgv\Plugin\GlobalVariable;

/**
 * Class SiteLogo.
 *
 * @package Drupal\mgv\Plugin\GlobalVariable
 *
 * @Mgv(
 *   id = "logo",
 * );
 */
class SiteLogo extends GlobalVariable {

  /**
   * {@inheritdoc}
   */
  public function getValue() {

    // Print the Site logo's URL. - we are only printing the URL so you can add
    // custom alt (and other) attributes to the image if you wish.
    $theme_name = \Drupal::theme()
      ->getActiveTheme()
      ->getName();
    return theme_get_setting('logo.url', $theme_name);
  }

}

Classes

Namesort descending Description
SiteLogo Class SiteLogo.