Note that there are some explanatory texts on larger screens.

plurals
  1. POCustomizing layout to sfWidgetFormDoctrineChoice disable checkbox
    primarykey
    data
    text
    <p>Good morning,</p> <p>In Symfony 1.4,<br> I tried to do what is explained here : <a href="https://stackoverflow.com/questions/15953970/customizing-layout-to-sfwidgetformdoctrinechoice/16018948">Customizing layout to sfWidgetFormDoctrineChoice</a><br> But it doesn't work. Instead of adding a thumbnail, <strong>I just want to hide the <code>&lt;li&gt;</code> before the input, and in some condition disable/hide the checkbox input but show the label anyway</strong>.<br> When I add the renderer without argument, I get this error :<br> <code>sfWidgetFormMySelectCheckbox requires the following options: 'choices'.</code></p> <p><strong>Here is my formatter code :</strong></p> <pre><code>class sfWidgetFormMySelectCheckbox extends sfWidgetFormSelectCheckbox { public function configure($options = array(), $arguments = array()) { parent::configure($options, $arguments); } protected function formatChoices($name, $value, $choices, $attributes) { ..... // new $inputs[$id] = array( 'input' =&gt; sprintf('| test | %s', $this-&gt;renderTag('input', array_merge($baseAttributes, $attributes)) ), 'label' =&gt; $this-&gt;renderContentTag('label', self::escapeOnce($option), array('for' =&gt; $id)), ); } return call_user_func($this-&gt;getOption('formatter'), $this, $inputs); } } </code></pre> <p><strong>And now the form where I call it :</strong></p> <pre><code>$this-&gt;setWidget('aaa', new sfWidgetFormDoctrineChoice(array( 'model' =&gt; 'Aaa', 'expanded' =&gt; true, 'multiple' =&gt; true, 'add_empty' =&gt; false, 'query' =&gt; $query, 'renderer' =&gt; new sfWidgetFormMySelectCheckbox() ))); </code></pre> <p>Thanks for your help !</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload