Changed name of Profile entity to Hat
so as not to conflict with Profile or Profile2 module on existing sites
This commit is contained in:
34
src/Controller/HatController.php
Normal file
34
src/Controller/HatController.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\zencrm\Controller;
|
||||
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
|
||||
/**
|
||||
* Class HatController.
|
||||
*/
|
||||
class HatController extends ControllerBase {
|
||||
|
||||
/**
|
||||
* Hello.
|
||||
*
|
||||
* @return string
|
||||
* Return Hello string.
|
||||
*/
|
||||
public function createHatForPerson($type, $person_id) {
|
||||
$values = array(
|
||||
'type' => $type,
|
||||
'person' => $person_id
|
||||
);
|
||||
|
||||
$node = \Drupal::entityTypeManager()
|
||||
->getStorage('hat')
|
||||
->create($values);
|
||||
|
||||
$form = \Drupal::entityTypeManager()
|
||||
->getFormObject('hat', 'default')
|
||||
->setEntity($node);
|
||||
return \Drupal::formBuilder()->getForm($form);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user