You are here

function _twig_extract_entity_fields in Twig Input Filter 7

Extracts entity fields from a given entity renderable.

2 calls to _twig_extract_entity_fields()
twig_process_node in ./twig.module
Processes variables for node.tpl.php.
_twig_extract_field_items in ./twig.utils.inc
Extracts field items from a given field renderable.

File

./twig.utils.inc, line 47
Helper functions for the Twig module.

Code

function _twig_extract_entity_fields($build) {
  $fields = array();
  if (is_array($build)) {
    foreach ($build as $key => $value) {
      if ($key[0] !== '#') {
        $key = str_replace(array(
          'twig_',
          'bd_',
          'field_',
        ), '', $key);
        $items = _twig_extract_field_items($value);
        $fields[$key] = $items;
      }
    }
  }
  return $fields;
}