/**
  * Check if the message can be member customizable
  * @category save_callback
  *
  * @param mixed          $varValue
  * @param \DataContainer $dc
  *
  * @return mixed
  * @throws \Exception
  */
 public function checkMessageMemberCustomizable($varValue, $dc)
 {
     /** @noinspection PhpUndefinedMethodInspection */
     $objNotification = Notification::findByPk($dc->activeRecord->pid);
     $strNotificationType = Notification::findGroupForType($objNotification->type);
     // Check the allowed tokens corresponding for this notification type
     foreach ($GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE'][$strNotificationType][$objNotification->type] as $field => $tokens) {
         // We have to check whether the member id will be passed to the message as token
         if (in_array('member_id', $tokens) || in_array('member_*', $tokens)) {
             return $varValue;
         }
     }
     throw new \Exception($GLOBALS['TL_LANG']['ERR']['messageNotMemberCustomizable']);
 }
 /**
  * Verify tokens
  * @param   string Text
  * @param   \DataContainer
  */
 public function verifyTokens($rgxp, $strText, $objWidget)
 {
     if ($rgxp != 'nc_tokens') {
         return false;
     }
     $strGroup = NotificationModel::findGroupForType(static::$strType);
     $arrValidTokens = (array) $GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE'][$strGroup][static::$strType][$objWidget->name];
     // Build regex pattern
     $strPattern = '/##(' . implode('|', $arrValidTokens) . ')##/i';
     $strPattern = str_replace('*', '[^##]*', $strPattern);
     preg_match_all($strPattern, $strText, $arrValidMatches);
     preg_match_all('/##([A-Za-z0-9_]+)##/i', $strText, $arrAllMatches);
     $arrInvalidTokens = array_diff($arrAllMatches[1], $arrValidMatches[1]);
     if (count($arrInvalidTokens)) {
         $strInvalidTokens = '##' . implode('##, ##', $arrInvalidTokens) . '##';
         $objWidget->addError(sprintf($GLOBALS['TL_LANG']['tl_nc_language']['token_error'], $strInvalidTokens));
     }
     return true;
 }