From 96794064b20917436ce73aedf015a9d53e8d00fb Mon Sep 17 00:00:00 2001 From: Fahad Israr Date: Tue, 2 Jul 2019 12:21:29 +0530 Subject: Custom Modules Added --- modules/fahad/department/composer.json | 14 ++++ ...entity_form_display.node.department.default.yml | 84 ++++++++++++++++++++++ ...entity_view_display.node.department.default.yml | 31 ++++++++ ....entity_view_display.node.department.teaser.yml | 33 +++++++++ .../install/field.field.node.department.body.yml | 24 +++++++ modules/fahad/department/department.info.yml | 12 ++++ modules/fahad/department/department.module | 35 +++++++++ .../department/templates/department.html.twig | 1 + .../department/tests/src/Functional/LoadTest.php | 46 ++++++++++++ 9 files changed, 280 insertions(+) create mode 100644 modules/fahad/department/composer.json create mode 100644 modules/fahad/department/config/install/core.entity_form_display.node.department.default.yml create mode 100644 modules/fahad/department/config/install/core.entity_view_display.node.department.default.yml create mode 100644 modules/fahad/department/config/install/core.entity_view_display.node.department.teaser.yml create mode 100644 modules/fahad/department/config/install/field.field.node.department.body.yml create mode 100644 modules/fahad/department/department.info.yml create mode 100644 modules/fahad/department/department.module create mode 100644 modules/fahad/department/templates/department.html.twig create mode 100644 modules/fahad/department/tests/src/Functional/LoadTest.php (limited to 'modules/fahad/department') diff --git a/modules/fahad/department/composer.json b/modules/fahad/department/composer.json new file mode 100644 index 0000000..07d950c --- /dev/null +++ b/modules/fahad/department/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/department", + "type": "drupal-module", + "description": "My Awesome Module", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/department", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/department", + "source": "http://cgit.drupalcode.org/department" + }, + "require": { } +} diff --git a/modules/fahad/department/config/install/core.entity_form_display.node.department.default.yml b/modules/fahad/department/config/install/core.entity_form_display.node.department.default.yml new file mode 100644 index 0000000..4432971 --- /dev/null +++ b/modules/fahad/department/config/install/core.entity_form_display.node.department.default.yml @@ -0,0 +1,84 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.department.body + - node.type.department + module: + - path + - text + enforced: + module: + - department +id: node.department.default +targetEntityType: node +bundle: department +mode: default +content: + body: + type: text_textarea_with_summary + weight: 121 + settings: + rows: 9 + summary_rows: 3 + placeholder: '' + third_party_settings: { } + region: content + created: + type: datetime_timestamp + weight: 10 + region: content + settings: { } + third_party_settings: { } + langcode: + type: language_select + weight: 2 + region: content + settings: + include_locked: true + third_party_settings: { } + path: + type: path + weight: 30 + region: content + settings: { } + third_party_settings: { } + promote: + type: boolean_checkbox + settings: + display_label: true + weight: 15 + region: content + third_party_settings: { } + status: + type: boolean_checkbox + settings: + display_label: true + weight: 120 + region: content + third_party_settings: { } + sticky: + type: boolean_checkbox + settings: + display_label: true + weight: 16 + region: content + third_party_settings: { } + title: + type: string_textfield + weight: -5 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } + uid: + type: entity_reference_autocomplete + weight: 5 + settings: + match_operator: CONTAINS + size: 60 + placeholder: '' + region: content + third_party_settings: { } +hidden: { } diff --git a/modules/fahad/department/config/install/core.entity_view_display.node.department.default.yml b/modules/fahad/department/config/install/core.entity_view_display.node.department.default.yml new file mode 100644 index 0000000..0f84292 --- /dev/null +++ b/modules/fahad/department/config/install/core.entity_view_display.node.department.default.yml @@ -0,0 +1,31 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.department.body + - node.type.department + module: + - text + - user + enforced: + module: + - department +id: node.department.default +targetEntityType: node +bundle: department +mode: default +content: + body: + label: hidden + type: text_default + weight: 101 + settings: { } + third_party_settings: { } + region: content + links: + weight: 100 + settings: { } + third_party_settings: { } + region: content +hidden: + langcode: true diff --git a/modules/fahad/department/config/install/core.entity_view_display.node.department.teaser.yml b/modules/fahad/department/config/install/core.entity_view_display.node.department.teaser.yml new file mode 100644 index 0000000..28c59d7 --- /dev/null +++ b/modules/fahad/department/config/install/core.entity_view_display.node.department.teaser.yml @@ -0,0 +1,33 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.department.body + - node.type.department + module: + - text + - user + enforced: + module: + - department +id: node.department.teaser +targetEntityType: node +bundle: department +mode: teaser +content: + body: + label: hidden + type: text_summary_or_trimmed + weight: 101 + settings: + trim_length: 600 + third_party_settings: { } + region: content + links: + weight: 100 + settings: { } + third_party_settings: { } + region: content +hidden: + langcode: true diff --git a/modules/fahad/department/config/install/field.field.node.department.body.yml b/modules/fahad/department/config/install/field.field.node.department.body.yml new file mode 100644 index 0000000..fb7688f --- /dev/null +++ b/modules/fahad/department/config/install/field.field.node.department.body.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.body + - node.type.department + module: + - text + enforced: + module: + - department +id: node.department.body +field_name: body +entity_type: node +bundle: department +label: Body +description: '' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: + display_summary: true +field_type: text_with_summary diff --git a/modules/fahad/department/department.info.yml b/modules/fahad/department/department.info.yml new file mode 100644 index 0000000..d7e6e9d --- /dev/null +++ b/modules/fahad/department/department.info.yml @@ -0,0 +1,12 @@ +name: 'department' +type: module +description: 'My Awesome Module' +core: 8.x +package: 'Custom' +dependencies: + - drupal:text + - drupal:path + - drupal:user + - drupal:node + - drupal:menu_ui + \ No newline at end of file diff --git a/modules/fahad/department/department.module b/modules/fahad/department/department.module new file mode 100644 index 0000000..6058d00 --- /dev/null +++ b/modules/fahad/department/department.module @@ -0,0 +1,35 @@ +' . t('About') . ''; + $output .= '
' . t('My Awesome Module') . '
'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function department_theme() { + return [ + 'department' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/fahad/department/templates/department.html.twig b/modules/fahad/department/templates/department.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/fahad/department/templates/department.html.twig @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/fahad/department/tests/src/Functional/LoadTest.php b/modules/fahad/department/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..423abc0 --- /dev/null +++ b/modules/fahad/department/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +user = $this->drupalCreateUser(['administer site configuration']); + $this->drupalLogin($this->user); + } + + /** + * Tests that the home page loads with a 200 response. + */ + public function testLoad() { + $this->drupalGet(Url::fromRoute('