From dc4c763d99d59c0b4ae449153c18369bc076c742 Mon Sep 17 00:00:00 2001 From: bach Date: Thu, 17 Nov 2022 12:46:46 +0100 Subject: [PATCH] added state to lincesed roles display in user edit form --- .../custom/materio_commerce/materio_commerce.module | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/modules/custom/materio_commerce/materio_commerce.module b/web/modules/custom/materio_commerce/materio_commerce.module index 0170c63f..38f843ac 100644 --- a/web/modules/custom/materio_commerce/materio_commerce.module +++ b/web/modules/custom/materio_commerce/materio_commerce.module @@ -65,7 +65,7 @@ function materio_commerce_form_role_delegation_role_assign_form_alter(&$form, &$ $granted = $license->getGrantedTime(); $expires = $license->getExpiresTime(); - + $license_state = $license->getState()->getValue()['value']; $license_edit_url = $license->toUrl(); $license_link = Link::fromTextAndUrl(t('edit license'), $license_edit_url); @@ -80,9 +80,10 @@ function materio_commerce_form_role_delegation_role_assign_form_alter(&$form, &$ )), $order_url); } - $description .= t("
-- @product: @variation | granted: @granted | expires: @expires | @license_link | @order_link", array( + $description .= t("
-- @product: @variation | license state: @license_state | granted: @granted | expires: @expires | @license_link | @order_link", array( '@product' => $product ? $product->getTitle() : t('no product'), '@variation' => $product_variation ? $product_variation->getTitle() : t('no variation'), + '@license_state' => $license_state, '@granted' => date('d-m-Y', $granted), '@expires' => $expires === "0" ? 'never' : date('d-m-Y', $expires), '@license_link' => $license_link->toString(), @@ -139,7 +140,7 @@ function materio_commerce_form_user_form_alter(&$form, &$form_state, $form_id) { $granted = $license->getGrantedTime(); $expires = $license->getExpiresTime(); - + $license_state = $license->getState()->getValue()['value']; $license_edit_url = $license->toUrl(); $license_link = Link::fromTextAndUrl(t('edit license'), $license_edit_url); @@ -154,9 +155,10 @@ function materio_commerce_form_user_form_alter(&$form, &$form_state, $form_id) { )), $order_url); } - $description .= t("
-- @product: @variation | granted: @granted | expires: @expires | @license_link | @order_link", array( + $description .= t("
-- @product: @variation | license state: @license_state | granted: @granted | expires: @expires | @license_link | @order_link", array( '@product' => $product ? $product->getTitle() : t('no product'), '@variation' => $product_variation ? $product_variation->getTitle() : t('no variation'), + '@license_state' => $license_state, '@granted' => date('d-m-Y', $granted), '@expires' => $expires === "0" ? 'never' : date('d-m-Y', $expires), '@license_link' => $license_link->toString(),