Note that there are some explanatory texts on larger screens.

plurals
  1. POCustomizing layout to sfWidgetFormDoctrineChoice
    primarykey
    data
    text
    <p>I am using Symfony 1.4 sfWidgetFormDoctrineChoice</p> <p>I have added the checkboxes to the form, which pulls the Model data successfully. What I want to do is also include a thumbnail next to the checkbox, along with the title.</p> <pre><code>$this-&gt;setWidget('bulkUploadVideos', new sfWidgetFormDoctrineChoice(array( 'model' =&gt; 'MediaAsset', 'query' =&gt; Doctrine_Query::create()-&gt;select('u.url')-&gt;from('MediaAsset u')-&gt;orderBy('id DESC'), 'add_empty' =&gt; false, 'multiple' =&gt; true, 'expanded' =&gt; true ) )); </code></pre> <p>This does a fantastic job of pulling the query into a list of checkboxes arranged like so:</p> <p>⧠ Greenjeans</p> <p>⧠ Mr Magoo</p> <p>⧠ Droopy</p> <p>In the Media Assets table, I also have an image url that I want to include in the layout. SO it would look like this:</p> <p>|-img thumbnial- | ⧠ Greenjeans</p> <p>|-img thumbnail- | ⧠ Mr. Magoo</p> <p>|-img thumbnial- | ⧠ Droopy</p> <p>I thought maybe using a formatter class, but I do not see any change in the form.</p> <p><strong>lib/form/formatters/sfWidgetFormSchemaFormatterAllVideos.class.php</strong></p> <pre><code>&lt;?php class sfWidgetFormSchemaFormatterAllVideos extends sfWidgetFormSchemaFormatter { protected $rowFormat = "&lt;span class=\"my-label-class\"&gt;%label%&lt;/span&gt;\n &lt;span&gt;%error%%field%%help%%hidden_fields%&lt;/span&gt;`n", $errorRowFormat = "&lt;span class=\"my-error-class\" colspan=\"2\"&gt;\n%errors%&lt;/span&gt;\n", $helpFormat = '&lt;br /&gt;%help%', $decoratorFormat = "&lt;div class='custom-video-layout'&gt;\n %content%&lt;/div&gt;"; } </code></pre> <p>and then i put this at the bottom of my MediaAssetsForm.class.php</p> <pre><code>public function configure() { parent::configure(); ... .. ... $this-&gt;getWidgetSchema()-&gt;setFormFormatterName('AllVideos'); </code></pre> <p>Alas, the page layout looks exactly the same. Am I incorrectly calling the Formatter, or is there a much easier way of doing this?</p> <p>Which btw, still does not answer the question of how I query the image url from the table into the output for each checkbox. That's the main problem I would like to solve. Thumbnails of each record in the form.</p>
    singulars
    1. This table or related slice is empty.
    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