diff options
author | Nitesh Kumar Sinha | 2019-07-02 13:32:41 +0530 |
---|---|---|
committer | GitHub | 2019-07-02 13:32:41 +0530 |
commit | 40040427eb696b443a52db952ce6915d3ee72a97 (patch) | |
tree | 5dde0580ac282768aeb48226e7d10c2e3f691172 /modules/fahad/article | |
parent | 222f1780ed0f5c3536392df3236284d3a9ab5405 (diff) | |
parent | 5f6ba9cf4aee260e4192f194ed14d3bc9dd1b467 (diff) | |
download | acadmix_distribution-40040427eb696b443a52db952ce6915d3ee72a97.tar.gz acadmix_distribution-40040427eb696b443a52db952ce6915d3ee72a97.tar.bz2 acadmix_distribution-40040427eb696b443a52db952ce6915d3ee72a97.zip |
Merge pull request #6 from fahad-israr/master
Fahad: Custom Module Added
Diffstat (limited to 'modules/fahad/article')
-rw-r--r-- | modules/fahad/article/article.info.yml | 16 | ||||
-rw-r--r-- | modules/fahad/article/article.module | 35 | ||||
-rw-r--r-- | modules/fahad/article/composer.json | 14 | ||||
-rw-r--r-- | modules/fahad/article/config/install/field.storage.node.field_article_link.yml | 22 | ||||
-rw-r--r-- | modules/fahad/article/templates/article.html.twig | 1 | ||||
-rw-r--r-- | modules/fahad/article/tests/src/Functional/LoadTest.php | 46 |
6 files changed, 134 insertions, 0 deletions
diff --git a/modules/fahad/article/article.info.yml b/modules/fahad/article/article.info.yml new file mode 100644 index 0000000..49c0771 --- /dev/null +++ b/modules/fahad/article/article.info.yml @@ -0,0 +1,16 @@ +name: 'article' +type: module +description: 'My Awesome Module' +core: 8.x +package: 'Custom' +dependencies: + - drupal:comment + - drupal:image + - drupal:link + - drupal:path + - drupal:text + - drupal:user + - drupal:node + - drupal:taxonomy + +
\ No newline at end of file diff --git a/modules/fahad/article/article.module b/modules/fahad/article/article.module new file mode 100644 index 0000000..f367abe --- /dev/null +++ b/modules/fahad/article/article.module @@ -0,0 +1,35 @@ +<?php + +/** + * @file + * Contains article.module. + */ + +use Drupal\Core\Routing\RouteMatchInterface; + +/** + * Implements hook_help(). + */ +function article_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + // Main module help for the article module. + case 'help.page.article': + $output = ''; + $output .= '<h3>' . t('About') . '</h3>'; + $output .= '<p>' . t('My Awesome Module') . '</p>'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function article_theme() { + return [ + 'article' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/fahad/article/composer.json b/modules/fahad/article/composer.json new file mode 100644 index 0000000..7088212 --- /dev/null +++ b/modules/fahad/article/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/article", + "type": "drupal-module", + "description": "My Awesome Module", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/article", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/article", + "source": "http://cgit.drupalcode.org/article" + }, + "require": { } +} diff --git a/modules/fahad/article/config/install/field.storage.node.field_article_link.yml b/modules/fahad/article/config/install/field.storage.node.field_article_link.yml new file mode 100644 index 0000000..b8f5a5b --- /dev/null +++ b/modules/fahad/article/config/install/field.storage.node.field_article_link.yml @@ -0,0 +1,22 @@ +uuid: 1d56f0f0-900c-47bb-8b59-47f0c7c531c7 +langcode: en +status: true +dependencies: + module: + - link + - node + enforced: + module: + - article +id: node.field_article_link +field_name: field_article_link +entity_type: node +type: link +settings: { } +module: link +locked: false +cardinality: -1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/fahad/article/templates/article.html.twig b/modules/fahad/article/templates/article.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/fahad/article/templates/article.html.twig @@ -0,0 +1 @@ +<!-- Add you custom twig html here -->
\ No newline at end of file diff --git a/modules/fahad/article/tests/src/Functional/LoadTest.php b/modules/fahad/article/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..5607b01 --- /dev/null +++ b/modules/fahad/article/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +<?php + +namespace Drupal\Tests\article\Functional; + +use Drupal\Core\Url; +use Drupal\Tests\BrowserTestBase; + +/** + * Simple test to ensure that main page loads with module enabled. + * + * @group article + */ +class LoadTest extends BrowserTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['article']; + + /** + * 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); + } + +} |