Ibexa DXP Discussions

Community discussion forum for developers working with Ibexa DXP

[Netgen EzFormsBundle] I can't get it to work

I want to use this bundle to allow my Internet users to create “contact” type objects under a “form” type page.

class FormController extends Controller
                    controller: "MyBundle:Form:full"
                    template: "MyBundle:full:form.html.twig"
                        Identifier\ContentType: [form]
    public function fullAction(Request $request, ContentView $view)
        $repository = $this->getRepository();
        $contentService = $repository->getContentService();

        $contentType = $this->getRepository()->getContentTypeService()->loadContentTypeByIdentifier( "contact" );
        $contentCreateStruct = $contentService->newContentCreateStruct( $contentType, 'fre-FR' );

        $data = new DataWrapper( /*ContentCreateStruct*/$contentCreateStruct, /*ContentType*/$contentType /*No target for create content*/);

        /** @var FormBuilder $formBuilder */
        $formBuilder = $this->container
            ->get( "form.factory" )
            ->createBuilder( "ezforms_create_content", $data );

Could not load type “ezforms_create_content”: class does not exist.

Simply replace classe name by Class::class

    /** @var FormBuilder $formBuilder */
    $formBuilder = $this->container
        ->get( "form.factory" )
        ->createBuilder( CreateContentType::class, $data );

    // Adding controls as EzFormsBundle does not do that by itself
    $formBuilder->add( "save", SubmitType::class, array( "label" => "Envoyer" ) );

ping @MarioBlazek :slight_smile: