mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Title for custom Field : class title or subtile
This commit is contained in:
parent
ac0e7a59b4
commit
ab51e3c7f4
@ -28,6 +28,10 @@ use Symfony\Component\HttpFoundation\RequestStack;
|
|||||||
|
|
||||||
class CustomFieldTitle implements CustomFieldInterface
|
class CustomFieldTitle implements CustomFieldInterface
|
||||||
{
|
{
|
||||||
|
const TYPE = 'type';
|
||||||
|
const TYPE_TITLE = 'title';
|
||||||
|
const TYPE_SUBTITLE = 'subtitle';
|
||||||
|
|
||||||
private $requestStack;
|
private $requestStack;
|
||||||
|
|
||||||
public function __construct(RequestStack $requestStack)
|
public function __construct(RequestStack $requestStack)
|
||||||
@ -38,7 +42,11 @@ class CustomFieldTitle implements CustomFieldInterface
|
|||||||
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
|
public function buildForm(FormBuilderInterface $builder, CustomField $customField)
|
||||||
{
|
{
|
||||||
$builder->add($customField->getSlug(), 'custom_field_title', array(
|
$builder->add($customField->getSlug(), 'custom_field_title', array(
|
||||||
'label' => $customField->getName()[$this->requestStack->getCurrentRequest()->getLocale()]
|
'label' => false,
|
||||||
|
'attr' => array(
|
||||||
|
'title' => $customField->getName()[$this->requestStack->getCurrentRequest()->getLocale()],
|
||||||
|
self::TYPE => $customField->getOptions()[self::TYPE ]
|
||||||
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,6 +72,11 @@ class CustomFieldTitle implements CustomFieldInterface
|
|||||||
|
|
||||||
public function buildOptionsForm(FormBuilderInterface $builder)
|
public function buildOptionsForm(FormBuilderInterface $builder)
|
||||||
{
|
{
|
||||||
return $builder;
|
return $builder->add(self::TYPE, 'choice',
|
||||||
|
array('choices' => array(
|
||||||
|
self::TYPE_TITLE => self::TYPE_TITLE,
|
||||||
|
self::TYPE_SUBTITLE => self::TYPE_SUBTITLE
|
||||||
|
))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{% block custom_field_title_widget %}
|
{% block custom_field_title_widget %}
|
||||||
dump(attr)
|
<span class="{{ form.vars.attr.type }}">
|
||||||
{# suggestion : {{ dump(form) }} to see all attributes from the form and pick the value or label #}
|
{{ form.vars.attr.title }}
|
||||||
|
</span>
|
||||||
{% endblock custom_field_title_widget %}
|
{% endblock custom_field_title_widget %}
|
||||||
|
|
||||||
|
|
||||||
{# render an alement in a choice list #}
|
{# render an alement in a choice list #}
|
||||||
{% block cf_choices_list_widget %}
|
{% block cf_choices_list_widget %}
|
||||||
|
|
||||||
@ -74,11 +74,6 @@ jQuery(document).ready(initialize_{{ form.vars.id }}('ul_' + '{{ form.vars.id }}
|
|||||||
|
|
||||||
{% endblock cf_choices_widget %}
|
{% endblock cf_choices_widget %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% block choice_with_other_widget %}
|
{% block choice_with_other_widget %}
|
||||||
<h1>echo</h1>
|
<h1>echo</h1>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user