Jump to content

TranslatableType How to add a language value to a field


compsoul.dev

Recommended Posts

Using FormBuilderModifier, I created a form for myself.  Everything works, it saves itself in the database the content from the form when saving. But how do I get the data from the database and save it in the form fields so that the user knows what he is editing?

The function that creates the form:
 

One of the fields on the form:
 

I would like to change the date option to the one I retrieve from the database depending on the language, I have looked everywhere but it is nowhere to be found.

Link to comment
Share on other sites


    public function hookActionCMSPageFormBuilderModifier($params)
    {
        $formBuilder = $params['form_builder'];
        $fields = $this->field_definitions;

        foreach ($fields as $key => $value) {
            if (isset($fields[$key]['type'])) {
                $formBuilder->add($key, $fields[$key]['type'], $fields[$key]['options']);
            }
        }
    }

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...