diff options
Diffstat (limited to 'modules/fahad/faq')
10 files changed, 299 insertions, 0 deletions
diff --git a/modules/fahad/faq/composer.json b/modules/fahad/faq/composer.json new file mode 100644 index 0000000..17c3f4b --- /dev/null +++ b/modules/fahad/faq/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/faq", + "type": "drupal-module", + "description": "My Awesome Module", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/faq", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/faq", + "source": "http://cgit.drupalcode.org/faq" + }, + "require": { } +} diff --git a/modules/fahad/faq/config/install/core.entity_form_display.node.faq.default.yml b/modules/fahad/faq/config/install/core.entity_form_display.node.faq.default.yml new file mode 100644 index 0000000..e33492b --- /dev/null +++ b/modules/fahad/faq/config/install/core.entity_form_display.node.faq.default.yml @@ -0,0 +1,84 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.faq.body + - node.type.faq + module: + - path + - text + enforced: + module: + - faq +id: node.faq.default +targetEntityType: node +bundle: faq +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/faq/config/install/core.entity_view_display.node.faq.default.yml b/modules/fahad/faq/config/install/core.entity_view_display.node.faq.default.yml new file mode 100644 index 0000000..4524968 --- /dev/null +++ b/modules/fahad/faq/config/install/core.entity_view_display.node.faq.default.yml @@ -0,0 +1,31 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.faq.body + - node.type.faq + module: + - text + - user + enforced: + module: + - faq +id: node.faq.default +targetEntityType: node +bundle: faq +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/faq/config/install/core.entity_view_display.node.faq.teaser.yml b/modules/fahad/faq/config/install/core.entity_view_display.node.faq.teaser.yml new file mode 100644 index 0000000..1396f0f --- /dev/null +++ b/modules/fahad/faq/config/install/core.entity_view_display.node.faq.teaser.yml @@ -0,0 +1,33 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.faq.body + - node.type.faq + module: + - text + - user + enforced: + module: + - faq +id: node.faq.teaser +targetEntityType: node +bundle: faq +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/faq/config/install/field.field.node.faq.body.yml b/modules/fahad/faq/config/install/field.field.node.faq.body.yml new file mode 100644 index 0000000..d0c6a67 --- /dev/null +++ b/modules/fahad/faq/config/install/field.field.node.faq.body.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.body + - node.type.faq + module: + - text + enforced: + module: + - faq +id: node.faq.body +field_name: body +entity_type: node +bundle: faq +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/faq/config/install/node.type.faq.yml b/modules/fahad/faq/config/install/node.type.faq.yml new file mode 100644 index 0000000..12b86e5 --- /dev/null +++ b/modules/fahad/faq/config/install/node.type.faq.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - menu_ui + enforced: + module: + - faq +third_party_settings: + menu_ui: + available_menus: + - main + parent: 'main:' +name: FAQ +type: faq +description: '' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: true diff --git a/modules/fahad/faq/faq.info.yml b/modules/fahad/faq/faq.info.yml new file mode 100644 index 0000000..5cdd49f --- /dev/null +++ b/modules/fahad/faq/faq.info.yml @@ -0,0 +1,11 @@ +name: 'faq' +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/faq/faq.module b/modules/fahad/faq/faq.module new file mode 100644 index 0000000..025f6b6 --- /dev/null +++ b/modules/fahad/faq/faq.module @@ -0,0 +1,35 @@ +<?php + +/** + * @file + * Contains faq.module. + */ + +use Drupal\Core\Routing\RouteMatchInterface; + +/** + * Implements hook_help(). + */ +function faq_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + // Main module help for the faq module. + case 'help.page.faq': + $output = ''; + $output .= '<h3>' . t('About') . '</h3>'; + $output .= '<p>' . t('My Awesome Module') . '</p>'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function faq_theme() { + return [ + 'faq' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/fahad/faq/templates/faq.html.twig b/modules/fahad/faq/templates/faq.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/fahad/faq/templates/faq.html.twig @@ -0,0 +1 @@ +<!-- Add you custom twig html here -->
\ No newline at end of file diff --git a/modules/fahad/faq/tests/src/Functional/LoadTest.php b/modules/fahad/faq/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..e27bb60 --- /dev/null +++ b/modules/fahad/faq/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +<?php + +namespace Drupal\Tests\faq\Functional; + +use Drupal\Core\Url; +use Drupal\Tests\BrowserTestBase; + +/** + * Simple test to ensure that main page loads with module enabled. + * + * @group faq + */ +class LoadTest extends BrowserTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['faq']; + + /** + * A user with permission to administer site configuration. + * + * @var \Drupal\user\UserInterface + */ + protected $user; + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $this->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('<front>')); + $this->assertSession()->statusCodeEquals(200); + } + +} |