ZF-4977: SubmitButton labels aren't getting rendered

Description

I upgraded to the release version of 1.7.0 after using the 1.7.0 RC and noticed a bug right away. SubmitButton labels weren't getting rendered.

It seems that something has changed in the way SubmitButtons are handled internally and the SubmitButton view helper needs to be updated. From the perspective of the SubmitButton view helper, the label is now stored in the $attribs['content'] field, not the $params['label'] field nor $value.

I made a change to line 54 in Zend/Dojo/View/Helper/SubmitButton.php that fixes the issue

$params['label'] = array_key_exists('content', $attribs) ? $attribs['content'] : $value;

The array_key_exists test is probably unnecessary since I noticed $attribs['content'] contains the name of the button if there is no label, but I like to pad my code for unforseen errors & future changes :)

Comments

Fixed in trunk in r12691, and merged to 1.7 release branch in r12692.

Just want to note...

Using the form element, you have the following workaround available until you are able to upgrade:


$element->setDijitParam("label", );

// or, at creation
$form->addElement('SubmitButton', 'submit', array(
    'label' => ,
    'dijitParams' => array('label' => ),
));

In the view helper, specify a label parameter in the dijitParams argument:


$view->submitButton('submit', 'Label', array('label' => 'Label'));

If you specify both, your code will continue to work in the future as well.