Last active
November 18, 2018 22:35
-
-
Save JeromeChevalier/d2f36463796e042641d69b35ee1cfef9 to your computer and use it in GitHub Desktop.
Render Array template #drupal8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Test Field | |
$render['myTextField'] = [ | |
'#type' => 'textfield', | |
'#title' => t('My title'), | |
]; | |
// Number Field | |
$render['myNumberField'] = [ | |
'#type' => 'number', | |
'#min' => '0', | |
'#max' => '100', | |
'#step' => '1', | |
'#size' => '9', | |
'#title' => t('My title'), | |
]; | |
// Link with button aspect | |
$render['myButton'] = [ | |
'#type' => 'link', | |
'#title' => t('MyTitle'), | |
'#url' => \Drupal\Core\Url::fromUserInput('/myPath'), | |
]; | |
$render['myButton']['#attributes']['class'][] = 'ui green button'; | |
// Select | |
$render['mySelect'] = array( | |
'#type' => 'select', | |
'#title' => $this->t("myTitle"), | |
'#options' => [ | |
'1' => $this->t("option1"), | |
'2' => $this->t("option2"), | |
'3' => $this->t("option3"), | |
], | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment