summaryrefslogtreecommitdiff
path: root/modules/esha/labmanual
diff options
context:
space:
mode:
Diffstat (limited to 'modules/esha/labmanual')
-rw-r--r--modules/esha/labmanual/composer.json14
-rw-r--r--modules/esha/labmanual/config/install/core.entity_form_display.node.lab_manual.default.yml91
-rw-r--r--modules/esha/labmanual/config/install/core.entity_view_display.node.lab_manual.default.yml40
-rw-r--r--modules/esha/labmanual/config/install/core.entity_view_display.node.lab_manual.teaser.yml27
-rw-r--r--modules/esha/labmanual/config/install/core.entity_view_mode.node.teaser.yml15
-rw-r--r--modules/esha/labmanual/config/install/field.field.node.lab_manual.field_description.yml21
-rw-r--r--modules/esha/labmanual/config/install/field.field.node.lab_manual.field_manual.yml29
-rw-r--r--modules/esha/labmanual/config/install/field.storage.node.field_description.yml22
-rw-r--r--modules/esha/labmanual/config/install/field.storage.node.field_manual.yml26
-rw-r--r--modules/esha/labmanual/config/install/migrate_plus.migration.labmanuals_import.yml51
-rw-r--r--modules/esha/labmanual/config/install/node.type.lab_manual.yml20
-rw-r--r--modules/esha/labmanual/labmanual.info.yml12
-rw-r--r--modules/esha/labmanual/labmanual.install22
-rw-r--r--modules/esha/labmanual/labmanual.module35
-rw-r--r--modules/esha/labmanual/templates/labmanual.html.twig1
-rw-r--r--modules/esha/labmanual/tests/src/Functional/LoadTest.php46
16 files changed, 472 insertions, 0 deletions
diff --git a/modules/esha/labmanual/composer.json b/modules/esha/labmanual/composer.json
new file mode 100644
index 0000000..babdf95
--- /dev/null
+++ b/modules/esha/labmanual/composer.json
@@ -0,0 +1,14 @@
+{
+ "name": "drupal/labmanual",
+ "type": "drupal-module",
+ "description": "Module for Lab Manual Content Type",
+ "keywords": ["Drupal"],
+ "license": "GPL-2.0+",
+ "homepage": "https://www.drupal.org/project/labmanual",
+ "minimum-stability": "dev",
+ "support": {
+ "issues": "https://www.drupal.org/project/issues/labmanual",
+ "source": "http://cgit.drupalcode.org/labmanual"
+ },
+ "require": { }
+}
diff --git a/modules/esha/labmanual/config/install/core.entity_form_display.node.lab_manual.default.yml b/modules/esha/labmanual/config/install/core.entity_form_display.node.lab_manual.default.yml
new file mode 100644
index 0000000..084c912
--- /dev/null
+++ b/modules/esha/labmanual/config/install/core.entity_form_display.node.lab_manual.default.yml
@@ -0,0 +1,91 @@
+langcode: en
+status: true
+dependencies:
+ config:
+ - field.field.node.lab_manual.field_description
+ - field.field.node.lab_manual.field_manual
+ - node.type.lab_manual
+ module:
+ - file
+ - path
+ enforced:
+ module:
+ - labmanual
+id: node.lab_manual.default
+targetEntityType: node
+bundle: lab_manual
+mode: default
+content:
+ created:
+ type: datetime_timestamp
+ weight: 10
+ region: content
+ settings: { }
+ third_party_settings: { }
+ field_description:
+ weight: 122
+ settings:
+ rows: 5
+ placeholder: ''
+ third_party_settings: { }
+ type: string_textarea
+ region: content
+ field_manual:
+ weight: 123
+ 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/labmanual/config/install/core.entity_view_display.node.lab_manual.default.yml b/modules/esha/labmanual/config/install/core.entity_view_display.node.lab_manual.default.yml
new file mode 100644
index 0000000..a04bdb4
--- /dev/null
+++ b/modules/esha/labmanual/config/install/core.entity_view_display.node.lab_manual.default.yml
@@ -0,0 +1,40 @@
+langcode: en
+status: true
+dependencies:
+ config:
+ - field.field.node.lab_manual.field_description
+ - field.field.node.lab_manual.field_manual
+ - node.type.lab_manual
+ module:
+ - file
+ - user
+ enforced:
+ module:
+ - labmanual
+id: node.lab_manual.default
+targetEntityType: node
+bundle: lab_manual
+mode: default
+content:
+ field_description:
+ weight: 102
+ label: above
+ settings: { }
+ third_party_settings: { }
+ type: basic_string
+ region: content
+ field_manual:
+ weight: 103
+ 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/labmanual/config/install/core.entity_view_display.node.lab_manual.teaser.yml b/modules/esha/labmanual/config/install/core.entity_view_display.node.lab_manual.teaser.yml
new file mode 100644
index 0000000..d083bbc
--- /dev/null
+++ b/modules/esha/labmanual/config/install/core.entity_view_display.node.lab_manual.teaser.yml
@@ -0,0 +1,27 @@
+langcode: en
+status: true
+dependencies:
+ config:
+ - core.entity_view_mode.node.teaser
+ - field.field.node.lab_manual.field_description
+ - field.field.node.lab_manual.field_manual
+ - node.type.lab_manual
+ module:
+ - user
+ enforced:
+ module:
+ - labmanual
+id: node.lab_manual.teaser
+targetEntityType: node
+bundle: lab_manual
+mode: teaser
+content:
+ links:
+ weight: 100
+ settings: { }
+ third_party_settings: { }
+ region: content
+hidden:
+ field_description: true
+ field_manual: true
+ langcode: true
diff --git a/modules/esha/labmanual/config/install/core.entity_view_mode.node.teaser.yml b/modules/esha/labmanual/config/install/core.entity_view_mode.node.teaser.yml
new file mode 100644
index 0000000..ce0398e
--- /dev/null
+++ b/modules/esha/labmanual/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:
+ - labmanual
+_core:
+ default_config_hash: Mz9qWr1kUYK0mjRAGDsr5XS6PvtZ24en_7ndt-pyWe4
+id: node.teaser
+label: Teaser
+targetEntityType: node
+cache: true
diff --git a/modules/esha/labmanual/config/install/field.field.node.lab_manual.field_description.yml b/modules/esha/labmanual/config/install/field.field.node.lab_manual.field_description.yml
new file mode 100644
index 0000000..e31a4ba
--- /dev/null
+++ b/modules/esha/labmanual/config/install/field.field.node.lab_manual.field_description.yml
@@ -0,0 +1,21 @@
+langcode: en
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_description
+ - node.type.lab_manual
+ enforced:
+ module:
+ - labmanual
+id: node.lab_manual.field_description
+field_name: field_description
+entity_type: node
+bundle: lab_manual
+label: Description
+description: ''
+required: false
+translatable: false
+default_value: { }
+default_value_callback: ''
+settings: { }
+field_type: string_long
diff --git a/modules/esha/labmanual/config/install/field.field.node.lab_manual.field_manual.yml b/modules/esha/labmanual/config/install/field.field.node.lab_manual.field_manual.yml
new file mode 100644
index 0000000..b953977
--- /dev/null
+++ b/modules/esha/labmanual/config/install/field.field.node.lab_manual.field_manual.yml
@@ -0,0 +1,29 @@
+langcode: en
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_manual
+ - node.type.lab_manual
+ module:
+ - file
+ enforced:
+ module:
+ - labmanual
+id: node.lab_manual.field_manual
+field_name: field_manual
+entity_type: node
+bundle: lab_manual
+label: Manual
+description: ''
+required: false
+translatable: false
+default_value: { }
+default_value_callback: ''
+settings:
+ file_directory: lab_manuals
+ file_extensions: pdf
+ max_filesize: ''
+ description_field: false
+ handler: 'default:file'
+ handler_settings: { }
+field_type: file
diff --git a/modules/esha/labmanual/config/install/field.storage.node.field_description.yml b/modules/esha/labmanual/config/install/field.storage.node.field_description.yml
new file mode 100644
index 0000000..f272899
--- /dev/null
+++ b/modules/esha/labmanual/config/install/field.storage.node.field_description.yml
@@ -0,0 +1,22 @@
+uuid: 2607b4e4-518c-4aff-9b49-5f398e718487
+langcode: en
+status: true
+dependencies:
+ module:
+ - node
+ enforced:
+ module:
+ - labmanual
+id: node.field_description
+field_name: field_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/labmanual/config/install/field.storage.node.field_manual.yml b/modules/esha/labmanual/config/install/field.storage.node.field_manual.yml
new file mode 100644
index 0000000..9070112
--- /dev/null
+++ b/modules/esha/labmanual/config/install/field.storage.node.field_manual.yml
@@ -0,0 +1,26 @@
+uuid: 9772805f-ffb2-443f-afdd-0bc6dfd48416
+langcode: en
+status: true
+dependencies:
+ module:
+ - file
+ - node
+ enforced:
+ module:
+ - labmanual
+id: node.field_manual
+field_name: field_manual
+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/labmanual/config/install/migrate_plus.migration.labmanuals_import.yml b/modules/esha/labmanual/config/install/migrate_plus.migration.labmanuals_import.yml
new file mode 100644
index 0000000..e6e6a38
--- /dev/null
+++ b/modules/esha/labmanual/config/install/migrate_plus.migration.labmanuals_import.yml
@@ -0,0 +1,51 @@
+uuid: c04b2ca4-cd30-4aa3-b742-d558a856d094
+id: labmanuals_import
+label: labmanual
+migration_group: default
+source:
+ plugin: csv
+ # Full path to the file.
+ path: '/var/www/CSV/LabManual.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
+ constants:
+ file_source: /var/www/LabManuals
+ file_dest: 'public://lab_manuals/'
+process:
+ type:
+ plugin: default_value
+ default_value: lab_manual
+ source_path:
+ -
+ plugin: skip_on_empty
+ method: process
+ source: manual
+ -
+ plugin: concat
+ delimiter: /
+ source:
+ - constants/file_source
+ - manual
+ title: title
+ body/value: body
+ body/format:
+ -
+ plugin: default_value
+ default_value: basic_html
+ field_description: description
+ field_manual:
+ plugin: file_import
+ source: '@source_path'
+ destination: constants/file_dest
+destination:
+ plugin: 'entity:node'
+ bundle: lab_manual
+migration_dependencies:
+ required: { }
+ optional: { }
diff --git a/modules/esha/labmanual/config/install/node.type.lab_manual.yml b/modules/esha/labmanual/config/install/node.type.lab_manual.yml
new file mode 100644
index 0000000..f624421
--- /dev/null
+++ b/modules/esha/labmanual/config/install/node.type.lab_manual.yml
@@ -0,0 +1,20 @@
+langcode: en
+status: true
+dependencies:
+ module:
+ - menu_ui
+ enforced:
+ module:
+ - labmanual
+third_party_settings:
+ menu_ui:
+ available_menus:
+ - main
+ parent: 'main:'
+name: 'Lab Manual'
+type: lab_manual
+description: ''
+help: ''
+new_revision: false
+preview_mode: 1
+display_submitted: false
diff --git a/modules/esha/labmanual/labmanual.info.yml b/modules/esha/labmanual/labmanual.info.yml
new file mode 100644
index 0000000..9bfe438
--- /dev/null
+++ b/modules/esha/labmanual/labmanual.info.yml
@@ -0,0 +1,12 @@
+name: 'labmanual'
+type: module
+description: 'Module for Lab Manual Content Type'
+core: 8.x
+package: 'Custom'
+dependencies:
+ - drupal:file
+ - drupal:path
+ - drupal:user
+ - drupal:node
+ - drupal:file
+ - drupal:menu_ui \ No newline at end of file
diff --git a/modules/esha/labmanual/labmanual.install b/modules/esha/labmanual/labmanual.install
new file mode 100644
index 0000000..e2c0ed3
--- /dev/null
+++ b/modules/esha/labmanual/labmanual.install
@@ -0,0 +1,22 @@
+
+<?php
+/**
+* Implements hook_uninstall().
+*/
+function labmanual_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', 'lab_manual');
+ $nids = $query->execute();
+
+ // Delete entities.
+ if (!empty($nids)) {
+ $entities = $nodeStorage->loadMultiple($nids);
+ $nodeStorage->delete($entities);
+ }
+}
diff --git a/modules/esha/labmanual/labmanual.module b/modules/esha/labmanual/labmanual.module
new file mode 100644
index 0000000..5782054
--- /dev/null
+++ b/modules/esha/labmanual/labmanual.module
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * @file
+ * Contains labmanual.module.
+ */
+
+use Drupal\Core\Routing\RouteMatchInterface;
+
+/**
+ * Implements hook_help().
+ */
+function labmanual_help($route_name, RouteMatchInterface $route_match) {
+ switch ($route_name) {
+ // Main module help for the labmanual module.
+ case 'help.page.labmanual':
+ $output = '';
+ $output .= '<h3>' . t('About') . '</h3>';
+ $output .= '<p>' . t('Module for Lab Manual Content Type') . '</p>';
+ return $output;
+
+ default:
+ }
+}
+
+/**
+ * Implements hook_theme().
+ */
+function labmanual_theme() {
+ return [
+ 'labmanual' => [
+ 'render element' => 'children',
+ ],
+ ];
+}
diff --git a/modules/esha/labmanual/templates/labmanual.html.twig b/modules/esha/labmanual/templates/labmanual.html.twig
new file mode 100644
index 0000000..91e43c8
--- /dev/null
+++ b/modules/esha/labmanual/templates/labmanual.html.twig
@@ -0,0 +1 @@
+<!-- Add you custom twig html here --> \ No newline at end of file
diff --git a/modules/esha/labmanual/tests/src/Functional/LoadTest.php b/modules/esha/labmanual/tests/src/Functional/LoadTest.php
new file mode 100644
index 0000000..e548812
--- /dev/null
+++ b/modules/esha/labmanual/tests/src/Functional/LoadTest.php
@@ -0,0 +1,46 @@
+<?php
+
+namespace Drupal\Tests\labmanual\Functional;
+
+use Drupal\Core\Url;
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Simple test to ensure that main page loads with module enabled.
+ *
+ * @group labmanual
+ */
+class LoadTest extends BrowserTestBase {
+
+ /**
+ * Modules to enable.
+ *
+ * @var array
+ */
+ public static $modules = ['labmanual'];
+
+ /**
+ * 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);
+ }
+
+}