diff options
author | Esha | 2019-07-02 12:42:54 +0530 |
---|---|---|
committer | Esha | 2019-07-02 12:43:10 +0530 |
commit | 141ce8c97abe36f1f8bb06a38623e93563d6c618 (patch) | |
tree | 2086c9224072aa7b917da20487b232eb2ef0666e /modules/esha/programs | |
parent | 847360bf5ac011771dc013677542ece7b356a528 (diff) | |
download | acadmix_distribution-141ce8c97abe36f1f8bb06a38623e93563d6c618.tar.gz acadmix_distribution-141ce8c97abe36f1f8bb06a38623e93563d6c618.tar.bz2 acadmix_distribution-141ce8c97abe36f1f8bb06a38623e93563d6c618.zip |
Custom modules
Diffstat (limited to 'modules/esha/programs')
25 files changed, 793 insertions, 0 deletions
diff --git a/modules/esha/programs/composer.json b/modules/esha/programs/composer.json new file mode 100644 index 0000000..9889ab7 --- /dev/null +++ b/modules/esha/programs/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/programs", + "type": "drupal-module", + "description": "Module for Content Type Programs Offered", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/programs", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/programs", + "source": "http://cgit.drupalcode.org/programs" + }, + "require": { } +} diff --git a/modules/esha/programs/config/install/core.entity_form_display.node.p.default.yml b/modules/esha/programs/config/install/core.entity_form_display.node.p.default.yml new file mode 100644 index 0000000..a01057d --- /dev/null +++ b/modules/esha/programs/config/install/core.entity_form_display.node.p.default.yml @@ -0,0 +1,124 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.p.body + - field.field.node.p.field_courseware + - field.field.node.p.field_curriculum + - field.field.node.p.field_degree + - field.field.node.p.field_lesson_plan + - field.field.node.p.field_objectives + - node.type.p + module: + - file + - path + - text +id: node.p.default +targetEntityType: node +bundle: p +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_courseware: + weight: 128 + settings: + progress_indicator: throbber + third_party_settings: { } + type: file_generic + region: content + field_curriculum: + weight: 123 + settings: + progress_indicator: throbber + third_party_settings: { } + type: file_generic + region: content + field_degree: + weight: 125 + settings: + match_operator: CONTAINS + size: 60 + placeholder: '' + third_party_settings: { } + type: entity_reference_autocomplete + region: content + field_lesson_plan: + weight: 129 + settings: + progress_indicator: throbber + third_party_settings: { } + type: file_generic + region: content + field_objectives: + weight: 127 + settings: + progress_indicator: throbber + third_party_settings: { } + type: file_generic + 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/programs/config/install/core.entity_view_display.node.p.default.yml b/modules/esha/programs/config/install/core.entity_view_display.node.p.default.yml new file mode 100644 index 0000000..3c58d93 --- /dev/null +++ b/modules/esha/programs/config/install/core.entity_view_display.node.p.default.yml @@ -0,0 +1,74 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.p.body + - field.field.node.p.field_courseware + - field.field.node.p.field_curriculum + - field.field.node.p.field_degree + - field.field.node.p.field_lesson_plan + - field.field.node.p.field_objectives + - node.type.p + module: + - file + - text + - user +id: node.p.default +targetEntityType: node +bundle: p +mode: default +content: + body: + label: hidden + type: text_default + weight: 101 + settings: { } + third_party_settings: { } + region: content + field_courseware: + weight: 108 + label: above + settings: + use_description_as_link_text: true + third_party_settings: { } + type: file_default + region: content + field_curriculum: + weight: 103 + label: above + settings: + use_description_as_link_text: true + third_party_settings: { } + type: file_default + region: content + field_degree: + weight: 105 + label: above + settings: + link: true + third_party_settings: { } + type: entity_reference_label + region: content + field_lesson_plan: + weight: 109 + label: above + settings: + use_description_as_link_text: true + third_party_settings: { } + type: file_default + region: content + field_objectives: + weight: 107 + label: above + settings: + use_description_as_link_text: true + third_party_settings: { } + type: file_default + region: content + links: + weight: 100 + settings: { } + third_party_settings: { } + region: content +hidden: + langcode: true diff --git a/modules/esha/programs/config/install/core.entity_view_display.node.p.teaser.yml b/modules/esha/programs/config/install/core.entity_view_display.node.p.teaser.yml new file mode 100644 index 0000000..0b08722 --- /dev/null +++ b/modules/esha/programs/config/install/core.entity_view_display.node.p.teaser.yml @@ -0,0 +1,30 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.p.body + - node.type.p + module: + - text + - user +id: node.p.teaser +targetEntityType: node +bundle: p +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/esha/programs/config/install/field.field.node.p.body.yml b/modules/esha/programs/config/install/field.field.node.p.body.yml new file mode 100644 index 0000000..9e25420 --- /dev/null +++ b/modules/esha/programs/config/install/field.field.node.p.body.yml @@ -0,0 +1,21 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.body + - node.type.p + module: + - text +id: node.p.body +field_name: body +entity_type: node +bundle: p +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/esha/programs/config/install/field.field.node.p.field_courseware.yml b/modules/esha/programs/config/install/field.field.node.p.field_courseware.yml new file mode 100644 index 0000000..4e4b22c --- /dev/null +++ b/modules/esha/programs/config/install/field.field.node.p.field_courseware.yml @@ -0,0 +1,26 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_courseware + - node.type.p + module: + - file +id: node.p.field_courseware +field_name: field_courseware +entity_type: node +bundle: p +label: Courseware +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: '[date:custom:Y]-[date:custom:m]' + file_extensions: pdf + max_filesize: '' + description_field: false + handler: 'default:file' + handler_settings: { } +field_type: file diff --git a/modules/esha/programs/config/install/field.field.node.p.field_curriculum.yml b/modules/esha/programs/config/install/field.field.node.p.field_curriculum.yml new file mode 100644 index 0000000..f782e17 --- /dev/null +++ b/modules/esha/programs/config/install/field.field.node.p.field_curriculum.yml @@ -0,0 +1,26 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_curriculum + - node.type.p + module: + - file +id: node.p.field_curriculum +field_name: field_curriculum +entity_type: node +bundle: p +label: Curriculum +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: '[date:custom:Y]-[date:custom:m]' + file_extensions: pdf + max_filesize: '12 MB' + description_field: false + handler: 'default:file' + handler_settings: { } +field_type: file diff --git a/modules/esha/programs/config/install/field.field.node.p.field_degree.yml b/modules/esha/programs/config/install/field.field.node.p.field_degree.yml new file mode 100644 index 0000000..06ff5f0 --- /dev/null +++ b/modules/esha/programs/config/install/field.field.node.p.field_degree.yml @@ -0,0 +1,28 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_degree + - node.type.p + - taxonomy.vocabulary.offered_programs +id: node.p.field_degree +field_name: field_degree +entity_type: node +bundle: p +label: Degree +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + handler: 'default:taxonomy_term' + handler_settings: + target_bundles: + offered_programs: offered_programs + sort: + field: name + direction: asc + auto_create: false + auto_create_bundle: '' +field_type: entity_reference diff --git a/modules/esha/programs/config/install/field.field.node.p.field_lesson_plan.yml b/modules/esha/programs/config/install/field.field.node.p.field_lesson_plan.yml new file mode 100644 index 0000000..29229ab --- /dev/null +++ b/modules/esha/programs/config/install/field.field.node.p.field_lesson_plan.yml @@ -0,0 +1,26 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_lesson_plan + - node.type.p + module: + - file +id: node.p.field_lesson_plan +field_name: field_lesson_plan +entity_type: node +bundle: p +label: 'Lesson Plan' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: '[date:custom:Y]-[date:custom:m]' + file_extensions: pdf + max_filesize: '' + description_field: false + handler: 'default:file' + handler_settings: { } +field_type: file diff --git a/modules/esha/programs/config/install/field.field.node.p.field_objectives.yml b/modules/esha/programs/config/install/field.field.node.p.field_objectives.yml new file mode 100644 index 0000000..fe10a5b --- /dev/null +++ b/modules/esha/programs/config/install/field.field.node.p.field_objectives.yml @@ -0,0 +1,26 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_objectives + - node.type.p + module: + - file +id: node.p.field_objectives +field_name: field_objectives +entity_type: node +bundle: p +label: Objectives +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: '[date:custom:Y]-[date:custom:m]' + file_extensions: pdf + max_filesize: '' + description_field: false + handler: 'default:file' + handler_settings: { } +field_type: file diff --git a/modules/esha/programs/config/install/field.storage.node.field_courseware.yml b/modules/esha/programs/config/install/field.storage.node.field_courseware.yml new file mode 100644 index 0000000..ce75fe2 --- /dev/null +++ b/modules/esha/programs/config/install/field.storage.node.field_courseware.yml @@ -0,0 +1,23 @@ +uuid: 4f345cc8-3a42-45bc-8224-5e33536cd339 +langcode: en +status: true +dependencies: + module: + - file + - node +id: node.field_courseware +field_name: field_courseware +entity_type: node +type: file +settings: + display_field: false + display_default: false + uri_scheme: public + target_type: file +module: file +locked: false +cardinality: -1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/esha/programs/config/install/field.storage.node.field_curriculum.yml b/modules/esha/programs/config/install/field.storage.node.field_curriculum.yml new file mode 100644 index 0000000..50b7f5b --- /dev/null +++ b/modules/esha/programs/config/install/field.storage.node.field_curriculum.yml @@ -0,0 +1,23 @@ +uuid: 37ea26ab-f120-4e68-9a51-af20519bb867 +langcode: en +status: true +dependencies: + module: + - file + - node +id: node.field_curriculum +field_name: field_curriculum +entity_type: node +type: file +settings: + display_field: false + display_default: false + uri_scheme: public + target_type: file +module: file +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/esha/programs/config/install/field.storage.node.field_degree.yml b/modules/esha/programs/config/install/field.storage.node.field_degree.yml new file mode 100644 index 0000000..a3c9c4c --- /dev/null +++ b/modules/esha/programs/config/install/field.storage.node.field_degree.yml @@ -0,0 +1,20 @@ +uuid: 17870542-92b4-4097-9fd7-2ff5e2aedfcf +langcode: en +status: true +dependencies: + module: + - node + - taxonomy +id: node.field_degree +field_name: field_degree +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/esha/programs/config/install/field.storage.node.field_lesson_plan.yml b/modules/esha/programs/config/install/field.storage.node.field_lesson_plan.yml new file mode 100644 index 0000000..45dabec --- /dev/null +++ b/modules/esha/programs/config/install/field.storage.node.field_lesson_plan.yml @@ -0,0 +1,23 @@ +uuid: bb5ebaad-6106-4cce-abcf-7ed7fff8c220 +langcode: en +status: true +dependencies: + module: + - file + - node +id: node.field_lesson_plan +field_name: field_lesson_plan +entity_type: node +type: file +settings: + display_field: false + display_default: false + uri_scheme: public + target_type: file +module: file +locked: false +cardinality: -1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/esha/programs/config/install/field.storage.node.field_objectives.yml b/modules/esha/programs/config/install/field.storage.node.field_objectives.yml new file mode 100644 index 0000000..f6c5857 --- /dev/null +++ b/modules/esha/programs/config/install/field.storage.node.field_objectives.yml @@ -0,0 +1,23 @@ +uuid: c65123d9-9165-4ecf-8d9d-86085fee2bcd +langcode: en +status: true +dependencies: + module: + - file + - node +id: node.field_objectives +field_name: field_objectives +entity_type: node +type: file +settings: + display_field: false + display_default: false + uri_scheme: public + target_type: file +module: file +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/esha/programs/config/install/node.type.p.yml b/modules/esha/programs/config/install/node.type.p.yml new file mode 100644 index 0000000..7978d3f --- /dev/null +++ b/modules/esha/programs/config/install/node.type.p.yml @@ -0,0 +1,17 @@ +langcode: en +status: true +dependencies: + module: + - menu_ui +third_party_settings: + menu_ui: + available_menus: + - main + parent: 'main:' +name: 'Programs Offered' +type: p +description: '' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: false diff --git a/modules/esha/programs/config/install/programs_offered.yaml b/modules/esha/programs/config/install/programs_offered.yaml new file mode 100644 index 0000000..1bd7001 --- /dev/null +++ b/modules/esha/programs/config/install/programs_offered.yaml @@ -0,0 +1,110 @@ +id: programs_offered +label: 'Programs Offered Import' +migration_group: default +source: + plugin: csv + path: '/var/www/CSV/programs_offered.csv' + delimiter: ',' + enclosure: '"' + header_row_count: 1 + keys: + - id + constants: + file_source: /var/www/programsoffered + file_dest1: 'public://programs_offered_courseware/' + file_dest2: 'public://programs_offered_lessonplan/' + file_dest3: 'public://programs_offered_curriculum/' + file_dest4: 'public://programs_offered_objectives/' +process: + type: + plugin: default_value + default_value: p + source_path1: + - + plugin: skip_on_empty + method: process + source: courseware + - + plugin: concat + delimiter: / + source: + - constants/file_source + - courseware + source_path2: + - + plugin: skip_on_empty + method: process + source: lessonplan + - + plugin: concat + delimiter: / + source: + - constants/file_source + - lessonplan + source_path3: + - + plugin: skip_on_empty + method: process + source: curriculum + - + plugin: concat + delimiter: / + source: + - constants/file_source + - curriculum + source_path4: + - + plugin: skip_on_empty + method: process + source: objectives + - + plugin: concat + delimiter: / + source: + - constants/file_source + - objectives + title: title + body/value: body + body/format: + - + plugin: default_value + default_value: basic_html + field_course_description: descr + field_courseware: + - + plugin: explode + delimiter: '|' + source: courseware + - + plugin: file_import + source: '@source_path1' + destination: constants/file_dest1 + field_lesson_plan: + - + plugin: explode + delimiter: '|' + source: lessonplan + - + plugin: file_import + source: '@source_path2' + destination: constants/file_dest2 + field_curriculum: + plugin: file_import + source: '@source_path3' + destination: constants/file_dest3 + field_objectives: + plugin: file_import + source: '@source_path4' + destination: constants/file_dest4 + field_degree: + plugin: entity_lookup + entity: taxonomy_term + bundle: offered_programs + source: programtype +destination: + plugin: 'entity:node' + plugin: 'entity:taxonomy_term' + bundle: p +migration_dependencies: + required: { } + optional: { } diff --git a/modules/esha/programs/config/install/taxonomy.vocabulary.offered_programs.yml b/modules/esha/programs/config/install/taxonomy.vocabulary.offered_programs.yml new file mode 100644 index 0000000..dfbc3c1 --- /dev/null +++ b/modules/esha/programs/config/install/taxonomy.vocabulary.offered_programs.yml @@ -0,0 +1,9 @@ +uuid: f55c9d15-5ce8-4e66-9682-df8d98bd0382 +langcode: en +status: true +dependencies: { } +name: 'Offered Programs' +vid: offered_programs +description: '' +hierarchy: 0 +weight: 0 diff --git a/modules/esha/programs/programs.info.yml b/modules/esha/programs/programs.info.yml new file mode 100644 index 0000000..284cbaa --- /dev/null +++ b/modules/esha/programs/programs.info.yml @@ -0,0 +1,13 @@ +name: 'programs' +type: module +description: 'Module for Content Type Programs Offered' +core: 8.x +package: 'Custom' +dependencies: + - drupal:file + - drupal:text + - drupal:user + - drupal:path + - drupal:node + - drupal:taxonomy + - drupal:menu_ui diff --git a/modules/esha/programs/programs.install b/modules/esha/programs/programs.install new file mode 100644 index 0000000..404bcba --- /dev/null +++ b/modules/esha/programs/programs.install @@ -0,0 +1,22 @@ + +<?php +/** +* Implements hook_uninstall(). +*/ +function programs_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', 'p'); + $nids = $query->execute(); + + // Delete entities. + if (!empty($nids)) { + $entities = $nodeStorage->loadMultiple($nids); + $nodeStorage->delete($entities); + } +} diff --git a/modules/esha/programs/programs.module b/modules/esha/programs/programs.module new file mode 100644 index 0000000..4909c34 --- /dev/null +++ b/modules/esha/programs/programs.module @@ -0,0 +1,35 @@ +<?php + +/** + * @file + * Contains programs.module. + */ + +use Drupal\Core\Routing\RouteMatchInterface; + +/** + * Implements hook_help(). + */ +function programs_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + // Main module help for the programs module. + case 'help.page.programs': + $output = ''; + $output .= '<h3>' . t('About') . '</h3>'; + $output .= '<p>' . t('Module for Content Type Programs Offered') . '</p>'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function programs_theme() { + return [ + 'programs' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/esha/programs/programs.routing.yml b/modules/esha/programs/programs.routing.yml new file mode 100644 index 0000000..240db1e --- /dev/null +++ b/modules/esha/programs/programs.routing.yml @@ -0,0 +1,8 @@ + +programs.programs_offered_controller_hello: + path: '/programs/hello/{name}' + defaults: + _controller: '\Drupal\programs\Controller\ProgramsOfferedController::hello' + _title: 'control' + requirements: + _permission: 'access content' diff --git a/modules/esha/programs/src/Controller/ProgramsOfferedController.php b/modules/esha/programs/src/Controller/ProgramsOfferedController.php new file mode 100644 index 0000000..7fe6888 --- /dev/null +++ b/modules/esha/programs/src/Controller/ProgramsOfferedController.php @@ -0,0 +1,25 @@ +<?php + +namespace Drupal\programs\Controller; + +use Drupal\Core\Controller\ControllerBase; + +/** + * Class ProgramsOfferedController. + */ +class ProgramsOfferedController 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/esha/programs/templates/programs.html.twig b/modules/esha/programs/templates/programs.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/esha/programs/templates/programs.html.twig @@ -0,0 +1 @@ +<!-- Add you custom twig html here -->
\ No newline at end of file diff --git a/modules/esha/programs/tests/src/Functional/LoadTest.php b/modules/esha/programs/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..8d3d7ab --- /dev/null +++ b/modules/esha/programs/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +<?php + +namespace Drupal\Tests\programs\Functional; + +use Drupal\Core\Url; +use Drupal\Tests\BrowserTestBase; + +/** + * Simple test to ensure that main page loads with module enabled. + * + * @group programs + */ +class LoadTest extends BrowserTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['programs']; + + /** + * 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); + } + +} |