Introduced the automatic form fields binding.
This commit is contained in:
@@ -28,13 +28,13 @@ trait SeoFieldsTrait
|
||||
*/
|
||||
protected function addSeoFields($exclude = array())
|
||||
{
|
||||
|
||||
if (! in_array('url', $exclude))
|
||||
$this->formBuilder
|
||||
->add('url', 'text', array(
|
||||
'label' => Translator::getInstance()->trans('Rewriten URL'),
|
||||
'label_attr' => array(
|
||||
'for' => 'rewriten_url_field'
|
||||
'for' => 'rewriten_url_field',
|
||||
'placeholder' => Translator::getInstance()->trans('Use the keyword phrase in your URL.')
|
||||
),
|
||||
'required' => false
|
||||
)
|
||||
@@ -45,7 +45,9 @@ trait SeoFieldsTrait
|
||||
->add('meta_title', 'text', array(
|
||||
'label' => Translator::getInstance()->trans('Page Title'),
|
||||
'label_attr' => array(
|
||||
'for' => 'meta_title'
|
||||
'for' => 'meta_title',
|
||||
'placeholder' => Translator::getInstance()->trans('Make sure that your title is clear, and contains many of the keywords within the page itself.'),
|
||||
'help' => Translator::getInstance()->trans('The HTML TITLE element is the most important element on your web page.')
|
||||
),
|
||||
'required' => false
|
||||
)
|
||||
@@ -53,10 +55,13 @@ trait SeoFieldsTrait
|
||||
|
||||
if (! in_array('meta_description', $exclude))
|
||||
$this->formBuilder
|
||||
->add('meta_description', 'text', array(
|
||||
->add('meta_description', 'textarea', array(
|
||||
'label' => Translator::getInstance()->trans('Meta Description'),
|
||||
'label_attr' => array(
|
||||
'for' => 'meta_description'
|
||||
'for' => 'meta_description',
|
||||
'rows' => 6,
|
||||
'placeholder' => Translator::getInstance()->trans('Make sure it uses keywords found within the page itself.'),
|
||||
'help' => Translator::getInstance()->trans('Keep the most important part of your description in the first 150-160 characters.')
|
||||
),
|
||||
'required' => false
|
||||
)
|
||||
@@ -64,10 +69,13 @@ trait SeoFieldsTrait
|
||||
|
||||
if (! in_array('meta_keywords', $exclude))
|
||||
$this->formBuilder
|
||||
->add('meta_keywords', 'text', array(
|
||||
->add('meta_keywords', 'textarea', array(
|
||||
'label' => Translator::getInstance()->trans('Meta Keywords'),
|
||||
'label_attr' => array(
|
||||
'for' => 'meta_keywords'
|
||||
'for' => 'meta_keywords',
|
||||
'rows' => 3,
|
||||
'placeholder' => Translator::getInstance()->trans('Don\'t repeat keywords over and over in a row. Rather, put in keyword phrases.'),
|
||||
'help' => Translator::getInstance()->trans('You don\'t need to use commas or other punctuations.')
|
||||
),
|
||||
'required' => false
|
||||
)
|
||||
|
||||
@@ -31,50 +31,78 @@ trait StandardDescriptionFieldsTrait
|
||||
protected function addStandardDescFields($exclude = array())
|
||||
{
|
||||
if (! in_array('locale', $exclude))
|
||||
$this->formBuilder
|
||||
->add("locale", "hidden", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->formBuilder->add(
|
||||
'locale',
|
||||
'hidden',
|
||||
[
|
||||
'constraints' => [ new NotBlank() ],
|
||||
'required' => true,
|
||||
]
|
||||
);
|
||||
|
||||
if (! in_array('title', $exclude))
|
||||
$this->formBuilder
|
||||
->add("title", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Title"),
|
||||
"label_attr" => array("for" => "title_field")
|
||||
)
|
||||
$this->formBuilder->add(
|
||||
'title',
|
||||
'text',
|
||||
[
|
||||
'constraints' => [ new NotBlank() ],
|
||||
'required' => true,
|
||||
'label' => Translator::getInstance()->trans('Title'),
|
||||
'label_attr' => [
|
||||
'for' => 'title_field',
|
||||
'placeholder' => Translator::getInstance()->trans('A descriptive title')
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
if (! in_array('chapo', $exclude))
|
||||
$this->formBuilder
|
||||
->add("chapo", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Summary"),
|
||||
"label_attr" => array(
|
||||
"for" => "summary_field"
|
||||
)
|
||||
));
|
||||
$this->formBuilder->add(
|
||||
'chapo',
|
||||
'textarea',
|
||||
[
|
||||
'constraints' => [ ],
|
||||
'required' => false,
|
||||
'label' => Translator::getInstance()->trans('Summary'),
|
||||
'label_attr' => [
|
||||
'for' => 'summary_field',
|
||||
'rows' => 3,
|
||||
'placeholder' => Translator::getInstance()->trans('Short description text'),
|
||||
'help' => Translator::getInstance()->trans('A short description, used when a summary or an introduction is required')
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
if (! in_array('description', $exclude))
|
||||
$this->formBuilder
|
||||
->add("description", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Detailed description"),
|
||||
"label_attr" => array(
|
||||
"for" => "detailed_description_field"
|
||||
)
|
||||
));
|
||||
$this->formBuilder->add(
|
||||
'description',
|
||||
'textarea',
|
||||
[
|
||||
'constraints' => [ ],
|
||||
'required' => false,
|
||||
'label' => Translator::getInstance()->trans('Detailed description'),
|
||||
'label_attr' => [
|
||||
'for' => 'detailed_description_field',
|
||||
'rows' => 10,
|
||||
'help' => Translator::getInstance()->trans('The detailed description.')
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
if (! in_array('postscriptum', $exclude))
|
||||
$this->formBuilder
|
||||
->add("postscriptum", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Conclusion"),
|
||||
"label_attr" => array(
|
||||
"for" => "conclusion_field"
|
||||
)
|
||||
));
|
||||
}
|
||||
$this->formBuilder->add(
|
||||
'postscriptum',
|
||||
'textarea',
|
||||
[
|
||||
'constraints' => [ ],
|
||||
'required' => false,
|
||||
'label' => Translator::getInstance()->trans('Conclusion'),
|
||||
'label_attr' => [
|
||||
'for' => 'conclusion_field',
|
||||
'rows' => 3,
|
||||
'placeholder' => Translator::getInstance()->trans('Short additional text'),
|
||||
'help' => Translator::getInstance()->trans('A short text, used when an additional or supplemental information is required.')
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user