Issue #1053648 by mdrummond, lokapujya, Cottser, Jeff Burnz, Les Lim, Gábor Hojtsy: Convert site elements (site name, slogan, site logo) into blocks.
parent
9ba8e07517
commit
e0522e1905
core
modules
block
lib/Drupal/block
templates
system
lib/Drupal/system/Plugin/Block
themes/bartik
|
@ -93,6 +93,13 @@ class BlockFormController extends EntityFormController {
|
|||
*/
|
||||
public function form(array $form, array &$form_state) {
|
||||
$entity = $this->entity;
|
||||
|
||||
// Store theme settings in $form_state for use below.
|
||||
if (!$theme = $entity->get('theme')) {
|
||||
$theme = $this->configFactory->get('system.theme')->get('default');
|
||||
}
|
||||
$form_state['block_theme'] = $theme;
|
||||
|
||||
$form['#tree'] = TRUE;
|
||||
$form['settings'] = $entity->getPlugin()->buildConfigurationForm(array(), $form_state);
|
||||
|
||||
|
@ -226,10 +233,10 @@ class BlockFormController extends EntityFormController {
|
|||
);
|
||||
|
||||
// Theme settings.
|
||||
if ($theme = $entity->get('theme')) {
|
||||
if ($entity->get('theme')) {
|
||||
$form['theme'] = array(
|
||||
'#type' => 'value',
|
||||
'#value' => $entity->get('theme'),
|
||||
'#value' => $theme,
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
@ -239,7 +246,6 @@ class BlockFormController extends EntityFormController {
|
|||
$theme_options[$theme_name] = $theme_info->info['name'];
|
||||
}
|
||||
}
|
||||
$theme = $this->configFactory->get('system.theme')->get('default');
|
||||
$form['theme'] = array(
|
||||
'#type' => 'select',
|
||||
'#options' => $theme_options,
|
||||
|
@ -251,6 +257,7 @@ class BlockFormController extends EntityFormController {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Region settings.
|
||||
$form['region'] = array(
|
||||
'#type' => 'select',
|
||||
|
|
|
@ -139,12 +139,12 @@ class BlockStorageUnitTest extends DrupalUnitTestBase {
|
|||
$expected[] = ' ';
|
||||
$expected[] = '';
|
||||
$expected[] = ' <div class="content">';
|
||||
$expected[] = ' ';
|
||||
$expected[] = ' </div>';
|
||||
$expected[] = ' ';
|
||||
$expected[] = ' </div>';
|
||||
$expected[] = '</div>';
|
||||
$expected[] = '';
|
||||
$expected_output = implode("\n", $expected);
|
||||
$this->assertEqual(drupal_render($output), $expected_output, 'The block rendered correctly.');
|
||||
$this->assertEqual(drupal_render($output), $expected_output);
|
||||
|
||||
// Reset the HTML IDs so that the next render is not affected.
|
||||
drupal_static_reset('drupal_html_id');
|
||||
|
@ -167,12 +167,12 @@ class BlockStorageUnitTest extends DrupalUnitTestBase {
|
|||
$expected[] = ' ';
|
||||
$expected[] = '';
|
||||
$expected[] = ' <div class="content">';
|
||||
$expected[] = ' ';
|
||||
$expected[] = ' </div>';
|
||||
$expected[] = ' ';
|
||||
$expected[] = ' </div>';
|
||||
$expected[] = '</div>';
|
||||
$expected[] = '';
|
||||
$expected_output = implode("\n", $expected);
|
||||
$this->assertEqual(drupal_render($output), $expected_output, 'The block rendered correctly.');
|
||||
$this->assertEqual(drupal_render($output), $expected_output);
|
||||
// Clean up this entity.
|
||||
$entity->delete();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\block\Tests\BlockSystemBrandingTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\block\Tests;
|
||||
|
||||
/**
|
||||
* Provides testing for the branding block functionality.
|
||||
*/
|
||||
class BlockSystemBrandingTest extends BlockTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('block', 'system');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'System Branding Block',
|
||||
'description' => 'Tests branding block display.',
|
||||
'group' => 'Block',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
// Set a site slogan.
|
||||
\Drupal::config('system.site')
|
||||
->set('slogan', 'Community plumbing')
|
||||
->save();
|
||||
// Add the system branding block to the page.
|
||||
$this->drupalPlaceBlock('system_branding_block', array('region' => 'header', 'id' => 'site-branding'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests system branding block configuration.
|
||||
*/
|
||||
public function testSystemBrandingSettings() {
|
||||
$site_logo_xpath = '//div[@id="block-site-branding"]//a[@class="site-logo"]';
|
||||
$site_name_xpath = '//div[@id="block-site-branding"]//div[@class="site-name"]';
|
||||
$site_slogan_xpath = '//div[@id="block-site-branding"]//div[@class="site-slogan"]';
|
||||
|
||||
// Set default block settings.
|
||||
$this->drupalGet('');
|
||||
$site_logo_element = $this->xpath($site_logo_xpath);
|
||||
$site_name_element = $this->xpath($site_name_xpath);
|
||||
$site_slogan_element = $this->xpath($site_slogan_xpath);
|
||||
// Test that all branding elements are displayed.
|
||||
$this->assertTrue(!empty($site_logo_element), 'The branding block logo was found.');
|
||||
$this->assertTrue(!empty($site_name_element), 'The branding block site name was found.');
|
||||
$this->assertTrue(!empty($site_slogan_element), 'The branding block slogan was found.');
|
||||
|
||||
// Turn just the logo off.
|
||||
\Drupal::config('block.block.site-branding')
|
||||
->set('settings.use_site_logo', 0)
|
||||
->save();
|
||||
$this->drupalGet('');
|
||||
$site_logo_element = $this->xpath($site_logo_xpath);
|
||||
$site_name_element = $this->xpath($site_name_xpath);
|
||||
$site_slogan_element = $this->xpath($site_slogan_xpath);
|
||||
// Re-test all branding elements.
|
||||
$this->assertTrue(empty($site_logo_element), 'The branding block logo was disabled.');
|
||||
$this->assertTrue(!empty($site_name_element), 'The branding block site name was found.');
|
||||
$this->assertTrue(!empty($site_slogan_element), 'The branding block slogan was found.');
|
||||
|
||||
// Turn just the site name off.
|
||||
\Drupal::config('block.block.site-branding')
|
||||
->set('settings.use_site_logo', 1)
|
||||
->set('settings.use_site_name', 0)
|
||||
->save();
|
||||
$this->drupalGet('');
|
||||
$site_logo_element = $this->xpath($site_logo_xpath);
|
||||
$site_name_element = $this->xpath($site_name_xpath);
|
||||
$site_slogan_element = $this->xpath($site_slogan_xpath);
|
||||
// Re-test all branding elements.
|
||||
$this->assertTrue(!empty($site_logo_element), 'The branding block logo was found.');
|
||||
$this->assertTrue(empty($site_name_element), 'The branding block site name was disabled.');
|
||||
$this->assertTrue(!empty($site_slogan_element), 'The branding block slogan was found.');
|
||||
|
||||
// Turn just the site slogan off.
|
||||
\Drupal::config('block.block.site-branding')
|
||||
->set('settings.use_site_name', 1)
|
||||
->set('settings.use_site_slogan', 0)
|
||||
->save();
|
||||
$this->drupalGet('');
|
||||
$site_logo_element = $this->xpath($site_logo_xpath);
|
||||
$site_name_element = $this->xpath($site_name_xpath);
|
||||
$site_slogan_element = $this->xpath($site_slogan_xpath);
|
||||
// Re-test all branding elements.
|
||||
$this->assertTrue(!empty($site_logo_element), 'The branding block logo was found.');
|
||||
$this->assertTrue(!empty($site_name_element), 'The branding block site name was found.');
|
||||
$this->assertTrue(empty($site_slogan_element), 'The branding block slogan was disabled.');
|
||||
|
||||
// Turn the site name and the site slogan off.
|
||||
\Drupal::config('block.block.site-branding')
|
||||
->set('settings.use_site_name', 0)
|
||||
->set('settings.use_site_slogan', 0)
|
||||
->save();
|
||||
$this->drupalGet('');
|
||||
$site_logo_element = $this->xpath($site_logo_xpath);
|
||||
$site_name_element = $this->xpath($site_name_xpath);
|
||||
$site_slogan_element = $this->xpath($site_slogan_xpath);
|
||||
// Re-test all branding elements.
|
||||
$this->assertTrue(!empty($site_logo_element), 'The branding block logo was found.');
|
||||
$this->assertTrue(empty($site_name_element), 'The branding block site name was disabled.');
|
||||
$this->assertTrue(empty($site_slogan_element), 'The branding block slogan was disabled.');
|
||||
}
|
||||
|
||||
}
|
|
@ -49,6 +49,8 @@
|
|||
{{ title_suffix }}
|
||||
|
||||
<div{{ content_attributes }}>
|
||||
{{ content }}
|
||||
{% block content %}
|
||||
{{ content }}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,203 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\system\Plugin\Block\SystemBrandingBlock.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Plugin\Block;
|
||||
|
||||
use Drupal\block\BlockBase;
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\Core\Routing\UrlGeneratorInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Component\Utility\Xss;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Provides a block to display 'Site branding' elements.
|
||||
*
|
||||
* @Block(
|
||||
* id = "system_branding_block",
|
||||
* admin_label = @Translation("Site branding")
|
||||
* )
|
||||
*/
|
||||
class SystemBrandingBlock extends BlockBase implements ContainerFactoryPluginInterface {
|
||||
|
||||
/**
|
||||
* The URL generator.
|
||||
*
|
||||
* @var \Drupal\Core\Routing\UrlGeneratorInterface
|
||||
*/
|
||||
protected $urlGenerator;
|
||||
|
||||
/**
|
||||
* Stores the configuration factory.
|
||||
*
|
||||
* @var \Drupal\Core\Config\ConfigFactoryInterface
|
||||
*/
|
||||
protected $configFactory;
|
||||
|
||||
/**
|
||||
* The current user.
|
||||
*
|
||||
* @var \Drupal\Core\Session\AccountInterface
|
||||
*/
|
||||
protected $current_user;
|
||||
|
||||
/**
|
||||
* Creates a SystemBrandingBlock instance.
|
||||
*
|
||||
* @param array $configuration
|
||||
* A configuration array containing information about the plugin instance.
|
||||
* @param string $plugin_id
|
||||
* The plugin_id for the plugin instance.
|
||||
* @param array $plugin_definition
|
||||
* The plugin implementation definition.
|
||||
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
|
||||
* The factory for configuration objects.
|
||||
* @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
|
||||
* The url generator service.
|
||||
* @param \Drupal\Core\Session\AccountInterface $current_user
|
||||
* The current user.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, array $plugin_definition, ConfigFactoryInterface $config_factory, UrlGeneratorInterface $url_generator, AccountInterface $current_user) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
$this->configFactory = $config_factory;
|
||||
$this->urlGenerator = $url_generator;
|
||||
$this->currentUser = $current_user;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) {
|
||||
return new static(
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$container->get('config.factory'),
|
||||
$container->get('url_generator'),
|
||||
$container->get('current_user')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function defaultConfiguration() {
|
||||
return array(
|
||||
'use_site_logo' => TRUE,
|
||||
'use_site_name' => TRUE,
|
||||
'use_site_slogan' => TRUE,
|
||||
'label_display' => FALSE,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function blockForm($form, &$form_state) {
|
||||
// Get the theme.
|
||||
$theme = $form_state['block_theme'];
|
||||
|
||||
// Get permissions.
|
||||
$administer_themes_access = $this->currentUser->hasPermission('administer themes');
|
||||
$administer_site_configuration_access = $this->currentUser->hasPermission('administer site configuration');
|
||||
|
||||
if ($administer_themes_access) {
|
||||
// Get paths to theme settings pages.
|
||||
$appearance_url = $this->urlGenerator->generateFromRoute('system.themes_page');
|
||||
$theme_settings_url = $this->urlGenerator->generateFromRoute('system.theme_settings_theme', array('theme' => $theme));
|
||||
|
||||
// Provide links to the Appearance and Theme Settings pages
|
||||
// if the user has access to administer themes.
|
||||
$site_logo_description = $this->t('Defined on the <a href="@appearance">Appearance</a> or <a href="@theme">Theme Settings</a> page.', array('@appearance' => $appearance_url, '@theme' => $theme_settings_url));
|
||||
}
|
||||
else {
|
||||
// Explain that the user does not have access to the Appearance and Theme
|
||||
// Settings pages.
|
||||
$site_logo_description = $this->t('Defined on the Appearance or Theme Settings page. You do not have the appropriate permissions to change the site logo.');
|
||||
}
|
||||
if ($administer_site_configuration_access) {
|
||||
// Get paths to settings pages.
|
||||
$site_information_url = $this->urlGenerator->generateFromRoute('system.site_information_settings');
|
||||
|
||||
// Provide link to Site Information page if the user has access to
|
||||
// administer site configuration.
|
||||
$site_name_description = $this->t('Defined on the <a href="@information">Site Information</a> page.', array('@information' => $site_information_url));
|
||||
$site_slogan_description = $this->t('Defined on the <a href="@information">Site Information</a> page.', array('@information' => $site_information_url));
|
||||
}
|
||||
else {
|
||||
// Explain that the user does not have access to the Site Information
|
||||
// page.
|
||||
$site_name_description = $this->t('Defined on the Site Information page. You do not have the appropriate permissions to change the site logo.');
|
||||
$site_slogan_description = $this->t('Defined on the Site Information page. You do not have the appropriate permissions to change the site logo.');
|
||||
}
|
||||
|
||||
$form['block_branding'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => $this->t('Toggle branding elements'),
|
||||
'#description' => $this->t('Choose which branding elements you want to show in this block instance.'),
|
||||
);
|
||||
$form['block_branding']['use_site_logo'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => $this->t('Site logo'),
|
||||
'#description' => $site_logo_description,
|
||||
'#default_value' => $this->configuration['use_site_logo'],
|
||||
);
|
||||
|
||||
$form['block_branding']['use_site_name'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => $this->t('Site name'),
|
||||
'#description' => $site_name_description,
|
||||
'#default_value' => $this->configuration['use_site_name'],
|
||||
);
|
||||
$form['block_branding']['use_site_slogan'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => $this->t('Site slogan'),
|
||||
'#description' => $site_slogan_description,
|
||||
'#default_value' => $this->configuration['use_site_slogan'],
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function blockSubmit($form, &$form_state) {
|
||||
$this->configuration['use_site_logo'] = $form_state['values']['block_branding']['use_site_logo'];
|
||||
$this->configuration['use_site_name'] = $form_state['values']['block_branding']['use_site_name'];
|
||||
$this->configuration['use_site_slogan'] = $form_state['values']['block_branding']['use_site_slogan'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function build() {
|
||||
$build = array();
|
||||
$site_config = $this->configFactory->get('system.site');
|
||||
|
||||
$logo = theme_get_setting('logo');
|
||||
$build['site_logo'] = array(
|
||||
'#theme' => 'image',
|
||||
'#uri' => $logo['url'],
|
||||
'#alt' => t('Home'),
|
||||
'#access' => $this->configuration['use_site_logo'],
|
||||
);
|
||||
|
||||
$build['site_name'] = array(
|
||||
'#markup' => $site_config->get('name'),
|
||||
'#access' => $this->configuration['use_site_name'],
|
||||
);
|
||||
|
||||
$build['site_slogan'] = array(
|
||||
'#markup' => Xss::filterAdmin($site_config->get('slogan')),
|
||||
'#access' => $this->configuration['use_site_slogan'],
|
||||
);
|
||||
|
||||
return $build;
|
||||
}
|
||||
|
||||
}
|
|
@ -153,6 +153,14 @@ function system_help($path, $arg) {
|
|||
*/
|
||||
function system_theme() {
|
||||
return array_merge(drupal_common_theme(), array(
|
||||
// Normally theme suggestion templates are only picked up when they are in
|
||||
// themes. We explicitly define the block__system_branding_block theme
|
||||
// suggestion here so that the template in core/modules/system/templates
|
||||
// is picked up.
|
||||
'block__system_branding_block' => array(
|
||||
'base hook' => 'block',
|
||||
'template' => 'block--system-branding-block',
|
||||
),
|
||||
'system_themes_page' => array(
|
||||
'variables' => array(
|
||||
'theme_groups' => NULL,
|
||||
|
@ -1218,6 +1226,21 @@ function system_user_timezone(&$form, &$form_state) {
|
|||
*/
|
||||
function system_preprocess_block(&$variables) {
|
||||
switch ($variables['base_plugin_id']) {
|
||||
case 'system_branding_block':
|
||||
$variables['site_logo'] = '';
|
||||
if ($variables['content']['site_logo']['#access'] && $variables['content']['site_logo']['#uri']) {
|
||||
$variables['site_logo'] = $variables['content']['site_logo']['#uri'];
|
||||
}
|
||||
$variables['site_name'] = '';
|
||||
if ($variables['content']['site_name']['#access'] && $variables['content']['site_name']['#markup']) {
|
||||
$variables['site_name'] = $variables['content']['site_name']['#markup'];
|
||||
}
|
||||
$variables['site_slogan'] = '';
|
||||
if ($variables['content']['site_slogan']['#access'] && $variables['content']['site_slogan']['#markup']) {
|
||||
$variables['site_slogan'] = $variables['content']['site_slogan']['#markup'];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'system_powered_by_block':
|
||||
$variables['attributes']['role'] = 'complementary';
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
{% extends "@block/block.html.twig" %}
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Default theme implementation for a branding block.
|
||||
*
|
||||
* Each branding element variable (logo, name, slogan) is only available if
|
||||
* enabled in the block configuration.
|
||||
*
|
||||
* Available variables:
|
||||
* - site_logo: Logo for site as defined in Appearance or theme settings.
|
||||
* - site_name: Name for site as defined in Site information settings.
|
||||
* - site_slogan: Slogan for site as defined in Site information settings.
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
{% block content %}
|
||||
{% if site_logo %}
|
||||
<a href="{{ url('<front>') }}" title="{{ 'Home'|t }}" rel="home" class="site-logo">
|
||||
<img src="{{ site_logo }}" alt="{{ 'Home'|t }}" />
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if site_name %}
|
||||
<div class="site-name">
|
||||
<a href="{{ url('<front>') }}" title="{{ 'Home'|t }}" rel="home">{{ site_name|e }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if site_slogan %}
|
||||
<div class="site-slogan">{{ site_slogan }}</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -120,6 +120,16 @@ function bartik_preprocess_node(&$variables) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_HOOK() for block templates.
|
||||
*/
|
||||
function bartik_preprocess_block(&$variables) {
|
||||
// Add a clearfix class to system branding blocks.
|
||||
if ($variables['plugin_id'] == 'system_branding_block') {
|
||||
$variables['attributes']['class'][] = 'clearfix';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements theme_menu_tree().
|
||||
*/
|
||||
|
|
|
@ -54,7 +54,9 @@ a:active,
|
|||
.region-header a,
|
||||
.region-header li a.active,
|
||||
#name-and-slogan,
|
||||
.site-branding-block,
|
||||
#name-and-slogan a,
|
||||
.site-branding-block a,
|
||||
#secondary-menu-links li a {
|
||||
color: #fffeff;
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ pre {
|
|||
|
||||
body,
|
||||
#site-slogan,
|
||||
.site-slogan,
|
||||
#page .ui-widget,
|
||||
.comment-form label,
|
||||
.node-form label,
|
||||
|
@ -342,35 +343,43 @@ ul.tips {
|
|||
.skip-link:focus {
|
||||
outline: 0;
|
||||
}
|
||||
#logo {
|
||||
#logo,
|
||||
.site-logo {
|
||||
float: left; /* LTR */
|
||||
padding-left: 5px; /* LTR */
|
||||
}
|
||||
[dir="rtl"] #logo {
|
||||
[dir="rtl"] #logo,
|
||||
[dir="rtl"] .site-logo {
|
||||
padding: 15px 10px 15px 15px;
|
||||
}
|
||||
|
||||
#name-and-slogan {
|
||||
#name-and-slogan,
|
||||
.site-branding-text {
|
||||
float: left; /* LTR */
|
||||
margin: 0;
|
||||
padding: 5px 10px 8px;
|
||||
}
|
||||
[dir="rtl"] #name-and-slogan {
|
||||
[dir="rtl"] #name-and-slogan,
|
||||
[dir="rtl"] .site-branding-text {
|
||||
margin: 0 15px 30px 0;
|
||||
}
|
||||
|
||||
#site-name {
|
||||
#site-name,
|
||||
.site-name {
|
||||
font-size: 1.6em;
|
||||
color: #686868;
|
||||
line-height: 1;
|
||||
}
|
||||
h1#site-name {
|
||||
h1#site-name,
|
||||
h1.site-name {
|
||||
margin: 0;
|
||||
}
|
||||
#site-name a {
|
||||
#site-name a,
|
||||
.site-name a {
|
||||
font-weight: normal;
|
||||
}
|
||||
#site-slogan {
|
||||
#site-slogan,
|
||||
.site-slogan {
|
||||
font-size: 0.929em;
|
||||
margin-top: 7px;
|
||||
word-spacing: 0.1em;
|
||||
|
@ -521,7 +530,9 @@ h1#site-name {
|
|||
}
|
||||
|
||||
[dir="rtl"] #logo,
|
||||
[dir="rtl"] .site-logo,
|
||||
[dir="rtl"] #name-and-slogan,
|
||||
[dir="rtl"] .site-branding-text,
|
||||
[dir="rtl"] .region-header .block,
|
||||
[dir="rtl"] .region-header #block-user-login .form-item,
|
||||
[dir="rtl"] .region-header #block-user-login .item-list li {
|
||||
|
@ -1757,13 +1768,16 @@ div.admin-panel .description {
|
|||
.region-header {
|
||||
margin: .5em 5px .75em;
|
||||
}
|
||||
#logo {
|
||||
#logo,
|
||||
.site-logo {
|
||||
padding: 5px 0 0 5px; /* LTR */
|
||||
}
|
||||
[dir="rtl"] #logo {
|
||||
[dir="rtl"] #logo,
|
||||
[dir="rtl"] .site-logo {
|
||||
padding: 5px 5px 0 0;
|
||||
}
|
||||
#name-and-slogan {
|
||||
#name-and-slogan,
|
||||
.site-branding-text {
|
||||
padding: 10px 10px 8px;
|
||||
}
|
||||
#main-menu-links {
|
||||
|
@ -1804,20 +1818,25 @@ div.admin-panel .description {
|
|||
.region-header {
|
||||
margin: 1em 5px 1.5em;
|
||||
}
|
||||
#logo {
|
||||
#logo,
|
||||
.site-logo {
|
||||
padding: 15px 15px 15px 10px; /* LTR */
|
||||
}
|
||||
[dir="rtl"] #logo {
|
||||
[dir="rtl"] #logo,
|
||||
[dir="rtl"] .site-logo {
|
||||
padding: 15px 10px 15px 15px;
|
||||
}
|
||||
#name-and-slogan {
|
||||
#name-and-slogan,
|
||||
.site-branding-text {
|
||||
padding: 26px 0 0;
|
||||
margin: 0 0 30px 15px; /* LTR */
|
||||
}
|
||||
[dir="rtl"] #name-and-slogan {
|
||||
[dir="rtl"] #name-and-slogan,
|
||||
[dir="rtl"] .site-branding-text {
|
||||
margin: 0 15px 30px 0;
|
||||
}
|
||||
#site-name {
|
||||
#site-name,
|
||||
.site-name {
|
||||
font-size: 1.821em;
|
||||
}
|
||||
#main-menu-links {
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
{% extends "@block/block.html.twig" %}
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Bartik's theme implementation for a branding block.
|
||||
*
|
||||
* Each branding element variable (logo, name, slogan) is only available if
|
||||
* enabled in the block configuration.
|
||||
*
|
||||
* Available variables:
|
||||
* - site_logo: Logo for site as defined in Appearance or theme settings.
|
||||
* - site_name: Name for site as defined in Site information settings.
|
||||
* - site_slogan: Slogan for site as defined in Site information settings.
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
{% block content %}
|
||||
{% if site_logo %}
|
||||
<a href="{{ url('<front>') }}" title="{{ 'Home'|t }}" rel="home" class="site-logo">
|
||||
<img src="{{ site_logo }}" alt="{{ 'Home'|t }}" />
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if site_name or site_slogan %}
|
||||
<div class="site-branding-text">
|
||||
{% if site_name %}
|
||||
<strong class="site-name">
|
||||
<a href="{{ url('<front>') }}" title="{{ 'Home'|t }}" rel="home">{{ site_name|e }}</a>
|
||||
</strong>
|
||||
{% endif %}
|
||||
{% if site_slogan %}
|
||||
<div class="site-slogan">{{ site_slogan }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue