twig.field.inc in Twig Input Filter 7
Field module functionality for the Twig module.
File
twig.field.incView source
<?php
/**
* @file
* Field module functionality for the Twig module.
*/
/**
* Implements hook_field_extra_fields().
*/
function twig_field_extra_fields() {
$entity_info = entity_get_info();
$info = array();
foreach (array_keys($entity_info) as $entity_type) {
foreach (array_keys($entity_info[$entity_type]['bundles']) as $bundle) {
if (!field_info_instance($entity_type, 'twig_template', $bundle)) {
$info[$entity_type][$bundle]['form']['twig_template'] = array(
'label' => t('Template'),
'weight' => 0,
);
}
}
}
return $info;
}
/**
* Callback: returns allowed values for the Twig template field.
*/
function _twig_template_field_allowed_values() {
$templates = _twig_get_db_templates();
$keys = array_keys($templates);
sort($keys);
return array_combine($keys, $keys);
}
Functions
Name![]() |
Description |
---|---|
twig_field_extra_fields | Implements hook_field_extra_fields(). |
_twig_template_field_allowed_values | Callback: returns allowed values for the Twig template field. |