-
Notifications
You must be signed in to change notification settings - Fork 2
Extensions
William Espindola edited this page Sep 10, 2015
·
4 revisions
use WilliamEspindola\Field\Repository\FieldRepository;
use WilliamEspindola\Field\Repository\OptionRepository;
$twig = new Twig_Environment($loader);
$fieldRepository = new FieldRepository($storage); // see about repositories on https://github.com/williamespindola/field/wiki/Repository
$optionRepository = new OptionRepository($storage); // see about repositories on https://github.com/williamespindola/field/wiki/Repository
$fieldTwigExtension = new FieldTwigExtension($fieldRepository, $optionRepository)
$twig->addExtension($fieldTwigExtension);
@param string Name of Field
@return string Value of field
{{ fieldValue('field-name') }}
@param string $name Name of field
@return array Field [Object](https://github.com/williamespindola/field/wiki/Extensions#field-object)
{{ field('field-name') }}
@param $name Name of Field
@return array Field [Object](https://github.com/williamespindola/field/wiki/Extensions#field-object) with your options
{{ optionsOfField('field-name') }}
/**
* @var integer
*/
public $id;
/**
* @var string
*/
private $name;
/**
* @var string
*/
private $type;
/**
* @var text
*/
private $value;
/**
* @var string
*/
private $label;