diff options
Diffstat (limited to 'modules/esha/achievements')
19 files changed, 498 insertions, 0 deletions
diff --git a/modules/esha/achievements/achievements.info.yml b/modules/esha/achievements/achievements.info.yml new file mode 100644 index 0000000..3ed1004 --- /dev/null +++ b/modules/esha/achievements/achievements.info.yml @@ -0,0 +1,11 @@ +name: 'achievements' +type: module +description: 'Module for Achievements Placement Type' +core: 8.x +package: 'Custom' +dependencies: + - drupal:path + - drupal:user + - drupal:node + - drupal:taxonomy + - drupal:menu_ui diff --git a/modules/esha/achievements/achievements.install b/modules/esha/achievements/achievements.install new file mode 100644 index 0000000..4599c02 --- /dev/null +++ b/modules/esha/achievements/achievements.install @@ -0,0 +1,22 @@ + +<?php +/** +* Implements hook_uninstall(). +*/ +function achievements_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', 'achievements'); + $nids = $query->execute(); + + // Delete entities. + if (!empty($nids)) { + $entities = $nodeStorage->loadMultiple($nids); + $nodeStorage->delete($entities); + } +} diff --git a/modules/esha/achievements/achievements.module b/modules/esha/achievements/achievements.module new file mode 100644 index 0000000..76939d9 --- /dev/null +++ b/modules/esha/achievements/achievements.module @@ -0,0 +1,35 @@ +<?php + +/** + * @file + * Contains achievements.module. + */ + +use Drupal\Core\Routing\RouteMatchInterface; + +/** + * Implements hook_help(). + */ +function achievements_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + // Main module help for the achievements module. + case 'help.page.achievements': + $output = ''; + $output .= '<h3>' . t('About') . '</h3>'; + $output .= '<p>' . t('Module for Achievements Placement Type') . '</p>'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function achievements_theme() { + return [ + 'achievements' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/esha/achievements/achievements.routing.yml b/modules/esha/achievements/achievements.routing.yml new file mode 100644 index 0000000..e3f475c --- /dev/null +++ b/modules/esha/achievements/achievements.routing.yml @@ -0,0 +1,8 @@ + +achievements.achievement_controller_hello: + path: '/achievements/hello/{name}' + defaults: + _controller: '\Drupal\achievements\Controller\achievementController::hello' + _title: 'control' + requirements: + _permission: 'access content' diff --git a/modules/esha/achievements/composer.json b/modules/esha/achievements/composer.json new file mode 100644 index 0000000..34e90d8 --- /dev/null +++ b/modules/esha/achievements/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/achievements", + "type": "drupal-module", + "description": "Module for Achievements Placement Type", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/achievements", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/achievements", + "source": "http://cgit.drupalcode.org/achievements" + }, + "require": { } +} diff --git a/modules/esha/achievements/config/install/core.entity_form_display.node.achievements.default.yml b/modules/esha/achievements/config/install/core.entity_form_display.node.achievements.default.yml new file mode 100644 index 0000000..d77ebe5 --- /dev/null +++ b/modules/esha/achievements/config/install/core.entity_form_display.node.achievements.default.yml @@ -0,0 +1,92 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.achievements.field_achievement_description + - field.field.node.achievements.field_achievement_type + - node.type.achievements + module: + - path + enforced: + module: + - achievements +id: node.achievements.default +targetEntityType: node +bundle: achievements +mode: default +content: + created: + type: datetime_timestamp + weight: 10 + region: content + settings: { } + third_party_settings: { } + field_achievement_description: + weight: 123 + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + type: string_textarea + region: content + field_achievement_type: + weight: 122 + settings: + match_operator: CONTAINS + size: 60 + placeholder: '' + third_party_settings: { } + type: entity_reference_autocomplete + 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/achievements/config/install/core.entity_view_display.node.achievements.default.yml b/modules/esha/achievements/config/install/core.entity_view_display.node.achievements.default.yml new file mode 100644 index 0000000..1ed7439 --- /dev/null +++ b/modules/esha/achievements/config/install/core.entity_view_display.node.achievements.default.yml @@ -0,0 +1,39 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.achievements.field_achievement_description + - field.field.node.achievements.field_achievement_type + - node.type.achievements + module: + - user + enforced: + module: + - achievements +id: node.achievements.default +targetEntityType: node +bundle: achievements +mode: default +content: + field_achievement_description: + weight: 103 + label: above + settings: { } + third_party_settings: { } + type: basic_string + region: content + field_achievement_type: + weight: 102 + label: above + settings: + link: true + third_party_settings: { } + type: entity_reference_label + region: content + links: + weight: 100 + settings: { } + third_party_settings: { } + region: content +hidden: + langcode: true diff --git a/modules/esha/achievements/config/install/core.entity_view_display.node.achievements.teaser.yml b/modules/esha/achievements/config/install/core.entity_view_display.node.achievements.teaser.yml new file mode 100644 index 0000000..a10099d --- /dev/null +++ b/modules/esha/achievements/config/install/core.entity_view_display.node.achievements.teaser.yml @@ -0,0 +1,25 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.achievements.field_achievement_type + - node.type.achievements + module: + - user + enforced: + module: + - achievements +id: node.achievements.teaser +targetEntityType: node +bundle: achievements +mode: teaser +content: + links: + weight: 100 + settings: { } + third_party_settings: { } + region: content +hidden: + field_achievement_type: true + langcode: true diff --git a/modules/esha/achievements/config/install/core.entity_view_mode.node.teaser.yml b/modules/esha/achievements/config/install/core.entity_view_mode.node.teaser.yml new file mode 100644 index 0000000..83ada37 --- /dev/null +++ b/modules/esha/achievements/config/install/core.entity_view_mode.node.teaser.yml @@ -0,0 +1,15 @@ +uuid: eae4e8eb-df75-49ff-b350-c4bd59679b36 +langcode: en +status: true +dependencies: + module: + - node + enforced: + module: + - achievements +_core: + default_config_hash: Mz9qWr1kUYK0mjRAGDsr5XS6PvtZ24en_7ndt-pyWe4 +id: node.teaser +label: Teaser +targetEntityType: node +cache: true diff --git a/modules/esha/achievements/config/install/field.field.node.achievements.field_achievement_description.yml b/modules/esha/achievements/config/install/field.field.node.achievements.field_achievement_description.yml new file mode 100644 index 0000000..99b94d2 --- /dev/null +++ b/modules/esha/achievements/config/install/field.field.node.achievements.field_achievement_description.yml @@ -0,0 +1,21 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_achievement_description + - node.type.achievements + enforced: + module: + - achievements +id: node.achievements.field_achievement_description +field_name: field_achievement_description +entity_type: node +bundle: achievements +label: 'Achievement Description' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string_long diff --git a/modules/esha/achievements/config/install/field.field.node.achievements.field_achievement_type.yml b/modules/esha/achievements/config/install/field.field.node.achievements.field_achievement_type.yml new file mode 100644 index 0000000..24f0ec1 --- /dev/null +++ b/modules/esha/achievements/config/install/field.field.node.achievements.field_achievement_type.yml @@ -0,0 +1,31 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_achievement_type + - node.type.achievements + - taxonomy.vocabulary.achievement + enforced: + module: + - achievements +id: node.achievements.field_achievement_type +field_name: field_achievement_type +entity_type: node +bundle: achievements +label: 'Achievement Type' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + handler: 'default:taxonomy_term' + handler_settings: + target_bundles: + achievement: achievement + sort: + field: name + direction: asc + auto_create: false + auto_create_bundle: '' +field_type: entity_reference diff --git a/modules/esha/achievements/config/install/field.storage.node.field_achievement_description.yml b/modules/esha/achievements/config/install/field.storage.node.field_achievement_description.yml new file mode 100644 index 0000000..fcd5c47 --- /dev/null +++ b/modules/esha/achievements/config/install/field.storage.node.field_achievement_description.yml @@ -0,0 +1,22 @@ +uuid: 10af3d6e-5dd8-4248-a517-ad48ef3d8f62 +langcode: en +status: true +dependencies: + module: + - node + enforced: + module: + - achievements +id: node.field_achievement_description +field_name: field_achievement_description +entity_type: node +type: string_long +settings: + 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/achievements/config/install/field.storage.node.field_achievement_type.yml b/modules/esha/achievements/config/install/field.storage.node.field_achievement_type.yml new file mode 100644 index 0000000..6a01531 --- /dev/null +++ b/modules/esha/achievements/config/install/field.storage.node.field_achievement_type.yml @@ -0,0 +1,23 @@ +uuid: 01281d95-1c9e-4ada-b282-a81737d96e79 +langcode: en +status: true +dependencies: + module: + - node + - taxonomy + enforced: + module: + - achievements +id: node.field_achievement_type +field_name: field_achievement_type +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/achievements/config/install/migrate_plus.migration.sample_achievements_import.yml b/modules/esha/achievements/config/install/migrate_plus.migration.sample_achievements_import.yml new file mode 100644 index 0000000..41919df --- /dev/null +++ b/modules/esha/achievements/config/install/migrate_plus.migration.sample_achievements_import.yml @@ -0,0 +1,36 @@ +uuid: 3397f245-46fb-426c-bc42-4ea803dca435 +langcode: en +status: true +id: sample_achievements_import +class: null +field_plugin_method: null +cck_plugin_method: null +migration_tags: null +migration_group: default +label: 'Sample Achievements Import' +source: + plugin: csv + path: /var/www/CSV/achievements_sample.csv + delimiter: ',' + enclosure: '"' + header_row_count: 1 + keys: + - id +process: + type: + plugin: default_value + default_value: achievements + title: title + field_achievement_description: description + field_achievement_type: + - + plugin: entity_lookup + entity_type: taxonomy_term + bundle: achievement + source: type +destination: + plugin: 'entity:node' + bundle: achievements +migration_dependencies: + required: { } + optional: { } diff --git a/modules/esha/achievements/config/install/node.type.achievements.yml b/modules/esha/achievements/config/install/node.type.achievements.yml new file mode 100644 index 0000000..f2fccbb --- /dev/null +++ b/modules/esha/achievements/config/install/node.type.achievements.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - menu_ui + enforced: + module: + - achievements +# third_party_settings: +# menu_ui: +# available_menus: +# - main +# parent: 'main:' +name: Achievements +type: achievements +description: '' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: false diff --git a/modules/esha/achievements/config/install/taxonomy.vocabulary.achievement.yml b/modules/esha/achievements/config/install/taxonomy.vocabulary.achievement.yml new file mode 100644 index 0000000..0d6ce9c --- /dev/null +++ b/modules/esha/achievements/config/install/taxonomy.vocabulary.achievement.yml @@ -0,0 +1,12 @@ +uuid: 67cd72f5-de5c-476a-b102-813963ef0b9f +langcode: en +status: true +dependencies: + enforced: + module: + - achievements +name: Achievement +vid: achievement +description: 'Achieved by Staff/Students' +hierarchy: 0 +weight: 0 diff --git a/modules/esha/achievements/src/Controller/achievementController.php b/modules/esha/achievements/src/Controller/achievementController.php new file mode 100644 index 0000000..04f947e --- /dev/null +++ b/modules/esha/achievements/src/Controller/achievementController.php @@ -0,0 +1,25 @@ +<?php + +namespace Drupal\achievements\Controller; + +use Drupal\Core\Controller\ControllerBase; + +/** + * Class achievementController. + */ +class achievementController 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/achievements/templates/achievements.html.twig b/modules/esha/achievements/templates/achievements.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/esha/achievements/templates/achievements.html.twig @@ -0,0 +1 @@ +<!-- Add you custom twig html here -->
\ No newline at end of file diff --git a/modules/esha/achievements/tests/src/Functional/LoadTest.php b/modules/esha/achievements/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..0d54e64 --- /dev/null +++ b/modules/esha/achievements/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +<?php + +namespace Drupal\Tests\achievements\Functional; + +use Drupal\Core\Url; +use Drupal\Tests\BrowserTestBase; + +/** + * Simple test to ensure that main page loads with module enabled. + * + * @group achievements + */ +class LoadTest extends BrowserTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['achievements']; + + /** + * 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); + } + +} |