social_lms_integrator-1.0.0-beta4/modules/social_lms_integrator_iteration_enrollment_notify/src/IterationWelcomeMessageTokenTreeBuilder.php

modules/social_lms_integrator_iteration_enrollment_notify/src/IterationWelcomeMessageTokenTreeBuilder.php
<?php

namespace Drupal\social_lms_integrator_iteration_enrollment_notify;

use Drupal\token\TreeBuilder;

class IterationWelcomeMessageTokenTreeBuilder extends TreeBuilder {
  
  public function buildRenderable ( array $token_types, array $options = [] ) {
    
    $unrendered_tree = parent::buildRenderable ( $token_types, $options );
 
    foreach ( $unrendered_tree['#token_tree'] as 
    	$token_type => $token_type_value ) {

    	if ( in_array($token_type, $token_types) ) {

    		 foreach ( $unrendered_tree['#token_tree'][$token_type]['tokens'] as
    		 	$key => $value) {

    		 	if ( !in_array($key, $options['whitelist']) ) {

    				unset($unrendered_tree['#token_tree'][$token_type]['tokens'][$key]);

    			}
    		}
			}
    }
    
    return $unrendered_tree;

  }
}

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

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