Skip to content
Snippets Groups Projects
Commit 13c6488d authored by Sebastian Castro's avatar Sebastian Castro
Browse files

Prevent editing suboptions and subcategories on creation

parent 4d22e99b
No related branches found
No related tags found
No related merge requests found
...@@ -66,7 +66,7 @@ class CategoryAdmin extends AbstractAdmin ...@@ -66,7 +66,7 @@ class CategoryAdmin extends AbstractAdmin
->add('displayInInfoBar', null, array('required' => false, 'label' => "Dans la fiche détail")) ->add('displayInInfoBar', null, array('required' => false, 'label' => "Dans la fiche détail"))
->add('displayInForm', null, array('required' => false, 'label' => "Dans le formulaire")) ->add('displayInForm', null, array('required' => false, 'label' => "Dans le formulaire"))
->end() ->end()
->with('Options', array('class' => 'col-xs-12')) ->with('Options', array('class' => 'col-xs-12 sub-options-container'))
->add('options', 'sonata_type_collection', array('by_reference' => false, 'type_options' => array('delete' => true)), array( ->add('options', 'sonata_type_collection', array('by_reference' => false, 'type_options' => array('delete' => true)), array(
'edit' => 'inline', 'edit' => 'inline',
'inline' => 'table', 'inline' => 'table',
......
...@@ -73,7 +73,7 @@ protected $baseRoutePattern = 'admin_biopen_geodirectory_option'; ...@@ -73,7 +73,7 @@ protected $baseRoutePattern = 'admin_biopen_geodirectory_option';
->add('displayChildrenInInfoBar', null, array('required' => false, 'label' => "Dans la fiche détail")) ->add('displayChildrenInInfoBar', null, array('required' => false, 'label' => "Dans la fiche détail"))
->add('displayChildrenInForm', null, array('required' => false, 'label' => "Dans le formulaire")) ->add('displayChildrenInForm', null, array('required' => false, 'label' => "Dans le formulaire"))
->end() ->end()
->with('Sous catégories', array('class' => 'col-xs-12')) ->with('Sous catégories', array('class' => 'col-xs-12 sub-categories-container'))
->add('subcategories', 'sonata_type_collection', array('by_reference' => false, 'type_options' => array('delete' => true)), ->add('subcategories', 'sonata_type_collection', array('by_reference' => false, 'type_options' => array('delete' => true)),
array( array(
'edit' => 'inline', 'edit' => 'inline',
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{% if admin.id(object) is not null %} {% if admin.id(object) is not null %}
{{ "title_edit"|trans({'%name%': admin.toString(object) }, 'SonataAdminBundle') }} {{ "title_edit"|trans({'%name%': admin.toString(object) }, 'SonataAdminBundle') }}
{% else %} {% else %}
{{ "title_create"|trans({}, 'SonataAdminBundle') }} {{ "title_create"|trans({}, 'SonataAdminBundle') }}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
...@@ -38,6 +38,16 @@ ...@@ -38,6 +38,16 @@
</style> </style>
{% endblock %} {% endblock %}
{% block form %}
{# If Create, don't display sub options and sub categories creation #}
{% if admin.id(object) is null %}
<style>
.sub-categories-container, .sub-options-container { display: none; }
</style>
{% endif %}
{{ parent() }}
{% endblock %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment