Linked Questions

2
votes
0answers
99 views

Creating input type=button [duplicate]

was tying to create a <input type="button" /> in drupal 8, below code snippet $button['button'] = array( '#type' => 'button', '#value' => $this->t('#Clear'), ); followed by ...
0
votes
0answers
30 views

When rendering a custom form, how do I use <button> instead of <input type=“submit”> for the button #type? [duplicate]

I have a render array for my custom form, which acts as a "Like" button for articles (but with custom functionality for our client). The button is defined like so: ... $form['like_btn'] = [ ...
0
votes
2answers
5k views

How to add html tag in a form element?

How to add html tag in a form element drupal 8? $form['buttons']['submit'] = [ '#type' => 'submit', '#value' => T('Send'), '#prefix' => '<div class="modal-footer">', '#suffix' =...
4
votes
1answer
2k views

Is there a way to provide theme name suggestion for form elements?

I'm trying to look for a way to modify the markup for a form element without touching the default theme/template. Upon checking the source code, Drupal does not seem to recommend any theme suggestions ...
1
vote
2answers
2k views

Button with different value and label / text

in Drupal 8, I want my form display such a (submit) button: <button name="name" type="submit" value="value">Not the value</button> So basically, the button value (that will be submitted) ...
1
vote
1answer
890 views

Why I can't use the same code from Drupal 7 in Drupal 8 to generate a button with FAPI?

Following the question Generating <button type="submit"> with the form API for Drupal 7 I tried to implement the same thing in Drupal 8. I need the following output: <button type=...
1
vote
0answers
659 views

Use form id as part of a form input twig file name

Problem I would like to have a theme suggestion for form elements (e.g. input, select, etc) that includes the form's ID. This would be nice for when I only want to make changes to the elements of that ...
0
votes
1answer
293 views

Overriding radio button rendering

I have a List (text) field on a comment type. This field is required and only one option may be chosen, so a radio button is how it will be rendered. I would now like to change the way the radio ...
0
votes
1answer
135 views

Create a button with an icon in render array, that can be themed by arbitrary contributed themes

Drupal 8 does not use HTML button tag for creating buttons, it instead uses the input tag to create buttons. This works fine for most part, except for buttons which include an icon gets messed up by ...
0
votes
0answers
44 views

How to theme field collection form in Drupal 8?

I want to theme the field collection add and edit form. I have a field collection name "field_experience" and want to theme the form of that field collection I tried field--field-experience.html.twig, ...