diff options
Diffstat (limited to 'modules/esha/sig')
17 files changed, 491 insertions, 0 deletions
diff --git a/modules/esha/sig/composer.json b/modules/esha/sig/composer.json new file mode 100644 index 0000000..92be454 --- /dev/null +++ b/modules/esha/sig/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/sig", + "type": "drupal-module", + "description": "Module for Special Interest Groups Content Type", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/sig", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/sig", + "source": "http://cgit.drupalcode.org/sig" + }, + "require": { } +} diff --git a/modules/esha/sig/config/install/core.entity_form_display.node.special_interest_groups.default.yml b/modules/esha/sig/config/install/core.entity_form_display.node.special_interest_groups.default.yml new file mode 100644 index 0000000..2a56e47 --- /dev/null +++ b/modules/esha/sig/config/install/core.entity_form_display.node.special_interest_groups.default.yml @@ -0,0 +1,93 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.special_interest_groups.field_faculty_head + - field.field.node.special_interest_groups.field_sig_members + - node.type.special_interest_groups + module: + - path + enforced: + module: + - sig +id: node.special_interest_groups.default +targetEntityType: node +bundle: special_interest_groups +mode: default +content: + created: + type: datetime_timestamp + weight: 10 + region: content + settings: { } + third_party_settings: { } + field_faculty_head: + weight: 122 + settings: + match_operator: CONTAINS + size: 60 + placeholder: '' + third_party_settings: { } + type: entity_reference_autocomplete + region: content + field_sig_members: + weight: 123 + 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/sig/config/install/core.entity_view_display.node.special_interest_groups.default.yml b/modules/esha/sig/config/install/core.entity_view_display.node.special_interest_groups.default.yml new file mode 100644 index 0000000..41cd888 --- /dev/null +++ b/modules/esha/sig/config/install/core.entity_view_display.node.special_interest_groups.default.yml @@ -0,0 +1,40 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.special_interest_groups.field_faculty_head + - field.field.node.special_interest_groups.field_sig_members + - node.type.special_interest_groups + module: + - user + enforced: + module: + - sig +id: node.special_interest_groups.default +targetEntityType: node +bundle: special_interest_groups +mode: default +content: + field_faculty_head: + weight: 102 + label: above + settings: + link: true + third_party_settings: { } + type: entity_reference_label + region: content + field_sig_members: + weight: 103 + 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/sig/config/install/core.entity_view_display.node.special_interest_groups.teaser.yml b/modules/esha/sig/config/install/core.entity_view_display.node.special_interest_groups.teaser.yml new file mode 100644 index 0000000..01fe2d5 --- /dev/null +++ b/modules/esha/sig/config/install/core.entity_view_display.node.special_interest_groups.teaser.yml @@ -0,0 +1,25 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.special_interest_groups.field_faculty_head + - node.type.special_interest_groups + module: + - user + enforced: + module: + - sig +id: node.special_interest_groups.teaser +targetEntityType: node +bundle: special_interest_groups +mode: teaser +content: + links: + weight: 100 + settings: { } + third_party_settings: { } + region: content +hidden: + field_faculty_head: true + langcode: true diff --git a/modules/esha/sig/config/install/core.entity_view_mode.node.teaser.yml b/modules/esha/sig/config/install/core.entity_view_mode.node.teaser.yml new file mode 100644 index 0000000..138bd3c --- /dev/null +++ b/modules/esha/sig/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: + - sig +_core: + default_config_hash: Mz9qWr1kUYK0mjRAGDsr5XS6PvtZ24en_7ndt-pyWe4 +id: node.teaser +label: Teaser +targetEntityType: node +cache: true diff --git a/modules/esha/sig/config/install/field.field.node.special_interest_groups.field_faculty_head.yml b/modules/esha/sig/config/install/field.field.node.special_interest_groups.field_faculty_head.yml new file mode 100644 index 0000000..866afa7 --- /dev/null +++ b/modules/esha/sig/config/install/field.field.node.special_interest_groups.field_faculty_head.yml @@ -0,0 +1,30 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_faculty_head + - node.type.fac_page + - node.type.special_interest_groups + enforced: + module: + - sig +id: node.special_interest_groups.field_faculty_head +field_name: field_faculty_head +entity_type: node +bundle: special_interest_groups +label: 'Faculty Head' +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/sig/config/install/field.field.node.special_interest_groups.field_sig_members.yml b/modules/esha/sig/config/install/field.field.node.special_interest_groups.field_sig_members.yml new file mode 100644 index 0000000..8b199d9 --- /dev/null +++ b/modules/esha/sig/config/install/field.field.node.special_interest_groups.field_sig_members.yml @@ -0,0 +1,30 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_sig_members + - node.type.fac_page + - node.type.special_interest_groups + enforced: + module: + - sig +id: node.special_interest_groups.field_sig_members +field_name: field_sig_members +entity_type: node +bundle: special_interest_groups +label: 'SIG Members' +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/sig/config/install/field.storage.node.field_faculty_head.yml b/modules/esha/sig/config/install/field.storage.node.field_faculty_head.yml new file mode 100644 index 0000000..bd37713 --- /dev/null +++ b/modules/esha/sig/config/install/field.storage.node.field_faculty_head.yml @@ -0,0 +1,22 @@ +uuid: c30dd806-cceb-4e4a-94f5-cc06173cf69a +langcode: en +status: true +dependencies: + module: + - node + enforced: + module: + - sig +id: node.field_faculty_head +field_name: field_faculty_head +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/sig/config/install/field.storage.node.field_sig_members.yml b/modules/esha/sig/config/install/field.storage.node.field_sig_members.yml new file mode 100644 index 0000000..8346ae7 --- /dev/null +++ b/modules/esha/sig/config/install/field.storage.node.field_sig_members.yml @@ -0,0 +1,22 @@ +uuid: 0d465dd6-6376-449e-b185-1e75febf6c2f +langcode: en +status: true +dependencies: + module: + - node + enforced: + module: + - sig +id: node.field_sig_members +field_name: field_sig_members +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/sig/config/install/migrate_plus.migration.sig_sample.yml b/modules/esha/sig/config/install/migrate_plus.migration.sig_sample.yml new file mode 100644 index 0000000..d309984 --- /dev/null +++ b/modules/esha/sig/config/install/migrate_plus.migration.sig_sample.yml @@ -0,0 +1,40 @@ +uuid: 9dea4ec4-fb79-4a5f-a37a-a045de069432 +id: sig_sample +label: 'SIG Sample' +migration_group: default +source: + plugin: csv + # Full path to the file. + path: '/var/www/CSV/sig_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: special_interest_groups + title: title + field_faculty_head: + - + plugin: entity_lookup + entity_type: node + bundle: fac_page + source: head + field_sig_members: + - + plugin: explode + delimiter: '|' + source: members + - + plugin: entity_lookup + entity_type: node + bundle: fac_page +destination: + plugin: 'entity:node' + bundle: special_interest_groups +migration_dependencies: null diff --git a/modules/esha/sig/config/install/node.type.fac_page.yml b/modules/esha/sig/config/install/node.type.fac_page.yml new file mode 100644 index 0000000..5fd2e1e --- /dev/null +++ b/modules/esha/sig/config/install/node.type.fac_page.yml @@ -0,0 +1,26 @@ +uuid: b7471e78-83f0-4359-9512-d4a8f02c2218 +langcode: en +status: true +dependencies: + enforced: + module: + - acadmix_faculty + module: + - menu_ui + enforced: + module: + - sig +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/sig/config/install/node.type.special_interest_groups.yml b/modules/esha/sig/config/install/node.type.special_interest_groups.yml new file mode 100644 index 0000000..7a413fb --- /dev/null +++ b/modules/esha/sig/config/install/node.type.special_interest_groups.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - menu_ui + enforced: + module: + - sig +third_party_settings: + menu_ui: + available_menus: + - main + parent: 'main:' +name: 'Special Interest Groups' +type: special_interest_groups +description: '' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: false diff --git a/modules/esha/sig/sig.info.yml b/modules/esha/sig/sig.info.yml new file mode 100644 index 0000000..94c6b38 --- /dev/null +++ b/modules/esha/sig/sig.info.yml @@ -0,0 +1,10 @@ +name: 'sig' +type: module +description: 'Module for Special Interest Groups Content Type' +core: 8.x +package: 'Custom' +dependencies: + - drupal:path + - drupal:node + - drupal:user + - drupal:menu_ui diff --git a/modules/esha/sig/sig.install b/modules/esha/sig/sig.install new file mode 100644 index 0000000..b032a5b --- /dev/null +++ b/modules/esha/sig/sig.install @@ -0,0 +1,22 @@ + +<?php +/** +* Implements hook_uninstall(). +*/ +function sig_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', 'special_interest_groups'); + $nids = $query->execute(); + + // Delete entities. + if (!empty($nids)) { + $entities = $nodeStorage->loadMultiple($nids); + $nodeStorage->delete($entities); + } +} diff --git a/modules/esha/sig/sig.module b/modules/esha/sig/sig.module new file mode 100644 index 0000000..72809bb --- /dev/null +++ b/modules/esha/sig/sig.module @@ -0,0 +1,35 @@ +<?php + +/** + * @file + * Contains sig.module. + */ + +use Drupal\Core\Routing\RouteMatchInterface; + +/** + * Implements hook_help(). + */ +function sig_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + // Main module help for the sig module. + case 'help.page.sig': + $output = ''; + $output .= '<h3>' . t('About') . '</h3>'; + $output .= '<p>' . t('Module for Special Interest Groups Content Type') . '</p>'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function sig_theme() { + return [ + 'sig' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/esha/sig/templates/sig.html.twig b/modules/esha/sig/templates/sig.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/esha/sig/templates/sig.html.twig @@ -0,0 +1 @@ +<!-- Add you custom twig html here -->
\ No newline at end of file diff --git a/modules/esha/sig/tests/src/Functional/LoadTest.php b/modules/esha/sig/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..8b87e58 --- /dev/null +++ b/modules/esha/sig/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +<?php + +namespace Drupal\Tests\sig\Functional; + +use Drupal\Core\Url; +use Drupal\Tests\BrowserTestBase; + +/** + * Simple test to ensure that main page loads with module enabled. + * + * @group sig + */ +class LoadTest extends BrowserTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['sig']; + + /** + * 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); + } + +} |