0

I have created a form that has a submit button.

$form['products_submit'] = array(
    '#type' => 'submit',
    "#id"  => "submit_first",
    '#value' => t('Submit'),
    '#ajax' => array(
                'callback' => 'products_submit_driven_callback',
                'method' => 'replace',
                'effect' => 'fade',
                'progress' => array('type' => 'none'),
            ),
            '#prefix' => '<div class="button-logged-in">',
        '#suffix' => '</div>'
    );

  return $form;

And I want to add an image inside the button, at the left of 'Submit' text. I tried to add the img tag inside the t function but it just showed the code and not the image. Does anyone know how can I manage this?

2

1 Answer 1

-1

You can handle this from CSS.

Like :

.button-logged-in.input{
    background-image: url(/images/buttons/submit.png);
}

Example : https://stackoverflow.com/questions/2920076/html-css-how-to-add-image-icon-to-input-type-button

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.