Shows the basket.

@param Form $form

@return Response
349032
public function indexAction($form = null)
    {
        $form = $form ?: $this->createForm(BasketType::class, $this->get('sonata.basket'), [
            'validation_groups' => ['elements'],
        ]);

        // always validate the basket
        if (!$form->isSubmitted()) {
            if ($violations = $this->get('validator')->validate($form)) {
                $violationMapper = new ViolationMapper();
                foreach ($violations as $violation) {
                    $violationMapper->mapViolation($violation, $form, true);
                }
            }
        }

        $this->get('session')->set('sonata_basket_delivery_redirect', 'sonata_basket_delivery_address');

        $this->get('sonata.seo.page')->setTitle($this->get('translator')->trans('basket_index_title', [], 'SonataBasketBundle'));

        return $this->render('SonataBasketBundle:Basket:index.html.twig', [
            'basket' => $this->get('sonata.basket'),
            'form' => $form->createView(),
        ]);
    }
619910
public function index(Request $request)
    {
        $this->getFormRequestInstance();

        $items = $this->getItemsCollection();

        if ($request->wantsJson()) {
            return $this->validSuccessJsonResponse('Success', $items);
        }

        $view = $this->getViewLocation(__FUNCTION__);
        $this->checkViewExists($view);

        return response()->view($view, compact('items'));
    }
267566
public function buildForm(array $form, FormStateInterface $form_state, $sid = NULL) {
    $this->sid = (int) $sid;
    if ($this->sid) {
      $slide = $this->databaseSliders->loadSlide($sid);
      $this->slide = $slide;      
    }
    return parent::buildForm($form, $form_state);
  }
87766
public static function populateForm(Form $form)
	{
		if (static::$builder === null)
		{
			static::setBuilder(new V1Model);

			static::$builder->setWrapperElement(null);
		}

		$elements = static::$builder->generate(get_called_class());

		return $form->setContents($elements);
	}
194833
public function render_assign_form(assign_form $form) {
        $o = '';
        if ($form->jsinitfunction) {
            $this->page->requires->js_init_call($form->jsinitfunction, array());
        }
        $o .= $this->output->box_start('boxaligncenter ' . $form->classname);
        $o .= $this->moodleform($form->form);
        $o .= $this->output->box_end();
        return $o;
    }
705423
public function getState(Form $form)
    {
        $state = [
            'id' => $form->FormName(),
            'fields' => [],
            'messages' => [],
            'notifyUnsavedChanges' => $form->getNotifyUnsavedChanges(),
        ];

        // flattened nested fields are returned, rather than only top level fields.
        $state['fields'] = array_merge(
            $this->getFieldStates($form->Fields()),
            $this->getFieldStates($form->Actions())
        );

        if ($message = $form->getSchemaMessage()) {
            $state['messages'][] = $message;
        }

        return $state;
    }
554561
public function visitForm(FormInterface $form)
    {
        $template = "form/{$form->getType()}.twig";

        return $this
            ->loadTemplate($template)
            ->render(
                [
                    "id" => $form->getId(),
                    "classes" => $form->getClasses(),
                    "data" => $form->getData(),
                    "method" => $form->getMethod(),
                    "target" => $form->getTarget(),
                    "writables" => $form->getWritableBearer()->getWritables(),
                    "actions" => $form->getActions(),
                    "errors" => $form->getErrors(),
                ]
            );
    }
98356
protected function prepareForm(Form $form)
	{
		$form->getElementPrototype()->class[] = 'form-horizontal';
		$translator = $form->getTranslator();
		foreach ($form->controls as $control) {
			/** @var BaseControl $control */
			if ($control instanceof HiddenField) {
				continue;
			} elseif ($control instanceof Button) {
				$control->controlPrototype->class[] = "btn-block btn-lg";
			} else {
				if ($control->getLabel()) {
					$control->setAttribute('placeholder', $control->caption);
					if (empty($control->controlPrototype->attrs['title'])) {
						$control->setAttribute('title', $translator ? $translator->translate($control->caption) : $control->caption);
					}
					$control->getLabelPrototype()->attrs["style"] = "display:none";
				}
			}
		}
		BootstrapHelper::ApplyBootstrapToControls($form);
	}
1035649
public function formSubmitSuccess()
    {
        return $this->form->js(null, $this->js()->trigger('reload'))
            ->univ()->closeDialog();
    }
221070
public function index(Request $request)
    {
        $this->getFormRequestInstance();

        $items = $this->getItemsCollection();

        return $this->validSuccessJsonResponse('Success', $items);
    }
1019977
public function setForm(Form $form)
	{
		$this->form = $form;
		$this->formControl = $form->getFormControl();

		return $this;
	}
1182405
public function render(Nette\Forms\Form $form, $mode = NULL)
	{
		$this->attachForm($form);

		$s = '';
		$s .= $this->renderBegin();
		$s .= $this->renderFeedback();
		$s .= $this->renderBody();
		$s .= $this->renderEnd();

		return $s;
	}
953397
public function setBasketDescriptionAction(Request $request, Basket $basket)
    {
        $basket->setDescription($request->get('description'));

        /** @var EntityManager $em */
        $em = $this->app['orm.em'];
        $em->persist($basket);
        $em->flush();

        return Result::create($request, ["basket" => $this->listBasket($basket)])->createResponse();
    }
1229673
public function renderFormBasketElementAction(FormView $formView, BasketElementInterface $basketElement, BasketInterface $basket)
    {
        $provider = $this->get('sonata.product.pool')->getProvider($basketElement->getProduct());

        return $this->render(sprintf('%s:form_basket_element.html.twig', $provider->getBaseControllerName()), [
            'formView' => $formView,
            'basketElement' => $basketElement,
            'basket' => $basket,
        ]);
    }
862889
protected function displayTokenForm(\Gems_Tracker_Form_AskTokenForm $form)
    {
        $form->setDescription(sprintf($this->_('Enter your %s token'), $this->project->name));
        $this->html->h3($form->getDescription());
        $this->html[] = $form;
        $this->html->pInfo($this->_('Tokens identify a survey that was assigned to you personally.') . ' ' . $this->_('Entering the token and pressing OK will open that survey.'));

        if ($this->currentUser->isActive()) {
            if ($this->currentUser->isLogoutOnSurvey()) {
                $this->html->pInfo($this->_('After answering the survey you will be logged off automatically.'));
            }
        }

        $this->html->pInfo(
            $this->_('A token consists of two groups of four letters and numbers, separated by an optional hyphen. Tokens are case insensitive.'), ' ',
            $this->_('The number zero and the letter O are treated as the same; the same goes for the number one and the letter L.')
            );
    }
178480
protected function questionFrom(FormInterface $form)
    {
        $question = $this->translator->trans(FormUtil::label($form), [], $this->translationDomainFrom($form));

        return $this->formattedQuestion($question, $this->defaultValueFrom($form));
    }
1221180
public function setActionUrl(Form $form)
    {

        $current = explode('/', rtrim($this->urlProvider->currentUrl(), '/'));

        $lastSegment = array_pop($current);

        if (in_array($lastSegment, ['create','edit'])) {

            $parentUrl = implode('/', $current);

            $form->setAction($parentUrl);

        } else {
            $form->setAction($this->urlProvider->currentUrl());
        }

        if ($lastSegment == 'create') {
            $form->setVerb('post');
            return;
        }

        if($lastSegment == 'edit') {
            $form->setVerb('put');
            return;
        }

    }