<?php

namespace Drupal\materio_user;

use Drupal\Core\Security\TrustedCallbackInterface;

/**
 * Provides a trusted callback to alter the commerce cart block.
 *
 * @see olla_common_block_view_commerce_cart_alter()
 */
class MaterioUserLoginBlockAlterRender implements TrustedCallbackInterface {

   /**
    * {@inheritdoc}
    */
   public static function trustedCallbacks() {
    return ['preRender'];
  }

  /**
   * Sets - #pre_render callback.
   */
  public static function preRender($build) {
    $user_links = &$build['content']['user_links'];
    $items = &$user_links['#items'];

    unset($items['create_account']);
    // $items['create_account']['#url']->mergeOptions(array(
    //   "attributes" => array(
    //     "@click.prevent" => "create_account"
    //   )
    // ));

    // Do not handle passward reset with vue
    // $items['request_password']['#url']->mergeOptions(array(
    //   'attributes' => array(
    //     "@click.prevent" => "request_password"
    //   )
    // ));
    return $build;
  }

}