started materio_home module

This commit is contained in:
Bachir Soussi Chiadmi 2019-03-25 18:28:17 +01:00
parent 96eb901675
commit e514a876c2
6 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,7 @@
<?php
use Drupal\Core\Url;
function template_preprocess_materio_home(&$vars){
}

View File

@ -0,0 +1,6 @@
name: Materio Home
type: module
description: Defines home contents for materiO.
core: 8.x
package: Materio
dependencies:

View 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(),
),
);
}

View 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'

View File

@ -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;
}
}

View File

@ -0,0 +1 @@
Hello Materio :)