Hi there,
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.
I have the following YAML for the 'edit' action,
edit:
actions:
custom: { confirm: 'Run this custom action?' }
_list: ~
_save: ~
This generates the following HTML/PHP for the custom action specified,
// Snip ...
<li class="sf_admin_action_custom">
<?php if (method_exists($helper, 'linkToCustom')): ?>
<?php echo $helper->linkToCustom($form->getObject(), array( 'confirm' => 'Run this custom action?', 'params' => array( ), 'class_suffix' => 'custom', 'label' => 'Custom',)) ?>
<?php else: ?>
<?php echo link_to(__('Custom', array(), 'messages'), 'users/ListCustom?id='.$user->getId(), array()) ?>
<?php endif; ?>
</li>
// Snip ...
Now, if I add my custom action to the YAML for the list view,
list:
object_actions:
custom: { confirm: 'Run this custom action?' }
_edit: ~
_delete: ~
I get the following HTML generated,
// Snip ...
<li class="sf_admin_action_custom">
<?php echo link_to(__('Custom', array(), 'messages'), 'users/ListCustom?id='.$user->getId(), array()) ?>
</li>
// Snip ...
There's some distinct differences here that I find very odd,
- 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
link_to()
function if not. However, the list actions code just uses thelink_to()
function, not even trying to use the helper. - The form actions code passes my custom confirm message to the custom helper method, but neither templates pass it to the
link_to()
. Why is this? I'm hoping this is a bug.
If someone could shed some light as to why the two generate differently, I'd really appreciate it.
Thank you.