diff options
Diffstat (limited to 'modules/esha/placements')
26 files changed, 710 insertions, 0 deletions
diff --git a/modules/esha/placements/composer.json b/modules/esha/placements/composer.json new file mode 100644 index 0000000..6900912 --- /dev/null +++ b/modules/esha/placements/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/placements", + "type": "drupal-module", + "description": "Module for Placement Content Type", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/placements", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/placements", + "source": "http://cgit.drupalcode.org/placements" + }, + "require": { } +} diff --git a/modules/esha/placements/config/install/core.entity_form_display.node.placements.default.yml b/modules/esha/placements/config/install/core.entity_form_display.node.placements.default.yml new file mode 100644 index 0000000..f9aac4a --- /dev/null +++ b/modules/esha/placements/config/install/core.entity_form_display.node.placements.default.yml @@ -0,0 +1,120 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.placements.body + - field.field.node.placements.field_new + - field.field.node.placements.field_placed + - field.field.node.placements.field_total_students_placed + - field.field.node.placements.field_year + - node.type.placements + module: + - path + - text + enforced: + module: + - placements +id: node.placements.default +targetEntityType: node +bundle: placements +mode: default +content: + body: + weight: 125 + settings: + rows: 9 + summary_rows: 3 + placeholder: '' + type: text_textarea_with_summary + region: content + created: + type: datetime_timestamp + weight: 10 + region: content + settings: { } + third_party_settings: { } + field_new: + weight: 126 + settings: + match_operator: CONTAINS + size: 60 + placeholder: '' + third_party_settings: { } + type: entity_reference_autocomplete + region: content + field_placed: + weight: 127 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + region: content + field_total_students_placed: + weight: 123 + settings: + placeholder: '' + third_party_settings: { } + type: number + region: content + field_year: + weight: 124 + 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/placements/config/install/core.entity_view_display.node.placements.default.yml b/modules/esha/placements/config/install/core.entity_view_display.node.placements.default.yml new file mode 100644 index 0000000..b6f5b9e --- /dev/null +++ b/modules/esha/placements/config/install/core.entity_view_display.node.placements.default.yml @@ -0,0 +1,67 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.placements.body + - field.field.node.placements.field_new + - field.field.node.placements.field_placed + - field.field.node.placements.field_total_students_placed + - field.field.node.placements.field_year + - node.type.placements + module: + - text + - user + enforced: + module: + - placements +id: node.placements.default +targetEntityType: node +bundle: placements +mode: default +content: + body: + weight: 105 + label: above + settings: { } + type: text_default + region: content + field_new: + weight: 106 + label: above + settings: + link: true + third_party_settings: { } + type: entity_reference_label + region: content + field_placed: + weight: 107 + label: above + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content + field_total_students_placed: + weight: 103 + label: above + settings: + thousand_separator: '' + prefix_suffix: true + third_party_settings: { } + type: number_integer + region: content + field_year: + weight: 104 + 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/placements/config/install/core.entity_view_display.node.placements.teaser.yml b/modules/esha/placements/config/install/core.entity_view_display.node.placements.teaser.yml new file mode 100644 index 0000000..6a0abef --- /dev/null +++ b/modules/esha/placements/config/install/core.entity_view_display.node.placements.teaser.yml @@ -0,0 +1,26 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.placements.field_total_students_placed + - field.field.node.placements.field_year + - node.type.placements + module: + - user + enforced: + module: + - placements +id: node.placements.teaser +targetEntityType: node +bundle: placements +mode: teaser +content: + links: + weight: 100 + settings: { } + region: content +hidden: + field_total_students_placed: true + field_year: true + langcode: true diff --git a/modules/esha/placements/config/install/core.entity_view_mode.node.teaser.yml b/modules/esha/placements/config/install/core.entity_view_mode.node.teaser.yml new file mode 100644 index 0000000..f09eef8 --- /dev/null +++ b/modules/esha/placements/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: + - placements +_core: + default_config_hash: Mz9qWr1kUYK0mjRAGDsr5XS6PvtZ24en_7ndt-pyWe4 +id: node.teaser +label: Teaser +targetEntityType: node +cache: true diff --git a/modules/esha/placements/config/install/field.field.node.placements.body.yml b/modules/esha/placements/config/install/field.field.node.placements.body.yml new file mode 100644 index 0000000..4eaef94 --- /dev/null +++ b/modules/esha/placements/config/install/field.field.node.placements.body.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.body + - node.type.placements + module: + - text + enforced: + module: + - placements +id: node.placements.body +field_name: body +entity_type: node +bundle: placements +label: Body +description: '' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: + display_summary: false +field_type: text_with_summary diff --git a/modules/esha/placements/config/install/field.field.node.placements.field_new.yml b/modules/esha/placements/config/install/field.field.node.placements.field_new.yml new file mode 100644 index 0000000..4973424 --- /dev/null +++ b/modules/esha/placements/config/install/field.field.node.placements.field_new.yml @@ -0,0 +1,31 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_new + - node.type.placements + - taxonomy.vocabulary.vocab + enforced: + module: + - placements +id: node.placements.field_new +field_name: field_new +entity_type: node +bundle: placements +label: new +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + handler: 'default:taxonomy_term' + handler_settings: + target_bundles: + vocab: vocab + sort: + field: name + direction: asc + auto_create: false + auto_create_bundle: '' +field_type: entity_reference diff --git a/modules/esha/placements/config/install/field.field.node.placements.field_placed.yml b/modules/esha/placements/config/install/field.field.node.placements.field_placed.yml new file mode 100644 index 0000000..5a941da --- /dev/null +++ b/modules/esha/placements/config/install/field.field.node.placements.field_placed.yml @@ -0,0 +1,21 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_placed + - node.type.placements + enforced: + module: + - placements +id: node.placements.field_placed +field_name: field_placed +entity_type: node +bundle: placements +label: placed +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/modules/esha/placements/config/install/field.field.node.placements.field_total_students_placed.yml b/modules/esha/placements/config/install/field.field.node.placements.field_total_students_placed.yml new file mode 100644 index 0000000..a5867b7 --- /dev/null +++ b/modules/esha/placements/config/install/field.field.node.placements.field_total_students_placed.yml @@ -0,0 +1,25 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_total_students_placed + - node.type.placements + enforced: + module: + - placements +id: node.placements.field_total_students_placed +field_name: field_total_students_placed +entity_type: node +bundle: placements +label: 'Total Students Placed' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + min: null + max: null + prefix: '' + suffix: '' +field_type: integer diff --git a/modules/esha/placements/config/install/field.field.node.placements.field_year.yml b/modules/esha/placements/config/install/field.field.node.placements.field_year.yml new file mode 100644 index 0000000..ef2000d --- /dev/null +++ b/modules/esha/placements/config/install/field.field.node.placements.field_year.yml @@ -0,0 +1,31 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_year + - node.type.placements + - taxonomy.vocabulary.year + enforced: + module: + - placements +id: node.placements.field_year +field_name: field_year +entity_type: node +bundle: placements +label: Year +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + handler: 'default:taxonomy_term' + handler_settings: + target_bundles: + year: year + sort: + field: name + direction: asc + auto_create: false + auto_create_bundle: placement_year +field_type: entity_reference diff --git a/modules/esha/placements/config/install/field.storage.node.body.yml b/modules/esha/placements/config/install/field.storage.node.body.yml new file mode 100644 index 0000000..821a97a --- /dev/null +++ b/modules/esha/placements/config/install/field.storage.node.body.yml @@ -0,0 +1,24 @@ +uuid: d15ccb4d-ffc3-42ae-abaa-012960942a15 +langcode: en +status: true +dependencies: + module: + - node + - text + enforced: + module: + - placements +_core: + default_config_hash: EBUo7qOWqaiZaQ_RC9sLY5IoDKphS34v77VIHSACmVY +id: node.body +field_name: body +entity_type: node +type: text_with_summary +settings: { } +module: text +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: true +custom_storage: false diff --git a/modules/esha/placements/config/install/field.storage.node.field_new.yml b/modules/esha/placements/config/install/field.storage.node.field_new.yml new file mode 100644 index 0000000..117e02e --- /dev/null +++ b/modules/esha/placements/config/install/field.storage.node.field_new.yml @@ -0,0 +1,23 @@ +uuid: f42f851c-6e7b-4843-98ce-f0c233649c4b +langcode: en +status: true +dependencies: + module: + - node + - taxonomy + enforced: + module: + - placements +id: node.field_new +field_name: field_new +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/placements/config/install/field.storage.node.field_placed.yml b/modules/esha/placements/config/install/field.storage.node.field_placed.yml new file mode 100644 index 0000000..d926eeb --- /dev/null +++ b/modules/esha/placements/config/install/field.storage.node.field_placed.yml @@ -0,0 +1,24 @@ +uuid: ad069c50-3ddd-41a5-b5a6-1d930d1aa3df +langcode: en +status: true +dependencies: + module: + - node + enforced: + module: + - placements +id: node.field_placed +field_name: field_placed +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/placements/config/install/field.storage.node.field_total_students_placed.yml b/modules/esha/placements/config/install/field.storage.node.field_total_students_placed.yml new file mode 100644 index 0000000..010ad2f --- /dev/null +++ b/modules/esha/placements/config/install/field.storage.node.field_total_students_placed.yml @@ -0,0 +1,23 @@ +uuid: 3e89b54e-f405-4dee-b175-10ac5bb61161 +langcode: en +status: true +dependencies: + module: + - node + enforced: + module: + - placements +id: node.field_total_students_placed +field_name: field_total_students_placed +entity_type: node +type: integer +settings: + unsigned: false + size: normal +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/esha/placements/config/install/field.storage.node.field_year.yml b/modules/esha/placements/config/install/field.storage.node.field_year.yml new file mode 100644 index 0000000..5b6f903 --- /dev/null +++ b/modules/esha/placements/config/install/field.storage.node.field_year.yml @@ -0,0 +1,23 @@ +uuid: 404051f1-b4e2-4818-b895-e4bf114e7a93 +langcode: en +status: true +dependencies: + module: + - node + - taxonomy + enforced: + module: + - placements +id: node.field_year +field_name: field_year +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/placements/config/install/migrate_plus.migration.placements_import1.yml b/modules/esha/placements/config/install/migrate_plus.migration.placements_import1.yml new file mode 100644 index 0000000..42dc7e5 --- /dev/null +++ b/modules/esha/placements/config/install/migrate_plus.migration.placements_import1.yml @@ -0,0 +1,30 @@ +uuid: 1b29566d-9275-46df-a57f-5f6595537753 +id: placements_import +label: Import Placement Data +migration_groups: + - default +source: + plugin: csv + # Full path to the file. + path: '/var/www/CSV/Placements.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: + title: title + field_total_students_placed: total + field_year: year + type: + plugin: entity_lookup + entity: taxonomy_term + bundle: placement_year + source: year +destination: + plugin: 'entity:node' + plugin: entity:taxonomy_term +migration_dependencies: null diff --git a/modules/esha/placements/config/install/node.type.placements.yml b/modules/esha/placements/config/install/node.type.placements.yml new file mode 100644 index 0000000..f0bb423 --- /dev/null +++ b/modules/esha/placements/config/install/node.type.placements.yml @@ -0,0 +1,15 @@ +langcode: en +status: true +dependencies: + module: + - menu_ui + enforced: + module: + - placements +name: Placements +type: placements +description: '' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: false diff --git a/modules/esha/placements/config/install/taxonomy.vocabulary.vocab.yml b/modules/esha/placements/config/install/taxonomy.vocabulary.vocab.yml new file mode 100644 index 0000000..5c36cd8 --- /dev/null +++ b/modules/esha/placements/config/install/taxonomy.vocabulary.vocab.yml @@ -0,0 +1,12 @@ +uuid: dfa25a08-cadc-4bc6-826f-b817586af55b +langcode: en +status: true +dependencies: + enforced: + module: + - placements +name: vocab +vid: vocab +description: '' +hierarchy: 0 +weight: 0 diff --git a/modules/esha/placements/config/install/taxonomy.vocabulary.year.yml b/modules/esha/placements/config/install/taxonomy.vocabulary.year.yml new file mode 100644 index 0000000..9cf2d82 --- /dev/null +++ b/modules/esha/placements/config/install/taxonomy.vocabulary.year.yml @@ -0,0 +1,12 @@ +uuid: a22778aa-6584-422b-932b-3c4e4f59c1b5 +langcode: en +status: true +dependencies: + enforced: + module: + - placements +name: year +vid: year +description: '' +hierarchy: 0 +weight: 0 diff --git a/modules/esha/placements/placements.info.yml b/modules/esha/placements/placements.info.yml new file mode 100644 index 0000000..638f772 --- /dev/null +++ b/modules/esha/placements/placements.info.yml @@ -0,0 +1,13 @@ +name: 'placements' +type: module +description: 'Module for Placement Content Type' +core: 8.x +package: 'Custom' +dependencies: + - drupal:node + - drupal:text + - drupal:user + - drupal:menu_ui + - drupal:taxonomy + - drupal:options + - drupal:path diff --git a/modules/esha/placements/placements.install b/modules/esha/placements/placements.install new file mode 100644 index 0000000..6258322 --- /dev/null +++ b/modules/esha/placements/placements.install @@ -0,0 +1,22 @@ + +<?php +/** +* Implements hook_uninstall(). +*/ +function placements_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', 'placements'); + $nids = $query->execute(); + + // Delete entities. + if (!empty($nids)) { + $entities = $nodeStorage->loadMultiple($nids); + $nodeStorage->delete($entities); + } +} diff --git a/modules/esha/placements/placements.module b/modules/esha/placements/placements.module new file mode 100644 index 0000000..20f3371 --- /dev/null +++ b/modules/esha/placements/placements.module @@ -0,0 +1,35 @@ +<?php + +/** + * @file + * Contains placements.module. + */ + +use Drupal\Core\Routing\RouteMatchInterface; + +/** + * Implements hook_help(). + */ +function placements_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + // Main module help for the placements module. + case 'help.page.placements': + $output = ''; + $output .= '<h3>' . t('About') . '</h3>'; + $output .= '<p>' . t('Module for Placement Content Type') . '</p>'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function placements_theme() { + return [ + 'placements' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/esha/placements/placements.routing.yml b/modules/esha/placements/placements.routing.yml new file mode 100644 index 0000000..1872ef8 --- /dev/null +++ b/modules/esha/placements/placements.routing.yml @@ -0,0 +1,8 @@ + +placements.placement_controller_hello: + path: '/placements/hello/{name}' + defaults: + _controller: '\Drupal\placements\Controller\PlacementController::hello' + _title: 'placed' + requirements: + _permission: 'access content' diff --git a/modules/esha/placements/src/Controller/PlacementController.php b/modules/esha/placements/src/Controller/PlacementController.php new file mode 100644 index 0000000..761db6a --- /dev/null +++ b/modules/esha/placements/src/Controller/PlacementController.php @@ -0,0 +1,25 @@ +<?php + +namespace Drupal\placements\Controller; + +use Drupal\Core\Controller\ControllerBase; + +/** + * Class PlacementController. + */ +class PlacementController 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/placements/templates/placements.html.twig b/modules/esha/placements/templates/placements.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/esha/placements/templates/placements.html.twig @@ -0,0 +1 @@ +<!-- Add you custom twig html here -->
\ No newline at end of file diff --git a/modules/esha/placements/tests/src/Functional/LoadTest.php b/modules/esha/placements/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..fd19fb6 --- /dev/null +++ b/modules/esha/placements/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +<?php + +namespace Drupal\Tests\placements\Functional; + +use Drupal\Core\Url; +use Drupal\Tests\BrowserTestBase; + +/** + * Simple test to ensure that main page loads with module enabled. + * + * @group placements + */ +class LoadTest extends BrowserTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['placements']; + + /** + * 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); + } + +} |