Skip to content

Instantly share code, notes, and snippets.

@cyberlex404
Created November 30, 2017 07:29
Show Gist options
  • Select an option

  • Save cyberlex404/82b92c93f60380254c56a48a25c4a43f to your computer and use it in GitHub Desktop.

Select an option

Save cyberlex404/82b92c93f60380254c56a48a25c4a43f to your computer and use it in GitHub Desktop.
MODULE_form_user_login_form_alter
<?php
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\Component\Render\FormattableMarkup;
/**
* Implements hook_form_BASE_FORM_ID_alter().
*/
function MODULE_form_user_login_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$url = Url::fromRoute('user.register');
$form['register_link'] = [
'#markup' => new FormattableMarkup('@question <a href="@link">@link_text</a>', [
'@question' => t('No account?'),
'@link' => $url->toString(),
'@link_text' => t('registration'),
])
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment