From 141ce8c97abe36f1f8bb06a38623e93563d6c618 Mon Sep 17 00:00:00 2001 From: Esha Date: Tue, 2 Jul 2019 12:42:54 +0530 Subject: Custom modules --- modules/esha/corporate/composer.json | 14 +++ ...splay.node.corporate_advisory_board.default.yml | 112 +++++++++++++++++++++ ...splay.node.corporate_advisory_board.default.yml | 66 ++++++++++++ ...isplay.node.corporate_advisory_board.teaser.yml | 31 ++++++ .../install/core.entity_view_mode.node.teaser.yml | 15 +++ ...orporate_advisory_board.field_company_image.yml | 40 ++++++++ ...porate_advisory_board.field_company_website.yml | 25 +++++ ....corporate_advisory_board.field_designation.yml | 21 ++++ ...corporate_advisory_board.field_member_image.yml | 40 ++++++++ .../field.storage.node.field_company_image.yml | 33 ++++++ .../field.storage.node.field_company_website.yml | 22 ++++ .../field.storage.node.field_designation.yml | 24 +++++ .../field.storage.node.field_member_image.yml | 33 ++++++ .../config/install/image.style.thumbnail.yml | 20 ++++ .../install/migrate_plus.migration.cab_import.yml | 69 +++++++++++++ .../install/node.type.corporate_advisory_board.yml | 20 ++++ modules/esha/corporate/corporate.info.yml | 14 +++ modules/esha/corporate/corporate.install | 22 ++++ modules/esha/corporate/corporate.module | 35 +++++++ .../esha/corporate/templates/corporate.html.twig | 1 + .../corporate/tests/src/Functional/LoadTest.php | 46 +++++++++ 21 files changed, 703 insertions(+) create mode 100644 modules/esha/corporate/composer.json create mode 100644 modules/esha/corporate/config/install/core.entity_form_display.node.corporate_advisory_board.default.yml create mode 100644 modules/esha/corporate/config/install/core.entity_view_display.node.corporate_advisory_board.default.yml create mode 100644 modules/esha/corporate/config/install/core.entity_view_display.node.corporate_advisory_board.teaser.yml create mode 100644 modules/esha/corporate/config/install/core.entity_view_mode.node.teaser.yml create mode 100644 modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_company_image.yml create mode 100644 modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_company_website.yml create mode 100644 modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_designation.yml create mode 100644 modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_member_image.yml create mode 100644 modules/esha/corporate/config/install/field.storage.node.field_company_image.yml create mode 100644 modules/esha/corporate/config/install/field.storage.node.field_company_website.yml create mode 100644 modules/esha/corporate/config/install/field.storage.node.field_designation.yml create mode 100644 modules/esha/corporate/config/install/field.storage.node.field_member_image.yml create mode 100644 modules/esha/corporate/config/install/image.style.thumbnail.yml create mode 100644 modules/esha/corporate/config/install/migrate_plus.migration.cab_import.yml create mode 100644 modules/esha/corporate/config/install/node.type.corporate_advisory_board.yml create mode 100644 modules/esha/corporate/corporate.info.yml create mode 100644 modules/esha/corporate/corporate.install create mode 100644 modules/esha/corporate/corporate.module create mode 100644 modules/esha/corporate/templates/corporate.html.twig create mode 100644 modules/esha/corporate/tests/src/Functional/LoadTest.php (limited to 'modules/esha/corporate') diff --git a/modules/esha/corporate/composer.json b/modules/esha/corporate/composer.json new file mode 100644 index 0000000..f8f0e32 --- /dev/null +++ b/modules/esha/corporate/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/corporate", + "type": "drupal-module", + "description": "Module for Corporate Advisory Board Content Type", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/corporate", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/corporate", + "source": "http://cgit.drupalcode.org/corporate" + }, + "require": { } +} diff --git a/modules/esha/corporate/config/install/core.entity_form_display.node.corporate_advisory_board.default.yml b/modules/esha/corporate/config/install/core.entity_form_display.node.corporate_advisory_board.default.yml new file mode 100644 index 0000000..d36c401 --- /dev/null +++ b/modules/esha/corporate/config/install/core.entity_form_display.node.corporate_advisory_board.default.yml @@ -0,0 +1,112 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.corporate_advisory_board.field_company_image + - field.field.node.corporate_advisory_board.field_company_website + - field.field.node.corporate_advisory_board.field_designation + - field.field.node.corporate_advisory_board.field_member_image + - image.style.thumbnail + - node.type.corporate_advisory_board + module: + - image + - link + - path + enforced: + module: + - corporate +id: node.corporate_advisory_board.default +targetEntityType: node +bundle: corporate_advisory_board +mode: default +content: + created: + type: datetime_timestamp + weight: 10 + region: content + settings: { } + third_party_settings: { } + field_company_image: + weight: 124 + settings: + progress_indicator: throbber + preview_image_style: thumbnail + third_party_settings: { } + type: image_image + region: content + field_company_website: + weight: 127 + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + type: link_default + region: content + field_designation: + weight: 126 + settings: + size: 60 + placeholder: '' + third_party_settings: { } + type: string_textfield + region: content + field_member_image: + weight: 123 + settings: + progress_indicator: throbber + preview_image_style: thumbnail + third_party_settings: { } + type: image_image + 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/corporate/config/install/core.entity_view_display.node.corporate_advisory_board.default.yml b/modules/esha/corporate/config/install/core.entity_view_display.node.corporate_advisory_board.default.yml new file mode 100644 index 0000000..b543a8c --- /dev/null +++ b/modules/esha/corporate/config/install/core.entity_view_display.node.corporate_advisory_board.default.yml @@ -0,0 +1,66 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.corporate_advisory_board.field_company_image + - field.field.node.corporate_advisory_board.field_company_website + - field.field.node.corporate_advisory_board.field_designation + - field.field.node.corporate_advisory_board.field_member_image + - node.type.corporate_advisory_board + module: + - image + - link + - user + enforced: + module: + - corporate +id: node.corporate_advisory_board.default +targetEntityType: node +bundle: corporate_advisory_board +mode: default +content: + field_company_image: + weight: 104 + label: above + settings: + image_style: '' + image_link: '' + third_party_settings: { } + type: image + region: content + field_company_website: + weight: 107 + label: above + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + type: link + region: content + field_designation: + weight: 106 + label: above + settings: + link_to_entity: false + third_party_settings: { } + type: string + region: content + field_member_image: + weight: 103 + label: above + settings: + image_style: '' + image_link: '' + third_party_settings: { } + type: image + region: content + links: + weight: 100 + settings: { } + third_party_settings: { } + region: content +hidden: + langcode: true diff --git a/modules/esha/corporate/config/install/core.entity_view_display.node.corporate_advisory_board.teaser.yml b/modules/esha/corporate/config/install/core.entity_view_display.node.corporate_advisory_board.teaser.yml new file mode 100644 index 0000000..999478f --- /dev/null +++ b/modules/esha/corporate/config/install/core.entity_view_display.node.corporate_advisory_board.teaser.yml @@ -0,0 +1,31 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.corporate_advisory_board.field_company_image + - field.field.node.corporate_advisory_board.field_company_website + - field.field.node.corporate_advisory_board.field_designation + - field.field.node.corporate_advisory_board.field_member_image + - node.type.corporate_advisory_board + module: + - user + enforced: + module: + - corporate +id: node.corporate_advisory_board.teaser +targetEntityType: node +bundle: corporate_advisory_board +mode: teaser +content: + links: + weight: 100 + settings: { } + third_party_settings: { } + region: content +hidden: + field_company_image: true + field_company_website: true + field_designation: true + field_member_image: true + langcode: true diff --git a/modules/esha/corporate/config/install/core.entity_view_mode.node.teaser.yml b/modules/esha/corporate/config/install/core.entity_view_mode.node.teaser.yml new file mode 100644 index 0000000..4632edd --- /dev/null +++ b/modules/esha/corporate/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: + - corporate +_core: + default_config_hash: Mz9qWr1kUYK0mjRAGDsr5XS6PvtZ24en_7ndt-pyWe4 +id: node.teaser +label: Teaser +targetEntityType: node +cache: true diff --git a/modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_company_image.yml b/modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_company_image.yml new file mode 100644 index 0000000..f56d0c8 --- /dev/null +++ b/modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_company_image.yml @@ -0,0 +1,40 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_company_image + - node.type.corporate_advisory_board + module: + - image + enforced: + module: + - corporate +id: node.corporate_advisory_board.field_company_image +field_name: field_company_image +entity_type: node +bundle: corporate_advisory_board +label: 'Company Image' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: company_images + file_extensions: 'png gif jpg jpeg' + max_filesize: '' + max_resolution: '' + min_resolution: '' + alt_field: true + alt_field_required: true + title_field: false + title_field_required: false + default_image: + uuid: '' + alt: '' + title: '' + width: null + height: null + handler: 'default:file' + handler_settings: { } +field_type: image diff --git a/modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_company_website.yml b/modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_company_website.yml new file mode 100644 index 0000000..c7ed791 --- /dev/null +++ b/modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_company_website.yml @@ -0,0 +1,25 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_company_website + - node.type.corporate_advisory_board + module: + - link + enforced: + module: + - corporate +id: node.corporate_advisory_board.field_company_website +field_name: field_company_website +entity_type: node +bundle: corporate_advisory_board +label: 'Company Website' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + link_type: 17 + title: 1 +field_type: link diff --git a/modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_designation.yml b/modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_designation.yml new file mode 100644 index 0000000..0cc1355 --- /dev/null +++ b/modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_designation.yml @@ -0,0 +1,21 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_designation + - node.type.corporate_advisory_board + enforced: + module: + - corporate +id: node.corporate_advisory_board.field_designation +field_name: field_designation +entity_type: node +bundle: corporate_advisory_board +label: Designation +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_member_image.yml b/modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_member_image.yml new file mode 100644 index 0000000..7369e23 --- /dev/null +++ b/modules/esha/corporate/config/install/field.field.node.corporate_advisory_board.field_member_image.yml @@ -0,0 +1,40 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_member_image + - node.type.corporate_advisory_board + module: + - image + enforced: + module: + - corporate +id: node.corporate_advisory_board.field_member_image +field_name: field_member_image +entity_type: node +bundle: corporate_advisory_board +label: 'Member Image' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: member_images + file_extensions: 'png gif jpg jpeg' + max_filesize: '' + max_resolution: '' + min_resolution: '' + alt_field: true + alt_field_required: true + title_field: false + title_field_required: false + default_image: + uuid: '' + alt: '' + title: '' + width: null + height: null + handler: 'default:file' + handler_settings: { } +field_type: image diff --git a/modules/esha/corporate/config/install/field.storage.node.field_company_image.yml b/modules/esha/corporate/config/install/field.storage.node.field_company_image.yml new file mode 100644 index 0000000..04fafea --- /dev/null +++ b/modules/esha/corporate/config/install/field.storage.node.field_company_image.yml @@ -0,0 +1,33 @@ +uuid: 336c9ebe-441b-4df5-a485-f0952792019a +langcode: en +status: true +dependencies: + module: + - file + - image + - node + enforced: + module: + - corporate +id: node.field_company_image +field_name: field_company_image +entity_type: node +type: image +settings: + uri_scheme: public + default_image: + uuid: '' + alt: '' + title: '' + width: null + height: null + target_type: file + display_field: false + display_default: false +module: image +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/esha/corporate/config/install/field.storage.node.field_company_website.yml b/modules/esha/corporate/config/install/field.storage.node.field_company_website.yml new file mode 100644 index 0000000..042889c --- /dev/null +++ b/modules/esha/corporate/config/install/field.storage.node.field_company_website.yml @@ -0,0 +1,22 @@ +uuid: 72f4d1c6-fa6c-4cc5-9576-459ec47a6b92 +langcode: en +status: true +dependencies: + module: + - link + - node + enforced: + module: + - corporate +id: node.field_company_website +field_name: field_company_website +entity_type: node +type: link +settings: { } +module: link +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/esha/corporate/config/install/field.storage.node.field_designation.yml b/modules/esha/corporate/config/install/field.storage.node.field_designation.yml new file mode 100644 index 0000000..290e6bd --- /dev/null +++ b/modules/esha/corporate/config/install/field.storage.node.field_designation.yml @@ -0,0 +1,24 @@ +uuid: d9a05868-ce4b-438b-a119-010249e41825 +langcode: en +status: true +dependencies: + module: + - node + enforced: + module: + - corporate +id: node.field_designation +field_name: field_designation +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/corporate/config/install/field.storage.node.field_member_image.yml b/modules/esha/corporate/config/install/field.storage.node.field_member_image.yml new file mode 100644 index 0000000..853284c --- /dev/null +++ b/modules/esha/corporate/config/install/field.storage.node.field_member_image.yml @@ -0,0 +1,33 @@ +uuid: 84e3a771-4aa4-4043-9aa2-cd55ab247360 +langcode: en +status: true +dependencies: + module: + - file + - image + - node + enforced: + module: + - corporate +id: node.field_member_image +field_name: field_member_image +entity_type: node +type: image +settings: + uri_scheme: public + default_image: + uuid: a9cd611f-92e3-4762-a504-f6b017a5136c + alt: '' + title: '' + width: 65 + height: 84 + target_type: file + display_field: false + display_default: false +module: image +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/esha/corporate/config/install/image.style.thumbnail.yml b/modules/esha/corporate/config/install/image.style.thumbnail.yml new file mode 100644 index 0000000..7389c76 --- /dev/null +++ b/modules/esha/corporate/config/install/image.style.thumbnail.yml @@ -0,0 +1,20 @@ +uuid: 253400b6-2e54-4c6a-92ba-9ccb091444e2 +langcode: en +status: true +dependencies: + enforced: + module: + - corporate +_core: + default_config_hash: cCiWdBHgLwj5omG35lsKc4LkW4MBdmcctkVop4ol5x0 +name: thumbnail +label: 'Thumbnail (100×100)' +effects: + 1cfec298-8620-4749-b100-ccb6c4500779: + uuid: 1cfec298-8620-4749-b100-ccb6c4500779 + id: image_scale + weight: 0 + data: + width: 100 + height: 100 + upscale: false diff --git a/modules/esha/corporate/config/install/migrate_plus.migration.cab_import.yml b/modules/esha/corporate/config/install/migrate_plus.migration.cab_import.yml new file mode 100644 index 0000000..fbed94a --- /dev/null +++ b/modules/esha/corporate/config/install/migrate_plus.migration.cab_import.yml @@ -0,0 +1,69 @@ +uuid: 52455ef5-b766-4149-94d0-aa2af3ef7639 +id: cab_import +label: cab +migration_group: default +source: + plugin: csv + # Full path to the file. + path: '/var/www/CSV/corp1.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/corporate + file_dest: 'public://member_images/' + file_source2: /var/www/corporate + file_dest2: 'public://company_images/' +process: + type: + plugin: default_value + default_value: corporate_advisory_board + source_path: + - + plugin: skip_on_empty + method: process + source: memberimg + - + plugin: concat + delimiter: / + source: + - constants/file_source + - memberimg + source_path2: + - + plugin: skip_on_empty + method: process + source: companyimg + - + plugin: concat + delimiter: / + source: + - constants/file_source2 + - companyimg + title: title + body/value: body + body/format: + - + plugin: default_value + default_value: basic_html + field_company_website/uri: website + field_designation: designation + field_member_image: + plugin: file_import + source: '@source_path' + destination: constants/file_dest + field_company_image: + plugin: file_import + source: '@source_path2' + destination: constants/file_dest2 +destination: + plugin: 'entity:node' + bundle: corporate_advisory_board +migration_dependencies: + required: { } + optional: { } diff --git a/modules/esha/corporate/config/install/node.type.corporate_advisory_board.yml b/modules/esha/corporate/config/install/node.type.corporate_advisory_board.yml new file mode 100644 index 0000000..5f30bd4 --- /dev/null +++ b/modules/esha/corporate/config/install/node.type.corporate_advisory_board.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - menu_ui + enforced: + module: + - corporate +third_party_settings: + menu_ui: + available_menus: + - main + parent: 'main:' +name: 'Corporate Advisory Board' +type: corporate_advisory_board +description: '' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: false diff --git a/modules/esha/corporate/corporate.info.yml b/modules/esha/corporate/corporate.info.yml new file mode 100644 index 0000000..305c165 --- /dev/null +++ b/modules/esha/corporate/corporate.info.yml @@ -0,0 +1,14 @@ +name: 'corporate' +type: module +description: 'Module for Corporate Advisory Board Content Type' +core: 8.x +package: 'Custom' +dependencies: + - drupal:menu_ui + - drupal:image + - drupal:link + - drupal:path + - drupal:user + - drupal:node + - drupal:image + - drupal:file \ No newline at end of file diff --git a/modules/esha/corporate/corporate.install b/modules/esha/corporate/corporate.install new file mode 100644 index 0000000..2a56fd7 --- /dev/null +++ b/modules/esha/corporate/corporate.install @@ -0,0 +1,22 @@ + +getStorage('node'); + + // Query all entity. + $query = $queryFactory->get('node') +// <-- replace event in below line with your content type machine name + ->condition('type', 'corporate_advisory_board'); + $nids = $query->execute(); + + // Delete entities. + if (!empty($nids)) { + $entities = $nodeStorage->loadMultiple($nids); + $nodeStorage->delete($entities); + } +} diff --git a/modules/esha/corporate/corporate.module b/modules/esha/corporate/corporate.module new file mode 100644 index 0000000..de3e265 --- /dev/null +++ b/modules/esha/corporate/corporate.module @@ -0,0 +1,35 @@ +' . t('About') . ''; + $output .= '

' . t('Module for Corporate Advisory Board Content Type') . '

'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function corporate_theme() { + return [ + 'corporate' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/esha/corporate/templates/corporate.html.twig b/modules/esha/corporate/templates/corporate.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/esha/corporate/templates/corporate.html.twig @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/esha/corporate/tests/src/Functional/LoadTest.php b/modules/esha/corporate/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..8e09521 --- /dev/null +++ b/modules/esha/corporate/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +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('')); + $this->assertSession()->statusCodeEquals(200); + } + +} -- cgit