Typed Data API

API for describing data based on a set of available data types. PHP has data types, such as int, string, float, array, etc., and it is an object-oriented language that lets you define classes and interfaces. However, in some cases, it is useful to be able to define an abstract type (as in an interface, free of implementation details), that still has properties (which an interface cannot) as well as meta-data. The Typed Data API provides this abstraction. Overview Each data type in the Typed Dat

twig_without

twig_without($element) Removes child elements from a copy of the original array. Creates a copy of the renderable array and removes child elements by key specified through filter's arguments. The copy can be printed without these elements. The original renderable array is still available and can be used to print child elements in their entirety in the twig template. Parameters array|object $element: The parent renderable array to exclude the child items. string[] $args, ...: The string keys of

twig_theme

twig_theme($existing, $type, $theme, $path) Implements hook_theme(). File core/themes/engines/twig/twig.engine, line 15 Handles integration of Twig templates with the Drupal theme system. Code function twig_theme($existing, $type, $theme, $path) { $templates = drupal_find_theme_functions($existing, array($theme)); $templates += drupal_find_theme_templates($existing, '.html.twig', $path); return $templates; }

twig_render_template

twig_render_template($template_file, array $variables) Implements hook_render_template(). Renders a Twig template. If the Twig debug setting is enabled, HTML comments including the theme hook and template file name suggestions will surround the template markup. Parameters string $template_file: The file name of the template to render. array $variables: A keyed array of variables that will appear in the output. Return value string|\Drupal\Component\Render\MarkupInterface The output generated b

twig_extension

twig_extension() Implements hook_extension(). File core/themes/engines/twig/twig.engine, line 24 Handles integration of Twig templates with the Drupal theme system. Code function twig_extension() { return '.html.twig'; }

TwigTransTokenParser::parse

public TwigTransTokenParser::parse(\Twig_Token $token) File core/lib/Drupal/Core/Template/TwigTransTokenParser.php, line 21 Class TwigTransTokenParser A class that defines the Twig 'trans' token parser for Drupal. Namespace Drupal\Core\Template Code public function parse(\Twig_Token $token) { $lineno = $token->getLine(); $stream = $this->parser->getStream(); $body = NULL; $options = NULL; $count = NULL; $plural = NULL; if (!$stream->test(\Twig_Token::BLOCK_EN

TwigTransTokenParser::getTag

public TwigTransTokenParser::getTag() File core/lib/Drupal/Core/Template/TwigTransTokenParser.php, line 72 Class TwigTransTokenParser A class that defines the Twig 'trans' token parser for Drupal. Namespace Drupal\Core\Template Code public function getTag() { return 'trans'; }

TwigTransTokenParser::decideForFork

public TwigTransTokenParser::decideForFork($token) Detect a 'plural' switch or the end of a 'trans' tag. File core/lib/Drupal/Core/Template/TwigTransTokenParser.php, line 58 Class TwigTransTokenParser A class that defines the Twig 'trans' token parser for Drupal. Namespace Drupal\Core\Template Code public function decideForFork($token) { return $token->test(array('plural', 'endtrans')); }

TwigTransTokenParser::decideForEnd

public TwigTransTokenParser::decideForEnd($token) Detect the end of a 'trans' tag. File core/lib/Drupal/Core/Template/TwigTransTokenParser.php, line 65 Class TwigTransTokenParser A class that defines the Twig 'trans' token parser for Drupal. Namespace Drupal\Core\Template Code public function decideForEnd($token) { return $token->test('endtrans'); }

TwigTransTokenParser::checkTransString

protected TwigTransTokenParser::checkTransString(\Twig_Node $body, $lineno) Ensure that any nodes that are parsed are only of allowed types. Parameters \Twig_Node $body: The expression to check. int $lineno: The source line. Throws \Twig_Error_Syntax File core/lib/Drupal/Core/Template/TwigTransTokenParser.php, line 86 Class TwigTransTokenParser A class that defines the Twig 'trans' token parser for Drupal. Namespace Drupal\Core\Template Code protected function checkTransString(\Twig_