started materio_home module
This commit is contained in:
		@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Drupal\Core\Url;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function template_preprocess_materio_home(&$vars){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										6
									
								
								web/modules/custom/materio_home/materio_home.info.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								web/modules/custom/materio_home/materio_home.info.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					name: Materio Home
 | 
				
			||||||
 | 
					type: module
 | 
				
			||||||
 | 
					description: Defines home contents for materiO.
 | 
				
			||||||
 | 
					core: 8.x
 | 
				
			||||||
 | 
					package: Materio
 | 
				
			||||||
 | 
					dependencies:
 | 
				
			||||||
							
								
								
									
										16
									
								
								web/modules/custom/materio_home/materio_home.module
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								web/modules/custom/materio_home/materio_home.module
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Implements hook_theme().
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					function materio_home_theme($existing, $type, $theme, $path) {
 | 
				
			||||||
 | 
					  // @see https://www.drupal.org/docs/8/theming/twig/create-custom-twig-templates-from-custom-module
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return array(
 | 
				
			||||||
 | 
					    'materio_home' => array(
 | 
				
			||||||
 | 
					      // 'render element' => '',
 | 
				
			||||||
 | 
					      'file' => 'includes/materio_home.inc',
 | 
				
			||||||
 | 
					      'variables' => array(),
 | 
				
			||||||
 | 
					    ),
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										23
									
								
								web/modules/custom/materio_home/materio_home.routing.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								web/modules/custom/materio_home/materio_home.routing.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					materio_home.home:
 | 
				
			||||||
 | 
					  path: '/home'
 | 
				
			||||||
 | 
					  defaults:
 | 
				
			||||||
 | 
					    _controller: '\Drupal\materio_home\Controller\HomeController::home'
 | 
				
			||||||
 | 
					    _title: 'Home'
 | 
				
			||||||
 | 
					  requirements:
 | 
				
			||||||
 | 
					    _permission: 'access content'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# materio_home.home_mobile:
 | 
				
			||||||
 | 
					#   path: '/home_m'
 | 
				
			||||||
 | 
					#   defaults:
 | 
				
			||||||
 | 
					#     _controller: '\Drupal\materio_home\Controller\HomeController::home_mobile'
 | 
				
			||||||
 | 
					#     _title: 'Home'
 | 
				
			||||||
 | 
					#   requirements:
 | 
				
			||||||
 | 
					#     _permission: 'access content'
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# materio_home.home_mobileajax:
 | 
				
			||||||
 | 
					#   path: '/home_m/ajax'
 | 
				
			||||||
 | 
					#   defaults:
 | 
				
			||||||
 | 
					#     _controller: '\Drupal\materio_home\Controller\HomeController::home_mobilejson'
 | 
				
			||||||
 | 
					#     _title: 'Home'
 | 
				
			||||||
 | 
					#   requirements:
 | 
				
			||||||
 | 
					#     _permission: 'access content'
 | 
				
			||||||
@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Drupal\materio_home\Controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Drupal\Core\Controller\ControllerBase;
 | 
				
			||||||
 | 
					use Drupal\Core\Datetime\DrupalDateTime;
 | 
				
			||||||
 | 
					use Drupal\taxonomy\Entity\Term;
 | 
				
			||||||
 | 
					use Drupal\workflow\Entity\WorkflowManager;
 | 
				
			||||||
 | 
					use Drupal\Core\Url;
 | 
				
			||||||
 | 
					use Drupal\Core\Language\LanguageInterface;
 | 
				
			||||||
 | 
					// use Symfony\Component\HttpFoundation\JsonResponse;
 | 
				
			||||||
 | 
					use Drupal\Core\Cache\CacheableJsonResponse;
 | 
				
			||||||
 | 
					use Drupal\Core\Cache\CacheableMetadata;
 | 
				
			||||||
 | 
					use Drupal\core\render\RenderContext;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class HomeController extends ControllerBase {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /**
 | 
				
			||||||
 | 
					   * Display home as a page.
 | 
				
			||||||
 | 
					   *
 | 
				
			||||||
 | 
					   * @return renderable array
 | 
				
			||||||
 | 
					   */
 | 
				
			||||||
 | 
					  public function home() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $contents = array("#theme"=>'materio_home');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return $contents;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					Hello Materio :)
 | 
				
			||||||
		Reference in New Issue
	
	Block a user