Skip to content
Snippets Groups Projects
Commit e71f49f5 authored by Rajab Natshah's avatar Rajab Natshah
Browse files

Issue #3458130: Fix the Drupal Error: Call to undefined function render() and...

Issue #3458130: Fix the Drupal Error: Call to undefined function render() and use FileExists::Replace instead
parent 0e55d348
Branches 10.0.x
Tags 10.0.2
No related merge requests found
......@@ -6,7 +6,7 @@
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\File\FileExists;
/**
* Implements hook_page_attachments().
......@@ -26,7 +26,7 @@ function varbase_styleguide_styleguide_alter(&$items) {
// Change the styleguide-preview.jpg with flag-earth.jpg .
$image_data = file_get_contents(\Drupal::service('extension.path.resolver')->getPath('module', 'varbase_styleguide') . '/images/flag-earth.jpg');
$file = \Drupal::service('file.repository')->writeData($image_data, 'public://flag-earth.jpg', FileSystemInterface::EXISTS_REPLACE);
$file = \Drupal::service('file.repository')->writeData($image_data, 'public://flag-earth.jpg', FileExists::Replace);
if (isset($image_data) && isset($file)) {
foreach ($items as $item_index => $item) {
......@@ -1545,7 +1545,7 @@ function varbase_styleguide_styleguide_alter(&$items) {
$query->condition('status', 1);
$query->condition('type', $content_type->id());
$query->range(0, 1);
$entity_ids = $query->execute();
$entity_ids = $query->accessCheck(FALSE)->execute();
if (is_array($entity_ids) && count($entity_ids) > 0) {
......@@ -1570,7 +1570,7 @@ function varbase_styleguide_styleguide_alter(&$items) {
if ($view_mode != 'default' && $view_mode != 'full') {
$view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
$node_build = $view_builder->view($node, $view_mode);
$node_output_with_the_view_mode = render($node_build);
$node_output_with_the_view_mode = \Drupal::service('renderer')->render($node_build);
$final_view_mode_output = '';
......
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