Skip to content
Snippets Groups Projects
Commit 1514c820 authored by Alex Pott's avatar Alex Pott
Browse files

Revert "Issue #2489162 by googletorp, Haza, mdrummond, DuaelFr, swentel: Can...

Revert "Issue #2489162 by googletorp, Haza, mdrummond, DuaelFr, swentel: Can configure responsive image formatter to cause fatal error"

This reverts commit c8702065.
parent e3ea8e6b
No related branches found
No related tags found
No related merge requests found
...@@ -410,22 +410,6 @@ public function testBlockCacheTags() { ...@@ -410,22 +410,6 @@ public function testBlockCacheTags() {
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS'); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS');
} }
/**
* Tests that a link exists to block layout from the appearance form.
*/
public function testThemeAdminLink() {
$this->drupalPlaceBlock('help_block', ['region' => 'help']);
$theme_admin = $this->drupalCreateUser([
'administer blocks',
'administer themes',
'access administration pages',
]);
$this->drupalLogin($theme_admin);
$this->drupalGet('admin/appearance');
$this->assertText('You can place blocks for each theme on the block layout page');
$this->assertLinkByHref('admin/structure/block');
}
/** /**
* Tests that uninstalling a theme removes its block configuration. * Tests that uninstalling a theme removes its block configuration.
*/ */
......
...@@ -91,20 +91,10 @@ function responsive_image_theme() { ...@@ -91,20 +91,10 @@ function responsive_image_theme() {
* - url: An optional \Drupal\Core\Url object. * - url: An optional \Drupal\Core\Url object.
*/ */
function template_preprocess_responsive_image_formatter(&$variables) { function template_preprocess_responsive_image_formatter(&$variables) {
// Provide fallback to standard image if valid responsive image style is not $variables['responsive_image'] = array(
// provided in the responsive image formatter. '#type' => 'responsive_image',
$responsive_image_style = ResponsiveImageStyle::load($variables['responsive_image_style_id']); '#responsive_image_style_id' => $variables['responsive_image_style_id'],
if ($responsive_image_style) { );
$variables['responsive_image'] = array(
'#type' => 'responsive_image',
'#responsive_image_style_id' => $variables['responsive_image_style_id'],
);
}
else {
$variables['responsive_image'] = array(
'#theme' => 'image',
);
}
$item = $variables['item']; $item = $variables['item'];
$attributes = array(); $attributes = array();
// Do not output an empty 'title' attribute. // Do not output an empty 'title' attribute.
...@@ -157,13 +147,6 @@ function template_preprocess_responsive_image(&$variables) { ...@@ -157,13 +147,6 @@ function template_preprocess_responsive_image(&$variables) {
$image = \Drupal::service('image.factory')->get($variables['uri']); $image = \Drupal::service('image.factory')->get($variables['uri']);
$responsive_image_style = ResponsiveImageStyle::load($variables['responsive_image_style_id']); $responsive_image_style = ResponsiveImageStyle::load($variables['responsive_image_style_id']);
// If a responsive image style is not selected, log the error and stop
// execution.
if (!$responsive_image_style) {
$variables['img_element'] = [];
\Drupal::logger('responsive_image')->log(\Drupal\Core\Logger\RfcLogLevel::ERROR, 'Failed to load responsive image style: “@style“ while displaying responsive image.', ['@style' => $variables['responsive_image_style_id']]);
return;
}
// Retrieve all breakpoints and multipliers and reverse order of breakpoints. // Retrieve all breakpoints and multipliers and reverse order of breakpoints.
// By default, breakpoints are ordered from smallest weight to largest: // By default, breakpoints are ordered from smallest weight to largest:
// the smallest weight is expected to have the smallest breakpoint width, // the smallest weight is expected to have the smallest breakpoint width,
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
use Drupal\image\Entity\ImageStyle; use Drupal\image\Entity\ImageStyle;
use Drupal\node\Entity\Node; use Drupal\node\Entity\Node;
use Drupal\file\Entity\File; use Drupal\file\Entity\File;
use Drupal\responsive_image\Plugin\Field\FieldFormatter\ResponsiveImageFormatter;
use Drupal\user\RoleInterface; use Drupal\user\RoleInterface;
/** /**
...@@ -191,28 +190,6 @@ protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles = ...@@ -191,28 +190,6 @@ protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles =
); );
$default_output = str_replace("\n", NULL, $renderer->renderRoot($image)); $default_output = str_replace("\n", NULL, $renderer->renderRoot($image));
$this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.'); $this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.');
// Test field not being configured. This should not cause a fatal error.
$display_options = array(
'type' => 'responsive_image_test',
'settings' => ResponsiveImageFormatter::defaultSettings(),
);
$display = $this->container->get('entity.manager')
->getStorage('entity_view_display')
->load('node.article.default');
if (!$display) {
$values = [
'targetEntityType' => 'node',
'bundle' => 'article',
'mode' => 'default',
'status' => TRUE,
];
$display = $this->container->get('entity.manager')->getStorage('entity_view_display')->create($values);
}
$display->setComponent($field_name, $display_options)->save();
$this->drupalGet('node/' . $nid);
// Test theme function for responsive image, but using the test formatter. // Test theme function for responsive image, but using the test formatter.
$display_options = array( $display_options = array(
'type' => 'responsive_image_test', 'type' => 'responsive_image_test',
......
...@@ -105,9 +105,6 @@ function system_help($route_name, RouteMatchInterface $route_match) { ...@@ -105,9 +105,6 @@ function system_help($route_name, RouteMatchInterface $route_match) {
case 'system.themes_page': case 'system.themes_page':
$output = '<p>' . t('Set and configure the default theme for your website. Alternative <a href="!themes">themes</a> are available.', array('!themes' => 'https://www.drupal.org/project/themes')) . '</p>'; $output = '<p>' . t('Set and configure the default theme for your website. Alternative <a href="!themes">themes</a> are available.', array('!themes' => 'https://www.drupal.org/project/themes')) . '</p>';
if (\Drupal::moduleHandler()->moduleExists('block')) {
$output .= '<p>' . t('You can place blocks for each theme on the <a href="@blocks">block layout</a> page.', array('@blocks' => \Drupal::url('block.admin_display'))) . '</p>';
}
return $output; return $output;
case 'system.theme_settings_theme': case 'system.theme_settings_theme':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment