MaterioUserLoginBlockAlterRender.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Drupal\materio_user;
  3. use Drupal\Core\Security\TrustedCallbackInterface;
  4. /**
  5. * Provides a trusted callback to alter the commerce cart block.
  6. *
  7. * @see olla_common_block_view_commerce_cart_alter()
  8. */
  9. class MaterioUserLoginBlockAlterRender implements TrustedCallbackInterface {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public static function trustedCallbacks() {
  14. return ['preRender'];
  15. }
  16. /**
  17. * Sets - #pre_render callback.
  18. */
  19. public static function preRender($build) {
  20. $user_links = &$build['content']['user_links'];
  21. $items = &$user_links['#items'];
  22. unset($items['create_account']);
  23. // $items['create_account']['#url']->mergeOptions(array(
  24. // "attributes" => array(
  25. // "@click.prevent" => "create_account"
  26. // )
  27. // ));
  28. // Do not handle passward reset with vue
  29. // $items['request_password']['#url']->mergeOptions(array(
  30. // 'attributes' => array(
  31. // "@click.prevent" => "request_password"
  32. // )
  33. // ));
  34. return $build;
  35. }
  36. }