本文整理汇总了PHP中Symfony\Component\Form\AbstractType::finishView方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractType::finishView方法的具体用法?PHP AbstractType::finishView怎么用?PHP AbstractType::finishView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\AbstractType
的用法示例。
在下文中一共展示了AbstractType::finishView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: finishView
/**
* {@inheritdoc}
*/
public function finishView(FormView $view, FormInterface $form, array $options)
{
parent::finishView($view, $form, $options);
// convert the route into an URL
$view->vars['limit'] = $options['limit'];
$view->vars['url'] = $options['url'];
}
示例2: finishView
public function finishView(FormView $view, FormInterface $form, array $options)
{
parent::finishView($view, $form, $options);
$this->filterManager->setDataClass($options['class']);
$this->filterValueKinds = $this->filterManager->getFilterValuesAssocList();
foreach ($view->children as $child) {
isset($this->filterValueKinds[$child->vars['label']]) ? $label = $this->filterValueKinds[$child->vars['label']] : ($label = 'unkhown');
$child->vars['filter_kind'] = $label;
}
}
示例3: finishView
public function finishView(FormView $view, FormInterface $form, array $options)
{
/** @var FormView[] $fields */
if ($view->offsetExists('submit_group')) {
$fields = array($view->offsetGet('submit_group'));
$view->offsetUnset('submit_group');
$view->children = $view->children + $fields;
}
parent::finishView($view, $form, $options);
}
示例4: finishView
public function finishView(FormView $view, FormInterface $form, array $options)
{
parent::finishView($view, $form, $options);
$view->vars['remote_path'] = $this->router->generate($options['remote_route'], $options['remote_params']);
$varNames = array('minimum_input_length', 'placeholder');
foreach ($varNames as $varName) {
$view->vars[$varName] = $options[$varName];
}
$view->vars['full_name'] .= '[]';
}
示例5: finishView
/**
* @param FormView $view
* @param FormInterface $form
* @param array $options
*/
public function finishView(FormView $view, FormInterface $form, array $options)
{
parent::finishView($view, $form, $options);
foreach ($view->vars['choices'] as $choice) {
$additionalAttributes = array();
foreach ($options['option_attributes'] as $attributeName => $choicePath) {
$additionalAttributes[$attributeName] = $this->propertyAccessor->getValue($choice->data, $choicePath);
}
$choice->attr = array_replace(isset($choice->attr) ? $choice->attr : array(), $additionalAttributes);
}
}
示例6: finishView
public function finishView(FormView $view, FormInterface $form, array $options)
{
parent::finishView($view, $form, $options);
$themeOptions = array('contentTitle' => true, 'contentText' => true, 'titlePlaceHolder' => 'optional_title', 'textPlaceHolder' => 'create_content');
foreach ($themeOptions as $option => $defaultValue) {
if (isset($options['theme_options']) && isset($options['theme_options'][$option])) {
$view->vars[$option] = $options['theme_options'][$option];
} else {
$view->vars[$option] = $defaultValue;
}
}
}
示例7: finishView
/**
* {@inheritdoc}
*/
public function finishView(FormView $view, FormInterface $form, array $options)
{
//$view->vars['widget'] = $options['widget'];
$view->vars['datepicker_format'] = $options['datepicker_format'];
$view->vars['datepicker_start_date'] = $options['datepicker_start_date'];
$view->vars['datepicker_end_date'] = $options['datepicker_end_date'];
$view->vars['datepicker_autoclose'] = $options['datepicker_autoclose'];
$view->vars['datepicker_show_on'] = $options['datepicker_show_on'];
$view->vars['datepicker_start_view'] = $options['datepicker_start_view'];
$view->vars['datepicker_week_start'] = $options['datepicker_week_start'];
$view->vars['datepicker_type'] = $options['datepicker_type'];
parent::finishView($view, $form, $options);
}
示例8: finishView
public function finishView(FormView $view, FormInterface $form, array $options)
{
parent::finishView($view, $form, $options);
// make variables available to the view
$view->vars['remote_path'] = $options['remote_path'] ?: $this->router->generate($options['remote_route'], array_merge($options['remote_params'], ['page_limit' => $options['page_limit']]));
$varNames = array('multiple', 'minimum_input_length', 'placeholder', 'language');
foreach ($varNames as $varName) {
$view->vars[$varName] = $options[$varName];
}
if ($options['multiple']) {
$view->vars['full_name'] .= '[]';
}
}
示例9: finishView
/**
* {@inheritdoc}
*/
public function finishView(FormView $view, FormInterface $form, array $options)
{
parent::finishView($view, $form, $options);
$view->vars['widget'] = $options['widget'];
$view->vars['format'] = $options['format'];
$view->vars['timepicker_show_meridian'] = $options['timepicker_show_meridian'];
$view->vars['timepicker_template'] = $options['timepicker_template'];
$view->vars['timepicker_minute_step'] = $options['timepicker_minute_step'];
$view->vars['timepicker_second_step'] = $options['timepicker_second_step'];
$view->vars['timepicker_default_time'] = $options['timepicker_default_time'];
$view->vars['timepicker_disable_focus'] = $options['timepicker_disable_focus'];
$view->vars['timepicker_modal_backdrop'] = $options['timepicker_modal_backdrop'];
$view->vars['timepicker_show_seconds'] = $options['timepicker_show_seconds'];
$view->vars['timepicker_type'] = $options['timepicker_type'];
}
示例10: finishView
/**
* @param FormView $view
* @param FormInterface $form
* @param array $options
*/
public function finishView(FormView $view, FormInterface $form, array $options)
{
parent::finishView($view, $form, $options);
foreach ($view->vars['choices'] as $choice) {
$additionalAttributes = array();
foreach ($options['option_attributes'] as $attributeName => $choicePath) {
/* generate a thumbnail image if the option_attribute is an image-path */
if ($attributeName == 'data-img-src') {
$webPath = $this->propertyAccessor->getValue($choice->data, $choicePath);
$runtimeConfig = array("relative_resize" => array("widen" => 109));
$value = $this->cacheManager->getBrowserPath($webPath, 'filter_widen', $runtimeConfig);
} else {
$value = $this->propertyAccessor->getValue($choice->data, $choicePath);
}
$additionalAttributes[$attributeName] = $value;
}
$choice->attr = array_replace(isset($choice->attr) ? $choice->attr : array(), $additionalAttributes);
}
}
示例11: finishView
/**
* {@inheritdoc}
*
* @param FormView $view
* @param FormInterface $form
* @param array $options
*/
public function finishView(FormView $view, FormInterface $form, array $options)
{
parent::finishView($view, $form, $options);
$view->vars['authorizationChecker'] = $this->controller->getService('securityAuthorizationChecker');
/*
* Inject data as plain documents entities
*/
$view->vars['nodeTree'] = new NodeTreeWidget($this->controller->getRequest(), $this->controller, $this->nodeSource->getNode(), $this->nodeSource->getTranslation());
$view->vars['nodeStatuses'] = ['draft' => Node::DRAFT, 'pending' => Node::PENDING, 'published' => Node::PUBLISHED, 'archived' => Node::ARCHIVED, 'deleted' => Node::DELETED];
/*
* Linked types to create quick add buttons
*/
$defaultValues = explode(',', $this->field->getDefaultValues());
foreach ($defaultValues as $key => $value) {
$defaultValues[$key] = trim($value);
}
$nodeTypes = $this->controller->getService('em')->getRepository('RZ\\Roadiz\\Core\\Entities\\NodeType')->findBy(['name' => $defaultValues]);
$view->vars['linkedTypes'] = $nodeTypes;
}
示例12: finishView
/**
* {@inheritdoc}
*/
public function finishView(FormView $view, FormInterface $form, array $options)
{
$view->vars['mode'] = $options['mode'];
$view->vars['indent_unit'] = $options['indent_unit'];
$view->vars['smart_indent'] = $options['smart_indent'];
$view->vars['tab_size'] = $options['tab_size'];
$view->vars['indent_with_tabs'] = $options['indent_with_tabs'];
$view->vars['auto_clear_empty_lines'] = $options['auto_clear_empty_lines'];
$view->vars['line_wrapping'] = $options['line_wrapping'];
$view->vars['first_line_number'] = $options['first_line_number'];
$view->vars['line_numbers'] = $options['line_numbers'];
$view->vars['line_number_formatter'] = $options['line_number_formatter'];
$view->vars['gutter'] = $options['gutter'];
$view->vars['fixed_gutter'] = $options['fixed_gutter'];
$view->vars['fixed_gutter'] = $options['fixed_gutter'];
$view->vars['read_only'] = $options['read_only'];
$view->vars['match_brackets'] = $options['match_brackets'];
$view->vars['autofocus'] = $options['autofocus'];
$view->vars['theme'] = $options['theme'];
parent::finishView($view, $form, $options);
}
示例13: finishView
public function finishView(FormView $view, FormInterface $form, array $options)
{
parent::finishView($view, $form, $options);
//$cfg = $form->getConfig();
// assign some variables to the view template
$vars = array('render', 'route', 'route_params', 'property', 'minLength', 'items', 'delay', 'spinner', 'multiple', 'allow_add', 'allow_remove', 'empty_value', 'resetOnSelect', 'callback');
foreach ($vars as $var) {
$view->vars[$var] = $options[$var];
}
// convert the route into an URL
if (!empty($options['route'])) {
try {
$params = $options['route_params'] ?: array();
if (!is_array($params) and !$params instanceof \Traversable) {
throw new UnexpectedTypeException($params, "array or \\Traversable");
}
$view->vars['url'] = $this->router->generate($options['route'], $params);
} catch (\InvalidArgumentException $e) {
throw new RuntimeException("Route \"{$options['route']}\" configured on " . get_class() . " does not exist.");
}
}
}
示例14: finishView
public function finishView(FormView $view, FormInterface $form, array $options)
{
parent::finishView($view, $form, $options);
// make variables available to the view
$view->vars['remote_path'] = $options['remote_path'] ?: $this->router->generate($options['remote_route'], array_merge($options['remote_params'], ['page_limit' => $options['page_limit']]));
// merge variable names which are only set per instance with those from yml config
$varNames = array_merge(array('multiple', 'placeholder', 'primary_key', 'autostart'), array_keys($this->config));
foreach ($varNames as $varName) {
$view->vars[$varName] = $options[$varName];
}
//tags options
$varNames = array_keys($this->config['allow_add']);
foreach ($varNames as $varName) {
if (isset($options['allow_add'][$varName])) {
$view->vars['allow_add'][$varName] = $options['allow_add'][$varName];
} else {
$view->vars['allow_add'][$varName] = $this->config['allow_add'][$varName];
}
}
if ($options['multiple']) {
$view->vars['full_name'] .= '[]';
}
}
示例15: finishView
/**
* @param FormView $view
* @param FormInterface $form
* @param array $options
*/
public function finishView(FormView $view, FormInterface $form, array $options)
{
parent::finishView($view, $form, $options);
// Set choice_attributes on choices
foreach ($view->vars['choices'] as $choice) {
$additionalAttributes = array();
foreach ($options['choice_attributes'] as $attributeName => $choicePath) {
$additionalAttributes[$attributeName] = $this->propertyAccessor->getValue($choice->data, $choicePath);
}
$choice->attr = array_replace(isset($choice->attr) ? $choice->attr : array(), $additionalAttributes);
}
// Set choice_attributes on children (for example options, radio, etc)
if ($options['expanded']) {
foreach ($view as $i => $childView) {
$additionalAttributes = array();
foreach ($options['choice_attributes'] as $attributeName => $choicePath) {
$entity = $view->vars['choices'][$i]->data;
$additionalAttributes[$attributeName] = $this->propertyAccessor->getValue($entity, $choicePath);
}
$childView->vars['attr'] = array_replace(isset($childView->attr) ? $childView->attr : array(), $additionalAttributes);
}
}
}