Note that there are some explanatory texts on larger screens.

plurals
  1. POSymfony (Propel) Admin Generator Behavior - Why does it work like this?
    primarykey
    data
    text
    <p>I've been having some 'issues' with the admin generator (Propel version). The HTML generation behavior between the list view and the form view is very different, and I'd like to know why, as the form view works better (and as expected) compared to the list view.</p> <p>I have the following YAML for the 'edit' action,</p> <pre><code>edit: actions: custom: { confirm: 'Run this custom action?' } _list: ~ _save: ~ </code></pre> <p>This generates the following HTML/PHP for the custom action specified,</p> <pre><code>// Snip ... &lt;li class="sf_admin_action_custom"&gt; &lt;?php if (method_exists($helper, 'linkToCustom')): ?&gt; &lt;?php echo $helper-&gt;linkToCustom($form-&gt;getObject(), array( 'confirm' =&gt; 'Run this custom action?', 'params' =&gt; array( ), 'class_suffix' =&gt; 'custom', 'label' =&gt; 'Custom',)) ?&gt; &lt;?php else: ?&gt; &lt;?php echo link_to(__('Custom', array(), 'messages'), 'users/ListCustom?id='.$user-&gt;getId(), array()) ?&gt; &lt;?php endif; ?&gt; &lt;/li&gt; // Snip ... </code></pre> <p>Now, if I add my custom action to the YAML for the list view,</p> <pre><code>list: object_actions: custom: { confirm: 'Run this custom action?' } _edit: ~ _delete: ~ </code></pre> <p>I get the following HTML generated,</p> <pre><code>// Snip ... &lt;li class="sf_admin_action_custom"&gt; &lt;?php echo link_to(__('Custom', array(), 'messages'), 'users/ListCustom?id='.$user-&gt;getId(), array()) ?&gt; &lt;/li&gt; // Snip ... </code></pre> <p>There's some distinct differences here that I find very odd,</p> <ol> <li>The form actions code checks to see if there is a method on the helper, and uses it if so, falling back to a standard <a href="http://www.symfony-project.org/api/1_4/UrlHelper#method_link_to" rel="nofollow noreferrer"><code>link_to()</code></a> function if not. However, the list actions code just uses the <a href="http://www.symfony-project.org/api/1_4/UrlHelper#method_link_to" rel="nofollow noreferrer"><code>link_to()</code></a> function, not even trying to use the helper.</li> <li>The form actions code passes my custom confirm message to the custom helper method, but neither templates pass it to the <a href="http://www.symfony-project.org/api/1_4/UrlHelper#method_link_to" rel="nofollow noreferrer"><code>link_to()</code></a>. Why is this? I'm hoping this is a bug.</li> </ol> <p>If someone could shed some light as to why the two generate differently, I'd really appreciate it.</p> <p>Thank you.</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.
    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