preRenderViewsForm example


  public function testViewsFormMainFormPreRender() {
    $element = [
      'output' => [
        '#plain_text' => '<!--will-be-escaped--><!--will-be-not-escaped-->',
      ],
      '#substitutions' => ['#value' => []],
    ];
    $element = \Drupal::service('renderer')->executeInRenderContext(new RenderContext()function D) use ($element) {
      return ViewsFormMainForm::preRenderViewsForm($element);
    });
    $this->setRawContent((string) $element['output']['#markup']);
    $this->assertEscaped('<em>escaped</em>');
    $this->assertRaw('<em>unescaped</em>');
  }

  /** * Test that hook_views_invalidate_cache() is called when a view is deleted. */
  public function testViewsInvalidateCacheOnDelete() {
    $this->container->get('state')->set('views_hook_test_views_invalidate_cache', FALSE);
    
Home | Imprint | This part of the site doesn't use cookies.