Commit 2cc3c863 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2599454 by rakesh.gectcr, metzlerd, snehi, jhodgdon: Document Missing HTML Render Elements

(cherry picked from commit 0eceb0ce)
parent df03a9d6
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -16,6 +16,24 @@
/**
 * Provides a render element for any HTML tag, with properties and value.
 *
 * Properties:
 * - #tag: The tag name to output.
 * - #attributes: (array, optional) HTML attributes to apply to the tag. The
 *   attributes are escaped, see \Drupal\Core\Template\Attribute.
 * - #value: (string, optional) A string containing the textual contents of
 *   the tag.
 * - #noscript: (bool, optional) When set to TRUE, the markup
 *   (including any prefix or suffix) will be wrapped in a <noscript> element.
 *
 * Usage example:
 * @code
 * $build['hello'] = [
 *   '#type' => 'html_tag'
 *   '#tag' => 'p',
 *   '#value' => $this->t('Hello World'),
 * ];
 * @endcode
 *
 * @RenderElement("html_tag")
 */
class HtmlTag extends RenderElement {
+16 −0
Original line number Diff line number Diff line
@@ -10,6 +10,22 @@
/**
 * Provides a render element where the user supplies an in-line Twig template.
 *
 * Properties:
 * - #template: The inline Twig template used to render the element.
 * - #context: (array) The variables to substitute into the Twig template.
 *   Each variable may be a string or a render array.
 *
 * Usage example:
 * @code
 * $build['hello']  = [
 *   '#type' => 'inline_template',
 *   '#template' => "{% trans %} Hello {% endtrans %} <strong>{{name}}</strong>",
 *   '#context' => [
 *     'name' => $name,
 *   ]
 * ];
 * @endcode
 *
 * @RenderElement("inline_template")
 */
class InlineTemplate extends RenderElement {
+2 −1
Original line number Diff line number Diff line
@@ -11,7 +11,8 @@
 * Provides a render element for displaying the label for a form element.
 *
 * Labels are generated automatically from element properties during processing
 * of most form elements.
 * of most form elements. This element is used internally by the form system
 * to render labels for form elements.
 *
 * @RenderElement("label")
 */
+14 −0
Original line number Diff line number Diff line
@@ -15,6 +15,20 @@
/**
 * Provides a link render element.
 *
 * Properties:
 * - #title: The link text.
 * - #url: \Drupal\Url object containing URL information pointing to a internal
 *   or external link . See \Drupal\Core\Utility\LinkGeneratorInterface.
 *
 * Usage example:
 * @code
 * $build['examples_link'] = [
 *   '#title' => $this->t('Examples'),
 *   '#type' => 'link',
 *   '#url' => Url::fromRoute('examples.description')
 * ];
 * @endcode
 *
 * @RenderElement("link")
 */
class Link extends RenderElement {
+13 −0
Original line number Diff line number Diff line
@@ -10,6 +10,19 @@
/**
 * Provides a link render element for a "more" link, like those used in blocks.
 *
 * Properties:
 * - #title: The text of the link to generate (defaults to 'More').
 *
 * See \Drupal\Core\Render\Element\Link for additional properties.
 *
 * Usage Example:
 * @code
 * $build['more'] = [
 *   '#type' => 'more_link',
 *   '#url' => Url::fromRoute('examples.more_examples')
 * ]
 * @endcode
 *
 * @RenderElement("more_link")
 */
class MoreLink extends Link {
Loading