Commit 698e3a8c authored by catch's avatar catch
Browse files

Issue #3253568 by Spokje, paul121, rviner, longwave, alexpott, quietone:...

Issue #3253568 by Spokje, paul121, rviner, longwave, alexpott, quietone: Error: Cannot use object of type Drupal\Core\Render\Markup as array in Drupal\Core\Render\Renderer->doRender() (line 218. When checkbox 'Use field template' is checked

(cherry picked from commit bd9fa275)
parent 9ab4ed2b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -860,7 +860,7 @@ public function getItems(ResultRow $values) {
    }

    if ($this->options['field_api_classes']) {
      return [['rendered' => $this->renderer->render($build_list)]];
      return [['rendered' => $build_list]];
    }

    // Render using the formatted data itself.
+21 −0
Original line number Diff line number Diff line
@@ -339,6 +339,27 @@ public function testFieldAliasRender() {
    }
  }

  /**
   * Tests the result of a view field with field_api_classes enabled.
   */
  public function testFieldApiClassesRender() {
    /** @var \Drupal\Core\Render\RendererInterface $renderer */
    $renderer = $this->container->get('renderer');
    $executable = Views::getView('test_field_field_test');
    $executable->initHandlers();

    // Enable field_api_classes for the id field.
    $id_field = $executable->field['id'];
    $id_field->options['field_api_classes'] = TRUE;

    // Test that the ID field renders with multiple divs from field template.
    $output = $executable->preview();
    $output = $renderer->renderRoot($output);
    $this->setRawContent($output);
    $field_values = $this->xpath('//div[contains(@class, "views-field-id")]/span[contains(@class, :class)]/div', [':class' => 'field-content']);
    $this->assertNotEmpty($field_values);
  }

  /**
   * Tests the result of a view with complex field configuration.
   *