contacts-8.x-1.x-dev/modules/user_dashboard/src/Controller/UserDashboardProfileController.php

modules/user_dashboard/src/Controller/UserDashboardProfileController.php
<?php

namespace Drupal\contacts_user_dashboard\Controller;

use Drupal\profile\Controller\UserController;
use Drupal\profile\Entity\ProfileInterface;
use Drupal\profile\Entity\ProfileTypeInterface;
use Drupal\user\UserInterface;

/**
 * Controller for user dashboard profiles.
 *
 * Ensures that the correct form display is used.
 *
 * @package Drupal\contacts_user_dashboard\Controller
 */
class UserDashboardProfileController extends UserController {

  /**
   * {@inheritdoc}
   */
  public function addForm(UserInterface $user, ProfileTypeInterface $profile_type) {
    $profile = $this->entityTypeManager()->getStorage('profile')->create([
      'uid' => $user->id(),
      'type' => $profile_type->id(),
    ]);
    return $this->entityFormBuilder()->getForm($profile, 'user_dashboard');
  }

  /**
   * {@inheritdoc}
   */
  public function editForm(ProfileInterface $profile) {
    return $this->entityFormBuilder()->getForm($profile, 'user_dashboard');
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc