diff options
Diffstat (limited to 'modules/mansimran/chapters')
20 files changed, 652 insertions, 0 deletions
diff --git a/modules/mansimran/chapters/chapters.info.yml b/modules/mansimran/chapters/chapters.info.yml new file mode 100644 index 0000000..8502c2e --- /dev/null +++ b/modules/mansimran/chapters/chapters.info.yml @@ -0,0 +1,16 @@ +name: 'chapters' +type: module +description: 'My Awesome Module' +core: 8.x +package: 'Custom' +dependencies: + - drupal:node + - drupal:menu_ui + - drupal:file + - drupal:image + - drupal:link + - drupal:taxonomy + - drupal:path + - drupal:text + - drupal:user + diff --git a/modules/mansimran/chapters/chapters.module b/modules/mansimran/chapters/chapters.module new file mode 100644 index 0000000..9d6c121 --- /dev/null +++ b/modules/mansimran/chapters/chapters.module @@ -0,0 +1,35 @@ +<?php + +/** + * @file + * Contains chapters.module. + */ + +use Drupal\Core\Routing\RouteMatchInterface; + +/** + * Implements hook_help(). + */ +function chapters_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + // Main module help for the chapters module. + case 'help.page.chapters': + $output = ''; + $output .= '<h3>' . t('About') . '</h3>'; + $output .= '<p>' . t('My Awesome Module') . '</p>'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function chapters_theme() { + return [ + 'chapters' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/mansimran/chapters/chapters.routing.yml b/modules/mansimran/chapters/chapters.routing.yml new file mode 100644 index 0000000..4f87132 --- /dev/null +++ b/modules/mansimran/chapters/chapters.routing.yml @@ -0,0 +1,8 @@ + +chapters.chapters_controller_hello: + path: '/chapters/hello/{name}' + defaults: + _controller: '\Drupal\chapters\Controller\chaptersController::hello' + _title: 'chaptersController' + requirements: + _permission: 'access content' diff --git a/modules/mansimran/chapters/composer.json b/modules/mansimran/chapters/composer.json new file mode 100644 index 0000000..02f466f --- /dev/null +++ b/modules/mansimran/chapters/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/chapters", + "type": "drupal-module", + "description": "My Awesome Module", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/chapters", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/chapters", + "source": "http://cgit.drupalcode.org/chapters" + }, + "require": { } +} diff --git a/modules/mansimran/chapters/config/install/core.entity_form_display.node.student_chapter.default.yml b/modules/mansimran/chapters/config/install/core.entity_form_display.node.student_chapter.default.yml new file mode 100644 index 0000000..a58312d --- /dev/null +++ b/modules/mansimran/chapters/config/install/core.entity_form_display.node.student_chapter.default.yml @@ -0,0 +1,115 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.student_chapter.body + - field.field.node.student_chapter.field_chapter_category + - field.field.node.student_chapter.field_chapter_facebook_link + - field.field.node.student_chapter.field_chapter_logo + - image.style.thumbnail + - node.type.student_chapter + module: + - image + - link + - path + - text + enforced: + module: + - chapters +id: node.student_chapter.default +targetEntityType: node +bundle: student_chapter +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: { } + field_chapter_category: + weight: 125 + settings: + match_operator: CONTAINS + size: 60 + placeholder: '' + third_party_settings: { } + type: entity_reference_autocomplete + region: content + field_chapter_facebook_link: + weight: 122 + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + type: link_default + region: content + field_chapter_logo: + weight: 123 + settings: + progress_indicator: throbber + preview_image_style: thumbnail + third_party_settings: { } + type: image_image + region: content + 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/mansimran/chapters/config/install/core.entity_view_display.node.student_chapter.default.yml b/modules/mansimran/chapters/config/install/core.entity_view_display.node.student_chapter.default.yml new file mode 100644 index 0000000..40b8ba2 --- /dev/null +++ b/modules/mansimran/chapters/config/install/core.entity_view_display.node.student_chapter.default.yml @@ -0,0 +1,65 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.student_chapter.body + - field.field.node.student_chapter.field_chapter_category + - field.field.node.student_chapter.field_chapter_facebook_link + - field.field.node.student_chapter.field_chapter_logo + - node.type.student_chapter + module: + - image + - link + - text + - user + enforced: + module: + - chapters +id: node.student_chapter.default +targetEntityType: node +bundle: student_chapter +mode: default +content: + body: + label: hidden + type: text_default + weight: 101 + settings: { } + third_party_settings: { } + region: content + field_chapter_category: + weight: 105 + label: above + settings: + link: true + third_party_settings: { } + type: entity_reference_label + region: content + field_chapter_facebook_link: + weight: 103 + label: above + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + type: link + region: content + field_chapter_logo: + weight: 102 + label: above + settings: + image_style: '' + image_link: '' + third_party_settings: { } + type: image + region: content + links: + weight: 100 + region: content + settings: { } + third_party_settings: { } +hidden: + langcode: true diff --git a/modules/mansimran/chapters/config/install/core.entity_view_display.node.student_chapter.teaser.yml b/modules/mansimran/chapters/config/install/core.entity_view_display.node.student_chapter.teaser.yml new file mode 100644 index 0000000..fc1b662 --- /dev/null +++ b/modules/mansimran/chapters/config/install/core.entity_view_display.node.student_chapter.teaser.yml @@ -0,0 +1,39 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.student_chapter.body + - field.field.node.student_chapter.field_chapter_category + - field.field.node.student_chapter.field_chapter_facebook_link + - field.field.node.student_chapter.field_chapter_logo + - node.type.student_chapter + module: + - text + - user + enforced: + module: + - chapters +id: node.student_chapter.teaser +targetEntityType: node +bundle: student_chapter +mode: teaser +content: + body: + label: hidden + type: text_summary_or_trimmed + weight: 100 + settings: + trim_length: 600 + third_party_settings: { } + region: content + links: + weight: 101 + region: content + settings: { } + third_party_settings: { } +hidden: + field_chapter_category: true + field_chapter_facebook_link: true + field_chapter_logo: true + langcode: true diff --git a/modules/mansimran/chapters/config/install/field.field.node.student_chapter.body.yml b/modules/mansimran/chapters/config/install/field.field.node.student_chapter.body.yml new file mode 100644 index 0000000..06c5cb1 --- /dev/null +++ b/modules/mansimran/chapters/config/install/field.field.node.student_chapter.body.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.body + - node.type.student_chapter + module: + - text + enforced: + module: + - chapters +id: node.student_chapter.body +field_name: body +entity_type: node +bundle: student_chapter +label: Body +description: 'Description of various chapters in VIT' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: + display_summary: true +field_type: text_with_summary diff --git a/modules/mansimran/chapters/config/install/field.field.node.student_chapter.field_chapter_category.yml b/modules/mansimran/chapters/config/install/field.field.node.student_chapter.field_chapter_category.yml new file mode 100644 index 0000000..724f975 --- /dev/null +++ b/modules/mansimran/chapters/config/install/field.field.node.student_chapter.field_chapter_category.yml @@ -0,0 +1,31 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_chapter_category + - node.type.student_chapter + - taxonomy.vocabulary.chapter_category + enforced: + module: + - chapters +id: node.student_chapter.field_chapter_category +field_name: field_chapter_category +entity_type: node +bundle: student_chapter +label: 'chapter category' +description: 'chapter category' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + handler: 'default:taxonomy_term' + handler_settings: + target_bundles: + chapter_category: chapter_category + sort: + field: name + direction: asc + auto_create: false + auto_create_bundle: '' +field_type: entity_reference diff --git a/modules/mansimran/chapters/config/install/field.field.node.student_chapter.field_chapter_facebook_link.yml b/modules/mansimran/chapters/config/install/field.field.node.student_chapter.field_chapter_facebook_link.yml new file mode 100644 index 0000000..7b40ea8 --- /dev/null +++ b/modules/mansimran/chapters/config/install/field.field.node.student_chapter.field_chapter_facebook_link.yml @@ -0,0 +1,25 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_chapter_facebook_link + - node.type.student_chapter + module: + - link + enforced: + module: + - chapters +id: node.student_chapter.field_chapter_facebook_link +field_name: field_chapter_facebook_link +entity_type: node +bundle: student_chapter +label: 'Chapter Facebook Link' +description: 'Chapter Facebook Link' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + link_type: 17 + title: 1 +field_type: link diff --git a/modules/mansimran/chapters/config/install/field.field.node.student_chapter.field_chapter_logo.yml b/modules/mansimran/chapters/config/install/field.field.node.student_chapter.field_chapter_logo.yml new file mode 100644 index 0000000..000acc8 --- /dev/null +++ b/modules/mansimran/chapters/config/install/field.field.node.student_chapter.field_chapter_logo.yml @@ -0,0 +1,40 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_chapter_logo + - node.type.student_chapter + module: + - image + enforced: + module: + - chapters +id: node.student_chapter.field_chapter_logo +field_name: field_chapter_logo +entity_type: node +bundle: student_chapter +label: 'chapter logo' +description: 'chapter logo' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: chapters + file_extensions: 'png gif jpg jpeg' + max_filesize: '' + max_resolution: '' + min_resolution: '' + alt_field: true + alt_field_required: true + title_field: false + title_field_required: false + default_image: + uuid: '' + alt: '' + title: '' + width: null + height: null + handler: 'default:file' + handler_settings: { } +field_type: image diff --git a/modules/mansimran/chapters/config/install/field.storage.node.field_chapter_category.yml b/modules/mansimran/chapters/config/install/field.storage.node.field_chapter_category.yml new file mode 100644 index 0000000..47660d5 --- /dev/null +++ b/modules/mansimran/chapters/config/install/field.storage.node.field_chapter_category.yml @@ -0,0 +1,23 @@ +uuid: d8af11ea-283d-4e9c-9e76-abbfeafbb339 +langcode: en +status: true +dependencies: + module: + - node + - taxonomy + enforced: + module: + - chapters +id: node.field_chapter_category +field_name: field_chapter_category +entity_type: node +type: entity_reference +settings: + target_type: taxonomy_term +module: core +locked: false +cardinality: -1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/mansimran/chapters/config/install/field.storage.node.field_chapter_facebook_link.yml b/modules/mansimran/chapters/config/install/field.storage.node.field_chapter_facebook_link.yml new file mode 100644 index 0000000..84d5ed6 --- /dev/null +++ b/modules/mansimran/chapters/config/install/field.storage.node.field_chapter_facebook_link.yml @@ -0,0 +1,22 @@ +uuid: f93b9a5d-516b-441c-a733-cf091824d0e6 +langcode: en +status: true +dependencies: + module: + - link + - node + enforced: + module: + - chapters +id: node.field_chapter_facebook_link +field_name: field_chapter_facebook_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/mansimran/chapters/config/install/field.storage.node.field_chapter_logo.yml b/modules/mansimran/chapters/config/install/field.storage.node.field_chapter_logo.yml new file mode 100644 index 0000000..e949317 --- /dev/null +++ b/modules/mansimran/chapters/config/install/field.storage.node.field_chapter_logo.yml @@ -0,0 +1,33 @@ +uuid: 84d48b0a-5d4a-439e-a308-8c3b2eb9cd4a +langcode: en +status: true +dependencies: + module: + - file + - image + - node + enforced: + module: + - chapters +id: node.field_chapter_logo +field_name: field_chapter_logo +entity_type: node +type: image +settings: + uri_scheme: public + default_image: + uuid: '' + alt: '' + title: '' + width: null + height: null + target_type: file + display_field: false + display_default: false +module: image +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/mansimran/chapters/config/install/migrate_plus.migration.chapters_1.yml b/modules/mansimran/chapters/config/install/migrate_plus.migration.chapters_1.yml new file mode 100644 index 0000000..6b70fa9 --- /dev/null +++ b/modules/mansimran/chapters/config/install/migrate_plus.migration.chapters_1.yml @@ -0,0 +1,58 @@ +uuid: 9cfc3d24-5f29-4a18-9ab1-c0b86b9e8728 +langcode: en +id: chapters_1 +status: true +class: null +field_plugin_method: null +cck_plugin_method: null +migration_tags: + - CSV +migration_group: default +label: 'chapters_csv_import1' +source: + plugin: csv + path: /home/mansimran/Desktop/mansimran1/chapters.csv + delimiter: ',' + enclosure: '"' + header_row_count: 1 + keys: + - id + constants: + file_source: /var/www/migrationdata/chapters + file_dest: 'public://chapters/' +process: + type: + plugin: default_value + default_value: student_chapter + source_path: + - + plugin: skip_on_empty + method: process + source: chapter_logo + - + plugin: concat + delimiter: / + source: + - constants/file_source + - chapter_logo + title: title + body/value: body + body/format: + plugin: default_value + default_value: basic_html + field_chapter_category: + plugin: entity_lookup + entity_type: taxonomy_term + bundle: chapter_category + source: chapter_category + field_chapter_logo: + plugin: file_import + source: '@source_path' + destination: constants/file_dest + field_chapter_facebook_link/uri: chapter_facebook_link +destination: + plugin: 'entity:node' + bundle: student_chapter +migration_dependencies: + required: { } + optional: { }
\ No newline at end of file diff --git a/modules/mansimran/chapters/config/install/node.type.student_chapter.yml b/modules/mansimran/chapters/config/install/node.type.student_chapter.yml new file mode 100644 index 0000000..51f8c08 --- /dev/null +++ b/modules/mansimran/chapters/config/install/node.type.student_chapter.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - menu_ui + enforced: + module: + - chapters +third_party_settings: + menu_ui: + available_menus: + - main + parent: 'main:' +name: 'Student Chapters' +type: student_chapter +description: 'List of student chapters in VIT' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: false diff --git a/modules/mansimran/chapters/config/install/taxonomy.vocabulary.chapter_category.yml b/modules/mansimran/chapters/config/install/taxonomy.vocabulary.chapter_category.yml new file mode 100644 index 0000000..a357ac9 --- /dev/null +++ b/modules/mansimran/chapters/config/install/taxonomy.vocabulary.chapter_category.yml @@ -0,0 +1,12 @@ +uuid: 8dfa8ec9-056f-423c-8c93-abfc232735c3 +langcode: en +status: true +dependencies: + enforced: + module: + - chapters +name: 'Chapter category' +vid: chapter_category +description: 'Chapter category' +hierarchy: 0 +weight: 0 diff --git a/modules/mansimran/chapters/src/Controller/chaptersController.php b/modules/mansimran/chapters/src/Controller/chaptersController.php new file mode 100644 index 0000000..ed09230 --- /dev/null +++ b/modules/mansimran/chapters/src/Controller/chaptersController.php @@ -0,0 +1,25 @@ +<?php + +namespace Drupal\chapters\Controller; + +use Drupal\Core\Controller\ControllerBase; + +/** + * Class chaptersController. + */ +class chaptersController extends ControllerBase { + + /** + * Hello. + * + * @return string + * Return Hello string. + */ + public function hello($name) { + return [ + '#type' => 'markup', + '#markup' => $this->t('Implement method: hello with parameter(s): $name'), + ]; + } + +} diff --git a/modules/mansimran/chapters/templates/chapters.html.twig b/modules/mansimran/chapters/templates/chapters.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/mansimran/chapters/templates/chapters.html.twig @@ -0,0 +1 @@ +<!-- Add you custom twig html here -->
\ No newline at end of file diff --git a/modules/mansimran/chapters/tests/src/Functional/LoadTest.php b/modules/mansimran/chapters/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..d0d8948 --- /dev/null +++ b/modules/mansimran/chapters/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +<?php + +namespace Drupal\Tests\chapters\Functional; + +use Drupal\Core\Url; +use Drupal\Tests\BrowserTestBase; + +/** + * Simple test to ensure that main page loads with module enabled. + * + * @group chapters + */ +class LoadTest extends BrowserTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['chapters']; + + /** + * 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); + } + +} |