To delete the following div which appears below your texterea
1 |
<div class="grippie"></div> |
You should add the code below in the form_alter hook
1 |
$form['field']['#resizable'] = FALSE ; |
To delete the following div which appears below your texterea
1 |
<div class="grippie"></div> |
You should add the code below in the form_alter hook
1 |
$form['field']['#resizable'] = FALSE ; |
To decompress a file with .tar.gz extension use the command line below :
1 |
tar -zcvf backup_DATE.tar.gz web |
Phpmyadmin, it is pretty, it is practical but compared to the use of mysql command line via ssh for example on your dedicated server, it has nothing to do when you start a process large databases sql several mega. Indeed to […]
Below is an example of how to use the “theme_image_style ($ variables)” function to get the HTML code of an image on which a specific style is applied:
1 2 3 4 5 6 7 8 9 10 11 12 |
<?php if(!empty($field_galerie_photo['file']->uri)){ $thumbnail_galerie_photo = array( 'style_name' => 'thumbnail_galerie_photo', 'path' => isset($field_galerie_photo['file']->uri) ? $field_galerie_photo['file']->uri : '', 'width' => NULL, 'height' => NULL, ); } echo theme_image_style($thumbnail_galerie_photo); ?> |
This gives us the following result:
1 |
<img src="http://mon.exemple.com/sites/default/files/styles/thumbnail_galerie_photo/public/DSC02260.JPG?itok=y-nbkAM2" width="86" height="86" alt=""> |
In this article I will show you how to create a form by setting a field on a passed value from controller using the getDefaultOptions function :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
namespace MyProject\BackofficeBundle\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilder; use MyProject\ModelBundle\Model\User; class SearchUserType extends AbstractType { public function buildForm(FormBuilder $builder, array $options){ $roles = $options['userType'] === 'bo' ? User::getRoles() : User::getFoRoles(); $builder ->add('firstName') ->add('lastName') ->add('email', 'email') ->add('role', 'choice', array( 'choices' => $roles, 'expanded' => false, 'multiple' => false, 'empty_value' => 'SelectOption', )) ->add('status', 'choice', array( 'choices' => User::getStatus(), 'expanded' => false, 'multiple' => false, 'empty_value' => 'SelectOption', )); } public function getDefaultOptions(array $options){ return array( 'data_class' => 'MyProject\BackofficeBundle\Search\UserSearch', 'userType' => 'bo', ); } public function getName(){ return 'search_user'; } } |
Now in the controller we can create the form with a default value for the option “userType” that allow us to define the value of the : […]
If you wish the field to be ignored when reading or writing to the object, you can set the property_path option to false.
1 |
$builder->add('field_name', 'field_type', array('property_path' => false)) |
NB : Since 2.1, the mapped option has been added for this use-case.