|
@@ -1,9 +1,10 @@
|
|
|
<?php
|
|
|
// use Drupal\Core\Form\FormBuilder;
|
|
|
+// use Drupal\Core\Url;
|
|
|
use \Drupal\Core\Link;
|
|
|
-use Drupal\Core\Entity\EntityInterface;
|
|
|
+// use Drupal\Core\Entity\EntityInterface;
|
|
|
use Drupal\Core\Entity\EntityFormInterface;
|
|
|
-use Drupal\Core\Form\FormStateInterface;
|
|
|
+// use Drupal\Core\Form\FormStateInterface;
|
|
|
use Drupal\user\EntityOwnerInterface;
|
|
|
|
|
|
|
|
@@ -28,16 +29,13 @@ function materio_commerce_form_commerce_order_add_form_alter(&$form, &$form_stat
|
|
|
}
|
|
|
|
|
|
function materio_commerce_form_role_delegation_role_assign_form_alter(&$form, &$form_state, $form_id) {
|
|
|
-
|
|
|
|
|
|
- /** @var \Drupal\Core\Entity\EntityFormInterface $form_object */
|
|
|
- $form_object = $form_state->getFormObject();
|
|
|
+ // /** @var \Drupal\Core\Entity\EntityFormInterface $form_object */
|
|
|
+ // $form_object = $form_state->getFormObject();
|
|
|
// if (!($form_object instanceof EntityFormInterface)) {
|
|
|
// // We're only interested in forms for an entity.
|
|
|
// return;
|
|
|
// }
|
|
|
- /** @var \Drupal\user\UserInterface $account */
|
|
|
- $account = $form_state->getBuildInfo()['args'][0];
|
|
|
// $entity = $form_object->getEntity();
|
|
|
// $entity_type_id = $entity->getEntityTypeId();
|
|
|
// if (!($entity instanceof EntityOwnerInterface) && $entity_type_id != 'user') {
|
|
@@ -45,6 +43,9 @@ function materio_commerce_form_role_delegation_role_assign_form_alter(&$form, &$
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
+ /** @var \Drupal\user\UserInterface $account */
|
|
|
+ $account = $form_state->getBuildInfo()['args'][0];
|
|
|
+
|
|
|
$license_storage = \Drupal::entityTypeManager()->getStorage('commerce_license');
|
|
|
$licenses = $license_storage->loadByProperties(['uid' => $account->id()]);
|
|
|
|