本文整理汇总了PHP中Symfony\Component\Form\FormBuilderInterface::appendClientTransformer方法的典型用法代码示例。如果您正苦于以下问题:PHP FormBuilderInterface::appendClientTransformer方法的具体用法?PHP FormBuilderInterface::appendClientTransformer怎么用?PHP FormBuilderInterface::appendClientTransformer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\FormBuilderInterface
的用法示例。
在下文中一共展示了FormBuilderInterface::appendClientTransformer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
if (!$options['choice_list']) {
$options['choice_list'] = new AjaxArrayChoiceList($options['choices'], $options['ajax']);
}
$builder->appendClientTransformer(new ChoiceToJsonTransformer($options['choice_list'], $options['widget'], $options['multiple'], $options['ajax'], $options['freeValues']))->setAttribute('choice_list', $options['choice_list'])->setAttribute('widget', $options['widget'])->setAttribute('route_name', $options['route_name'])->setAttribute('freeValues', $options['freeValues']);
}
示例2: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$delivery_addresses = array();
foreach ($this->user->getDeliveryAddresses() as $add) {
$delivery_addresses[$add->getId()] = $add->getFullAddress();
}
if (!empty($delivery_addresses)) {
$delivery_addresses['create_new'] = 'Создать новый';
$builder->add('exist', 'choice', array('choices' => $delivery_addresses, 'required' => false, 'expanded' => true));
}
$builder->add('new', 'delivery_address', array('required' => false));
$transformer = new OrderDeliveryAddressTransformer($this->om, $this->user);
$builder->appendClientTransformer($transformer);
}
示例3: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$phones = array();
foreach ($this->user->getPhoneNumbers() as $phone) {
$phones[$phone->getId()] = $phone->getPhoneNumber();
}
if (!empty($phones)) {
$phones['create_new'] = 'Создать новый';
$builder->add('exist', 'choice', array('choices' => $phones, 'required' => false, 'expanded' => true));
}
$builder->add('new', 'user_phone', array('required' => false));
$transformer = new OrderUserPhoneTransformer($this->om, $this->user);
$builder->appendClientTransformer($transformer);
}
示例4: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
if (true === empty($options['choice_list'])) {
$options['choice_list'] = new AjaxArrayChoiceList($options['choices'], $options['ajax']);
}
if (isset($options['tokenLimit']) && is_numeric($options['tokenLimit']) && $options['tokenLimit'] > 0) {
$options['multiple'] = 1 != $options['tokenLimit'];
}
if (!$options['multiple']) {
$options['tokenLimit'] = 1;
}
$builder->appendClientTransformer(new ChoiceToJsonTransformer($options['choice_list'], $options['widget'], $options['multiple'], $options['ajax']))->setAttribute('choice_list', $options['choice_list'])->setAttribute('widget', $options['widget'])->setAttribute('route_name', $options['route_name']);
foreach ($this->_availableTokeninputOptions as $option) {
if (isset($options[$option])) {
$builder->setAttribute($option, $options[$option]);
}
}
}
示例5: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
if (!isset($options['default'])) {
if ($options['required']) {
$dateRange = new DateRange($this->date_format);
$dateRange->createToDate(new \DateTime(), $this->default_interval);
} else {
$dateRange = null;
}
} else {
$dateRange = $options['default'];
}
$options['default'] = $dateRange;
$builder->appendClientTransformer(new DateRangeToValueTransformer($this->date_format));
$builder->setData($options['default']);
// Datepicker date format
$searches = array('d', 'm', 'y', 'Y');
$replaces = array('dd', 'mm', 'yy', 'yyyy');
$datepicker_format = str_replace($searches, $replaces, $this->date_format);
$builder->setAttribute('datepicker_date_format', $datepicker_format);
}
示例6: buildForm
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->appendClientTransformer(new EntityToStringTransformer());
}