diff options
Diffstat (limited to 'modules/esha/onlinecourse')
19 files changed, 518 insertions, 0 deletions
diff --git a/modules/esha/onlinecourse/composer.json b/modules/esha/onlinecourse/composer.json new file mode 100644 index 0000000..9d4a149 --- /dev/null +++ b/modules/esha/onlinecourse/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/onlinecourse", + "type": "drupal-module", + "description": "My Awesome Module", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/onlinecourse", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/onlinecourse", + "source": "http://cgit.drupalcode.org/onlinecourse" + }, + "require": { } +} diff --git a/modules/esha/onlinecourse/config/install/core.entity_form_display.node.online_course.default.yml b/modules/esha/onlinecourse/config/install/core.entity_form_display.node.online_course.default.yml new file mode 100644 index 0000000..86b561a --- /dev/null +++ b/modules/esha/onlinecourse/config/install/core.entity_form_display.node.online_course.default.yml @@ -0,0 +1,99 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.online_course.field_faculty_name + - field.field.node.online_course.field_link_to_cour + - field.field.node.online_course.field_offered_by + - node.type.online_course + module: + - link + - path +id: node.online_course.default +targetEntityType: node +bundle: online_course +mode: default +content: + created: + type: datetime_timestamp + weight: 10 + region: content + settings: { } + third_party_settings: { } + field_faculty_name: + weight: 122 + settings: + match_operator: CONTAINS + size: 60 + placeholder: '' + third_party_settings: { } + type: entity_reference_autocomplete + region: content + field_link_to_cour: + weight: 124 + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + type: link_default + region: content + field_offered_by: + weight: 123 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + 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/esha/onlinecourse/config/install/core.entity_view_display.node.online_course.default.yml b/modules/esha/onlinecourse/config/install/core.entity_view_display.node.online_course.default.yml new file mode 100644 index 0000000..a774ce8 --- /dev/null +++ b/modules/esha/onlinecourse/config/install/core.entity_view_display.node.online_course.default.yml @@ -0,0 +1,51 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.online_course.field_faculty_name + - field.field.node.online_course.field_link_to_cour + - field.field.node.online_course.field_offered_by + - node.type.online_course + module: + - link + - user +id: node.online_course.default +targetEntityType: node +bundle: online_course +mode: default +content: + field_faculty_name: + weight: 102 + label: above + settings: + link: true + third_party_settings: { } + type: entity_reference_label + region: content + field_link_to_cour: + weight: 104 + label: above + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + type: link + region: content + field_offered_by: + weight: 103 + label: above + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content + links: + weight: 100 + settings: { } + third_party_settings: { } + region: content +hidden: + langcode: true diff --git a/modules/esha/onlinecourse/config/install/core.entity_view_display.node.online_course.teaser.yml b/modules/esha/onlinecourse/config/install/core.entity_view_display.node.online_course.teaser.yml new file mode 100644 index 0000000..79dc5ec --- /dev/null +++ b/modules/esha/onlinecourse/config/install/core.entity_view_display.node.online_course.teaser.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.online_course.field_faculty_name + - field.field.node.online_course.field_offered_by + - node.type.online_course + module: + - user +id: node.online_course.teaser +targetEntityType: node +bundle: online_course +mode: teaser +content: + links: + weight: 100 + settings: { } + third_party_settings: { } + region: content +hidden: + field_faculty_name: true + field_offered_by: true + langcode: true diff --git a/modules/esha/onlinecourse/config/install/core.entity_view_mode.node.teaser.yml b/modules/esha/onlinecourse/config/install/core.entity_view_mode.node.teaser.yml new file mode 100644 index 0000000..fb7a35a --- /dev/null +++ b/modules/esha/onlinecourse/config/install/core.entity_view_mode.node.teaser.yml @@ -0,0 +1,12 @@ +uuid: eae4e8eb-df75-49ff-b350-c4bd59679b36 +langcode: en +status: true +dependencies: + module: + - node +_core: + default_config_hash: Mz9qWr1kUYK0mjRAGDsr5XS6PvtZ24en_7ndt-pyWe4 +id: node.teaser +label: Teaser +targetEntityType: node +cache: true diff --git a/modules/esha/onlinecourse/config/install/field.field.node.online_course.field_faculty_name.yml b/modules/esha/onlinecourse/config/install/field.field.node.online_course.field_faculty_name.yml new file mode 100644 index 0000000..c5ea1a1 --- /dev/null +++ b/modules/esha/onlinecourse/config/install/field.field.node.online_course.field_faculty_name.yml @@ -0,0 +1,27 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_faculty_name + - node.type.fac_page + - node.type.online_course +id: node.online_course.field_faculty_name +field_name: field_faculty_name +entity_type: node +bundle: online_course +label: 'Faculty name' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + handler: 'default:node' + handler_settings: + target_bundles: + fac_page: fac_page + sort: + field: _none + auto_create: false + auto_create_bundle: '' +field_type: entity_reference diff --git a/modules/esha/onlinecourse/config/install/field.field.node.online_course.field_link_to_cour.yml b/modules/esha/onlinecourse/config/install/field.field.node.online_course.field_link_to_cour.yml new file mode 100644 index 0000000..fddd4ed --- /dev/null +++ b/modules/esha/onlinecourse/config/install/field.field.node.online_course.field_link_to_cour.yml @@ -0,0 +1,22 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_link_to_cour + - node.type.online_course + module: + - link +id: node.online_course.field_link_to_cour +field_name: field_link_to_cour +entity_type: node +bundle: online_course +label: 'Link to Course' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + link_type: 17 + title: 1 +field_type: link diff --git a/modules/esha/onlinecourse/config/install/field.field.node.online_course.field_offered_by.yml b/modules/esha/onlinecourse/config/install/field.field.node.online_course.field_offered_by.yml new file mode 100644 index 0000000..973b204 --- /dev/null +++ b/modules/esha/onlinecourse/config/install/field.field.node.online_course.field_offered_by.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_offered_by + - node.type.online_course +id: node.online_course.field_offered_by +field_name: field_offered_by +entity_type: node +bundle: online_course +label: 'Offered By' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/modules/esha/onlinecourse/config/install/field.storage.node.field_faculty_name.yml b/modules/esha/onlinecourse/config/install/field.storage.node.field_faculty_name.yml new file mode 100644 index 0000000..d7653f8 --- /dev/null +++ b/modules/esha/onlinecourse/config/install/field.storage.node.field_faculty_name.yml @@ -0,0 +1,19 @@ +uuid: 7f80e5e4-d5da-49d4-8039-5b54fda033af +langcode: en +status: true +dependencies: + module: + - node +id: node.field_faculty_name +field_name: field_faculty_name +entity_type: node +type: entity_reference +settings: + target_type: node +module: core +locked: false +cardinality: -1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/esha/onlinecourse/config/install/field.storage.node.field_link_to_cour.yml b/modules/esha/onlinecourse/config/install/field.storage.node.field_link_to_cour.yml new file mode 100644 index 0000000..86d2592 --- /dev/null +++ b/modules/esha/onlinecourse/config/install/field.storage.node.field_link_to_cour.yml @@ -0,0 +1,19 @@ +uuid: 4e9dd460-14ae-4be0-a820-b3b2f040b0d3 +langcode: en +status: true +dependencies: + module: + - link + - node +id: node.field_link_to_cour +field_name: field_link_to_cour +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/esha/onlinecourse/config/install/field.storage.node.field_offered_by.yml b/modules/esha/onlinecourse/config/install/field.storage.node.field_offered_by.yml new file mode 100644 index 0000000..6cf5567 --- /dev/null +++ b/modules/esha/onlinecourse/config/install/field.storage.node.field_offered_by.yml @@ -0,0 +1,21 @@ +uuid: cc60ea6e-7263-43dd-bd49-b74ef089a323 +langcode: en +status: true +dependencies: + module: + - node +id: node.field_offered_by +field_name: field_offered_by +entity_type: node +type: string +settings: + max_length: 255 + is_ascii: false + case_sensitive: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/esha/onlinecourse/config/install/migrate_plus.migration.onlinecourse_sample.yml b/modules/esha/onlinecourse/config/install/migrate_plus.migration.onlinecourse_sample.yml new file mode 100644 index 0000000..8f8ec38 --- /dev/null +++ b/modules/esha/onlinecourse/config/install/migrate_plus.migration.onlinecourse_sample.yml @@ -0,0 +1,36 @@ +uuid: 7ab17b40-597e-411a-a750-23c138da7c6d +id: onlinecourse_sample +label: Courses +migration_group: default +source: + plugin: csv + # Full path to the file. + path: '/var/www/CSV/onlinecourse_sample.csv' + # Column delimiter. Comma (,) by default. + delimiter: ',' + # Field enclosure. Double quotation marks (") by default. + enclosure: '"' + # The number of rows at the beginning which are not data. + header_row_count: 1 + keys: + - id +process: + type: + plugin: default_value + default_value: online_course + title: title + field_link_to_cour: link + field_offered_by: offeredby + field_faculty_name: + - + plugin: explode + delimiter: '|' + source: names + - + plugin: entity_lookup + entity_type: node + bundle: fac_page +destination: + plugin: 'entity:node' + bundle: online_course +migration_dependencies: null diff --git a/modules/esha/onlinecourse/config/install/node.type.fac_page.yml b/modules/esha/onlinecourse/config/install/node.type.fac_page.yml new file mode 100644 index 0000000..47f8ffb --- /dev/null +++ b/modules/esha/onlinecourse/config/install/node.type.fac_page.yml @@ -0,0 +1,23 @@ +uuid: b7471e78-83f0-4359-9512-d4a8f02c2218 +langcode: en +status: true +dependencies: + enforced: + module: + - acadmix_faculty + module: + - menu_ui +third_party_settings: + menu_ui: + available_menus: + - main + parent: 'main:' +_core: + default_config_hash: yZnGgm-oTEuH3Qz8VcW49f94qFn-pYOYZdrX601an0U +name: 'Faculty Page' +type: fac_page +description: 'Content template for opening Faculty Page' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: false diff --git a/modules/esha/onlinecourse/config/install/node.type.online_course.yml b/modules/esha/onlinecourse/config/install/node.type.online_course.yml new file mode 100644 index 0000000..4f492e6 --- /dev/null +++ b/modules/esha/onlinecourse/config/install/node.type.online_course.yml @@ -0,0 +1,17 @@ +langcode: en +status: true +dependencies: + module: + - menu_ui +third_party_settings: + menu_ui: + available_menus: + - main + parent: 'main:' +name: 'Online Course' +type: online_course +description: '' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: false diff --git a/modules/esha/onlinecourse/onlinecourse.info.yml b/modules/esha/onlinecourse/onlinecourse.info.yml new file mode 100644 index 0000000..91191b6 --- /dev/null +++ b/modules/esha/onlinecourse/onlinecourse.info.yml @@ -0,0 +1,12 @@ +name: 'onlineCourse' +type: module +description: 'My Awesome Module' +core: 8.x +package: 'Custom' +dependencies: + - drupal:text + - drupal:link + - drupal:path + - drupal:user + - drupal:node + - drupal:menu_ui
\ No newline at end of file diff --git a/modules/esha/onlinecourse/onlinecourse.install b/modules/esha/onlinecourse/onlinecourse.install new file mode 100644 index 0000000..7469bb9 --- /dev/null +++ b/modules/esha/onlinecourse/onlinecourse.install @@ -0,0 +1,22 @@ + +<?php +/** +* Implements hook_uninstall(). +*/ +function onlinecourse_uninstall() { //<-- replace “welcome” with your module machine name + // Load services. + $queryFactory = \Drupal::service('entity.query'); + $nodeStorage = \Drupal::entityManager()->getStorage('node'); + + // Query all entity. + $query = $queryFactory->get('node') +// <-- replace event in below line with your content type machine name + ->condition('type', 'online_course'); + $nids = $query->execute(); + + // Delete entities. + if (!empty($nids)) { + $entities = $nodeStorage->loadMultiple($nids); + $nodeStorage->delete($entities); + } +} diff --git a/modules/esha/onlinecourse/onlinecourse.module b/modules/esha/onlinecourse/onlinecourse.module new file mode 100644 index 0000000..617de66 --- /dev/null +++ b/modules/esha/onlinecourse/onlinecourse.module @@ -0,0 +1,35 @@ +<?php + +/** + * @file + * Contains onlinecourse.module. + */ + +use Drupal\Core\Routing\RouteMatchInterface; + +/** + * Implements hook_help(). + */ +function onlinecourse_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + // Main module help for the onlinecourse module. + case 'help.page.onlinecourse': + $output = ''; + $output .= '<h3>' . t('About') . '</h3>'; + $output .= '<p>' . t('My Awesome Module') . '</p>'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function onlinecourse_theme() { + return [ + 'onlinecourse' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/esha/onlinecourse/templates/onlinecourse.html.twig b/modules/esha/onlinecourse/templates/onlinecourse.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/esha/onlinecourse/templates/onlinecourse.html.twig @@ -0,0 +1 @@ +<!-- Add you custom twig html here -->
\ No newline at end of file diff --git a/modules/esha/onlinecourse/tests/src/Functional/LoadTest.php b/modules/esha/onlinecourse/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..a25c263 --- /dev/null +++ b/modules/esha/onlinecourse/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +<?php + +namespace Drupal\Tests\onlinecourse\Functional; + +use Drupal\Core\Url; +use Drupal\Tests\BrowserTestBase; + +/** + * Simple test to ensure that main page loads with module enabled. + * + * @group onlinecourse + */ +class LoadTest extends BrowserTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['onlinecourse']; + + /** + * 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); + } + +} |