HtmlFragmentRendererInterface.php 1.13 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

/**
 * @file
 * Contains \Drupal\Core\Page\HtmlFragmentRendererInterface
 */

namespace Drupal\Core\Page;

/**
 * Interface for HTML Fragment Renderers.
 *
 * An HTML Fragment Renderer is responsible for translating an HtmlFragment
 * object into an HtmlPage object.
 */
interface HtmlFragmentRendererInterface {

  /**
   * Renders an HtmlFragment into an HtmlPage.
   *
   * An HtmlFragment represents only a portion of an HTML page, along with
   * some attached information (assets, metatags, etc.) An HtmlPage represents
   * an entire page. This method will create an HtmlPage containing the
   * metadata from the fragment and using the body of the fragment as the main
   * content region of the page.
   *
   * @param \Drupal\Core\Page\HtmlFragment $fragment
   *   The HTML fragment object to convert up to a page.
   * @param int $status_code
   *   (optional) The status code of the page. May be any legal HTTP response
   *   code. Default is 200 OK.
   *
   * @return \Drupal\Core\Page\HtmlPage
   *   An HtmlPage object derived from the provided fragment.
   */
  public function render(HtmlFragment $fragment, $status_code = 200);

}