| 
					
				 | 
			
			
				@@ -0,0 +1,57 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<?php 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+namespace Drupal\dr8_zth\Controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use Drupal\Component\Utility\Xss; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use Drupal\Core\Controller\ControllerBase; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use Drupal\dr8_zth\BlogTypeInterface; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use Drupal\taxonomy\TermInterface; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use Drupal\taxonomy\VocabularyInterface; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Provides route responses for dr8_zth.module. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+class BlogController extends ControllerBase { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * Returns a form to add a new term to a vocabulary. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * @param \Drupal\taxonomy\VocabularyInterface $taxonomy_vocabulary 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   *   The vocabulary this term will be added to. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * @return array 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   *   The taxonomy term add form. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  public function addForm(VocabularyInterface $taxonomy_vocabulary) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $term = $this->entityManager()->getStorage('taxonomy_term')->create(array('vid' => $taxonomy_vocabulary->id())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return $this->entityFormBuilder()->getForm($term); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * Route title callback. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * @param \Drupal\dr8_zth\BlogTypeInterface $blog_type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   *   The blog type instance. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * @return string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   *   The blog type label as a render array. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  public function typeTitle(BlogTypeInterface $blog_type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return ['#markup' => $blog_type->label(), '#allowed_tags' => Xss::getHtmlTagList()]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * Route title callback. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * @param \Drupal\taxonomy\TermInterface $taxonomy_term 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   *   The taxonomy term. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * @return array 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   *   The term label as a render array. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  public function termTitle(TermInterface $taxonomy_term) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return ['#markup' => $taxonomy_term->getName(), '#allowed_tags' => Xss::getHtmlTagList()]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |