-
Notifications
You must be signed in to change notification settings - Fork 27
How to make certain form fields required? #276
Comments
i think the easiest would be to extend SeoContentAdminExtension and overwrite configureFormFields to register your own type that makes the fields required. making the form fields required is a general symfony form issue. looking at the code, i fear that for symfony 2.8, overwriting the cmf_seo.form.type.seo_metadata.class parameter no longer works as the form types are identified by class rather than alias. |
for symfony 2.8 and 3, you will need to define your own form type (which can be a class extending the built-in form type and overwrites those fields you want to make required). a note on usability though: making required seo fields you risk your authors will just copy the title into the fields - its better to have the title of the content required and fall back to that title if the seo data has no specific title. you can set up the seo bundle in a way that it falls back to other fields by adding more extractors and be careful with priority. |
Thank you, I figured how to make my own custom form. Would you like a On Thu, 31 Mar 2016, 9:43 a.m. David Buchmann, [email protected]
|
i would not put an example of how to extend a form - that is already documented in the symfony doc. what would be nice is a |
if you want to add that, please do a PR against the symfony-cmf-docs repository. |
Is possible to configure, extend or override the SeoMetadataType form to make the title filed required? Using #124 as reference I tried the following code locally but it had no effect
The text was updated successfully, but these errors were encountered: