add label_attr attribute to form smarty plugin

This commit is contained in:
Manuel Raynaud
2013-09-05 14:22:28 +02:00
parent f4c2f865e4
commit 40b524e9d6
4 changed files with 10 additions and 3 deletions

View File

@@ -71,10 +71,12 @@ class Cart extends BaseLoop
*/
public function exec(&$pagination)
{
$cartItems = $cart->getCartItems();
$result = new LoopResult($cartItems);
$cart = $this->getCart($this->request);
$cartItems = $cart->getCartItems();
$result = new LoopResult($cartItems);
if ($cart === null) {
return $result;

View File

@@ -123,6 +123,7 @@ class Form extends AbstractSmartyPlugin
$template->assign("name", $formFieldView->vars["full_name"]);
$template->assign("value", $formFieldView->vars["value"]);
$template->assign("label", $formFieldView->vars["label"]);
$template->assign("label_attr", $formFieldView->vars["label_attr"]);
$errors = $formFieldView->vars["errors"];

View File

@@ -67,6 +67,10 @@ class CartAdd extends BaseForm
new Constraints\Callback(array("methods" => array(
array($this, "checkProduct")
)))
),
"label" => "product",
"label_attr" => array(
"for" => "cart_product"
)
))
->add("product_sale_elements_id", "text", array(

View File

@@ -24,7 +24,7 @@
{form_error form=$form field="product"}
{$message}
{/form_error}
<label>{intl l="product"}: </label><input type="text" name="{$name}" value="{$value}" {$attr} ><br />
<label for="{$label_attr.for}">{intl l="{$label}"}: </label><input id="{$label_attr.for}" type="text" name="{$name}" value="{$value}" {$attr} ><br />
{/form_field}
{form_field form=$form field='product_sale_elements_id'}