diff --git a/core/includes/theme.inc b/core/includes/theme.inc index d044f06882fcca31c8cd0e100d75b28962469144..5ea77ea0f9179c863cae3792fd5fdff0b12537b9 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2533,6 +2533,9 @@ function template_preprocess_html(&$variables) { $variables['head_title_array'] = $head_title; $variables['head_title'] = implode(' | ', $head_title); + // Mobile Metatags, used for Responsive Webdesign. Metatags are added in html.tpl.php + $variables['default_mobile_metatags'] = TRUE; + // Populate the page template suggestions. if ($suggestions = theme_get_suggestions(arg(), 'html')) { $variables['theme_hook_suggestions'] = $suggestions; diff --git a/core/modules/system/html.tpl.php b/core/modules/system/html.tpl.php index 960eefbdb63b6b1278799357c79ba4cdc4f4efba..d587dcc7e64e4acf76266eb151d85da732c0ca0a 100644 --- a/core/modules/system/html.tpl.php +++ b/core/modules/system/html.tpl.php @@ -22,6 +22,8 @@ * - slogan: The slogan of the site, if any, and if there is no title. * - $head: Markup for the HEAD section (including meta tags, keyword tags, and * so on). + * - $default_mobile_metatags: (boolean) If TRUE, default mobile metatags for + * Responsive Design will be included. * - $styles: Style tags necessary to import all CSS files for the page. * - $scripts: Script tags necessary to load the JavaScript files and settings * for the page. @@ -43,6 +45,13 @@ > + + + + + + + <?php print $head_title; ?> diff --git a/core/modules/system/system.test b/core/modules/system/system.test index 9287d16d8a0137ff73b294565836914b58401806..76abf1122396c64fce57691092fdecd1611424ec 100644 --- a/core/modules/system/system.test +++ b/core/modules/system/system.test @@ -880,6 +880,53 @@ class AdminMetaTagTestCase extends DrupalWebTestCase { } } +class DefaultMobileMetaTagsTestCase extends DrupalWebTestCase { + /** + * Implement getInfo(). + */ + public static function getInfo() { + return array( + 'name' => 'Default mobile meta tags', + 'description' => 'Confirm that the default mobile meta tags appear as expected.', + 'group' => 'System' + ); + } + + function setUp() { + parent::setUp(); + + // Create an administrative user. + $this->default_metatags = array( + 'MobileOptimized' => '', + 'apple-mobile-web-app-capable' => '', + 'HandheldFriendly' => '', + 'viewport' => '', + 'cleartype' => '' + ); + } + + /** + * Verify that the default mobile meta tags are added. + */ + public function testDefaultMetaTagsExist() { + $this->drupalGet(''); + foreach ($this->default_metatags as $name => $metatag) { + $this->assertRaw($metatag, t('Default Mobile meta tag "'.$name.'" generated correctly.'), t('System')); + } + } + + /** + * Verify that the default mobile meta tags can be removed by a contrib module/theme + */ + public function testRemovingDefaultMetaTags() { + module_enable(array('system_module_test')); + $this->drupalGet(''); + foreach ($this->default_metatags as $name => $metatag) { + $this->assertNoRaw($metatag, t('Default Mobile meta tag "'.$name.'" does not exist.'), t('System')); + } + } +} + /** * Tests custom access denied functionality. */ diff --git a/core/modules/system/tests/system_module_test.info b/core/modules/system/tests/system_module_test.info new file mode 100644 index 0000000000000000000000000000000000000000..42a35f62379425213e96a377bfd5eaa454548eca --- /dev/null +++ b/core/modules/system/tests/system_module_test.info @@ -0,0 +1,7 @@ +name = System test +description = Provides hook implementations for testing Sytem module functionality. +package = Core +version = VERSION +core = 8.x +files[] = system_module_test.module +hidden = TRUE diff --git a/core/modules/system/tests/system_module_test.module b/core/modules/system/tests/system_module_test.module new file mode 100644 index 0000000000000000000000000000000000000000..00808d2fb668e0ef0b402354754bb3e334d4c8dd --- /dev/null +++ b/core/modules/system/tests/system_module_test.module @@ -0,0 +1,10 @@ +