From 565af64fc81211897625be2b000a28c910174edb Mon Sep 17 00:00:00 2001 From: Bhavika-keswani Date: Tue, 2 Jul 2019 12:41:45 +0530 Subject: Custom modules added --- modules/bhavika/photo_gallery/composer.json | 13 +++++ ...ity_form_display.node.photo_gallery.default.yml | 52 +++++++++++++++++ ...ity_view_display.node.photo_gallery.default.yml | 68 ++++++++++++++++++++++ ...tity_view_display.node.photo_gallery.teaser.yml | 21 +++++++ .../field.field.node.photo_gallery.body.yml | 24 ++++++++ ....node.photo_gallery.field_photo_gallery_img.yml | 40 +++++++++++++ .../field.storage.node.field_photo_gallery_img.yml | 36 ++++++++++++ ...migrate_plus.migration.photo_gallery_import.yml | 51 ++++++++++++++++ .../config/install/node.type.photo_gallery.yml | 20 +++++++ .../bhavika/photo_gallery/photo_gallery.info.yml | 18 ++++++ .../bhavika/photo_gallery/photo_gallery.install | 63 ++++++++++++++++++++ modules/bhavika/photo_gallery/photo_gallery.module | 35 +++++++++++ .../photo_gallery/photo_gallery.routing.yml | 8 +++ .../src/Controller/PhotoGalleryController.php | 25 ++++++++ .../templates/photo-gallery.html.twig | 1 + .../Controller/PhotoGalleryControllerTest.php | 39 +++++++++++++ .../tests/src/Functional/LoadTest.php | 46 +++++++++++++++ 17 files changed, 560 insertions(+) create mode 100644 modules/bhavika/photo_gallery/composer.json create mode 100644 modules/bhavika/photo_gallery/config/install/core.entity_form_display.node.photo_gallery.default.yml create mode 100644 modules/bhavika/photo_gallery/config/install/core.entity_view_display.node.photo_gallery.default.yml create mode 100644 modules/bhavika/photo_gallery/config/install/core.entity_view_display.node.photo_gallery.teaser.yml create mode 100644 modules/bhavika/photo_gallery/config/install/field.field.node.photo_gallery.body.yml create mode 100644 modules/bhavika/photo_gallery/config/install/field.field.node.photo_gallery.field_photo_gallery_img.yml create mode 100644 modules/bhavika/photo_gallery/config/install/field.storage.node.field_photo_gallery_img.yml create mode 100644 modules/bhavika/photo_gallery/config/install/migrate_plus.migration.photo_gallery_import.yml create mode 100644 modules/bhavika/photo_gallery/config/install/node.type.photo_gallery.yml create mode 100644 modules/bhavika/photo_gallery/photo_gallery.info.yml create mode 100644 modules/bhavika/photo_gallery/photo_gallery.install create mode 100644 modules/bhavika/photo_gallery/photo_gallery.module create mode 100644 modules/bhavika/photo_gallery/photo_gallery.routing.yml create mode 100644 modules/bhavika/photo_gallery/src/Controller/PhotoGalleryController.php create mode 100644 modules/bhavika/photo_gallery/templates/photo-gallery.html.twig create mode 100644 modules/bhavika/photo_gallery/tests/Controller/PhotoGalleryControllerTest.php create mode 100644 modules/bhavika/photo_gallery/tests/src/Functional/LoadTest.php (limited to 'modules/bhavika/photo_gallery') diff --git a/modules/bhavika/photo_gallery/composer.json b/modules/bhavika/photo_gallery/composer.json new file mode 100644 index 0000000..4e0d603 --- /dev/null +++ b/modules/bhavika/photo_gallery/composer.json @@ -0,0 +1,13 @@ +{ + "name": "photo_gallery", + "type": "drupal-module", + "description": "This module is for various pictures uploaded on site", + "keywords": [ + ], + "homepage": "https://www.drupal.org/project/photo_gallery", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/photo_gallery", + "source": "http://cgit.drupalcode.org/photo_gallery", + }, +} diff --git a/modules/bhavika/photo_gallery/config/install/core.entity_form_display.node.photo_gallery.default.yml b/modules/bhavika/photo_gallery/config/install/core.entity_form_display.node.photo_gallery.default.yml new file mode 100644 index 0000000..494750a --- /dev/null +++ b/modules/bhavika/photo_gallery/config/install/core.entity_form_display.node.photo_gallery.default.yml @@ -0,0 +1,52 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.photo_gallery.body + - field.field.node.photo_gallery.field_photo_gallery_img + - image.style.thumbnail + - node.type.photo_gallery + module: + - image + - text + enforced: + module: + - photo_gallery +id: node.photo_gallery.default +targetEntityType: node +bundle: photo_gallery +mode: default +content: + body: + weight: 26 + settings: + rows: 9 + summary_rows: 3 + placeholder: '' + third_party_settings: { } + type: text_textarea_with_summary + region: content + field_photo_gallery_img: + weight: 1 + settings: + progress_indicator: throbber + preview_image_style: thumbnail + third_party_settings: { } + type: image_image + region: content + title: + type: string_textfield + weight: 0 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } +hidden: + created: true + langcode: true + path: true + promote: true + status: true + sticky: true + uid: true diff --git a/modules/bhavika/photo_gallery/config/install/core.entity_view_display.node.photo_gallery.default.yml b/modules/bhavika/photo_gallery/config/install/core.entity_view_display.node.photo_gallery.default.yml new file mode 100644 index 0000000..6cf56ae --- /dev/null +++ b/modules/bhavika/photo_gallery/config/install/core.entity_view_display.node.photo_gallery.default.yml @@ -0,0 +1,68 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.photo_gallery.body + - field.field.node.photo_gallery.field_photo_gallery_img + - node.type.photo_gallery + module: + - ds + - image + - text + - user + enforced: + module: + - photo_gallery +id: node.photo_gallery.default +targetEntityType: node +bundle: photo_gallery +mode: default +content: + body: + weight: 1 + label: above + settings: { } + third_party_settings: { } + type: text_default + region: content + field_photo_gallery_img: + weight: 0 + label: hidden + settings: + image_style: '' + image_link: '' + third_party_settings: + ds: + ds_limit: '' + ft: + id: expert + settings: + lb: '' + prefix: '' + lbw-el: '' + lbw-cl: '' + lbw-at: '' + ow: true + ow-el: div + ow-cl: mb-10 + ow-at: '' + fis: true + fis-el: div + fis-cl: 'row col-sm-4' + fis-at: '' + fi-el: '' + fi-cl: '' + fi-at: '' + suffix: '' + lbw: false + lb-col: false + ow-def-at: false + ow-def-cl: false + fis-def-at: false + fi: false + fi-def-at: false + type: image + region: content +hidden: + langcode: true + links: true diff --git a/modules/bhavika/photo_gallery/config/install/core.entity_view_display.node.photo_gallery.teaser.yml b/modules/bhavika/photo_gallery/config/install/core.entity_view_display.node.photo_gallery.teaser.yml new file mode 100644 index 0000000..54960ee --- /dev/null +++ b/modules/bhavika/photo_gallery/config/install/core.entity_view_display.node.photo_gallery.teaser.yml @@ -0,0 +1,21 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.photo_gallery.field_photo_gallery_img + - node.type.photo_gallery + module: + - user + enforced: + module: + - photo_gallery +id: node.photo_gallery.teaser +targetEntityType: node +bundle: photo_gallery +mode: teaser +content: { } +hidden: + field_photo_gallery_img: true + langcode: true + links: true diff --git a/modules/bhavika/photo_gallery/config/install/field.field.node.photo_gallery.body.yml b/modules/bhavika/photo_gallery/config/install/field.field.node.photo_gallery.body.yml new file mode 100644 index 0000000..b9fcc71 --- /dev/null +++ b/modules/bhavika/photo_gallery/config/install/field.field.node.photo_gallery.body.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.body + - node.type.photo_gallery + module: + - text + enforced: + module: + - photo_gallery +id: node.photo_gallery.body +field_name: body +entity_type: node +bundle: photo_gallery +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/bhavika/photo_gallery/config/install/field.field.node.photo_gallery.field_photo_gallery_img.yml b/modules/bhavika/photo_gallery/config/install/field.field.node.photo_gallery.field_photo_gallery_img.yml new file mode 100644 index 0000000..a3bc37f --- /dev/null +++ b/modules/bhavika/photo_gallery/config/install/field.field.node.photo_gallery.field_photo_gallery_img.yml @@ -0,0 +1,40 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_photo_gallery_img + - node.type.photo_gallery + module: + - image + enforced: + module: + - photo_gallery +id: node.photo_gallery.field_photo_gallery_img +field_name: field_photo_gallery_img +entity_type: node +bundle: photo_gallery +label: photo_gallery_img +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: photogallery + 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/bhavika/photo_gallery/config/install/field.storage.node.field_photo_gallery_img.yml b/modules/bhavika/photo_gallery/config/install/field.storage.node.field_photo_gallery_img.yml new file mode 100644 index 0000000..5c16698 --- /dev/null +++ b/modules/bhavika/photo_gallery/config/install/field.storage.node.field_photo_gallery_img.yml @@ -0,0 +1,36 @@ +langcode: en +status: true +dependencies: + module: + # - field_permissions + - file + - image + - node + enforced: + module: + - photo_gallery +# third_party_settings: +# field_permissions: +# permission_type: public +id: node.field_photo_gallery_img +field_name: field_photo_gallery_img +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/bhavika/photo_gallery/config/install/migrate_plus.migration.photo_gallery_import.yml b/modules/bhavika/photo_gallery/config/install/migrate_plus.migration.photo_gallery_import.yml new file mode 100644 index 0000000..636478a --- /dev/null +++ b/modules/bhavika/photo_gallery/config/install/migrate_plus.migration.photo_gallery_import.yml @@ -0,0 +1,51 @@ +uuid: 5eb7bd1c-4d96-4ff1-b6a0-c30d3bb141f0 +language: en +migration_group: default +id: photo_gallery_import +label: 'photo_gallery_import' +source: + plugin: csv + path: /var/www/photogallery/csv/pg.csv + delimiter: ',' + enclosure: '"' + header_row_count: 1 + keys: + - id + constants: + file_source: /var/www/photogallery/images + file_dest: 'public://photo/' +process: + type: + plugin: default_value + default_value: photo_gallery + source_path: + - + plugin: skip_on_empty + method: process + source: image + - + plugin: concat + delimiter: / + source: + - constants/file_source + - image + title: title + body/value: body + body/format: + plugin: default_value + default_value: basic_html + field_photo_gallery_img: + - + plugin: explode + delimiter: ',' + source: image + - + plugin: file_import + # source: '@source_path' + destination: constants/file_dest +destination: + plugin: 'entity:node' + bundle: photo_gallery +migration_dependencies: + required: { } + optional: { } \ No newline at end of file diff --git a/modules/bhavika/photo_gallery/config/install/node.type.photo_gallery.yml b/modules/bhavika/photo_gallery/config/install/node.type.photo_gallery.yml new file mode 100644 index 0000000..f666180 --- /dev/null +++ b/modules/bhavika/photo_gallery/config/install/node.type.photo_gallery.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - menu_ui + enforced: + module: + - photo_gallery +# third_party_settings: +# menu_ui: +# available_menus: +# - main +# parent: 'main:' +name: 'Photo Gallery' +type: photo_gallery +description: '' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: true diff --git a/modules/bhavika/photo_gallery/photo_gallery.info.yml b/modules/bhavika/photo_gallery/photo_gallery.info.yml new file mode 100644 index 0000000..2cbcca6 --- /dev/null +++ b/modules/bhavika/photo_gallery/photo_gallery.info.yml @@ -0,0 +1,18 @@ +name: photo_gallery +type: module +description: 'This module is for various pictures uploaded on site' +core: 8.x +package: Custom +dependencies: + - drupal:node + - drupal:text + - drupal:image + - drupal:file + - drupal:user + - drupal:menu_ui + - drupal:taxonomy + - drupal:options + - drupal:path + - ds:ds + - pathauto:pathauto + diff --git a/modules/bhavika/photo_gallery/photo_gallery.install b/modules/bhavika/photo_gallery/photo_gallery.install new file mode 100644 index 0000000..4c95c95 --- /dev/null +++ b/modules/bhavika/photo_gallery/photo_gallery.install @@ -0,0 +1,63 @@ +getStorage('node'); + + + + + + + + // Query all entity. + + + $query = $queryFactory->get('node') +// <-- replace event in below line with your content type machine name + + + ->condition('type', 'photo_gallert'); + + + $nids = $query->execute(); + + + + + + + + // Delete entities. + + + if (!empty($nids)) { + + + $entities = $nodeStorage->loadMultiple($nids); + + + $nodeStorage->delete($entities); + + + } + + +} diff --git a/modules/bhavika/photo_gallery/photo_gallery.module b/modules/bhavika/photo_gallery/photo_gallery.module new file mode 100644 index 0000000..17bce25 --- /dev/null +++ b/modules/bhavika/photo_gallery/photo_gallery.module @@ -0,0 +1,35 @@ +' . t('About') . ''; + $output .= '
' . t('This module is for various pictures uploaded on site') . '
'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function photo_gallery_theme() { + return [ + 'photo_gallery' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/bhavika/photo_gallery/photo_gallery.routing.yml b/modules/bhavika/photo_gallery/photo_gallery.routing.yml new file mode 100644 index 0000000..cb0a3fb --- /dev/null +++ b/modules/bhavika/photo_gallery/photo_gallery.routing.yml @@ -0,0 +1,8 @@ + +photo_gallery.photo_gallery_controller_photo_gallery: + path: '/photo_gallery' + defaults: + _controller: '\Drupal\photo_gallery\Controller\PhotoGalleryController::photo_gallery' + _title: 'Photo Gallery Module' + requirements: + _permission: 'access content' diff --git a/modules/bhavika/photo_gallery/src/Controller/PhotoGalleryController.php b/modules/bhavika/photo_gallery/src/Controller/PhotoGalleryController.php new file mode 100644 index 0000000..02aca82 --- /dev/null +++ b/modules/bhavika/photo_gallery/src/Controller/PhotoGalleryController.php @@ -0,0 +1,25 @@ + 'markup', + '#markup' => $this->t('Implement method: photo_gallery') + ]; + } + +} diff --git a/modules/bhavika/photo_gallery/templates/photo-gallery.html.twig b/modules/bhavika/photo_gallery/templates/photo-gallery.html.twig new file mode 100644 index 0000000..95722bd --- /dev/null +++ b/modules/bhavika/photo_gallery/templates/photo-gallery.html.twig @@ -0,0 +1 @@ + diff --git a/modules/bhavika/photo_gallery/tests/Controller/PhotoGalleryControllerTest.php b/modules/bhavika/photo_gallery/tests/Controller/PhotoGalleryControllerTest.php new file mode 100644 index 0000000..5dd8f26 --- /dev/null +++ b/modules/bhavika/photo_gallery/tests/Controller/PhotoGalleryControllerTest.php @@ -0,0 +1,39 @@ + "photo_gallery PhotoGalleryController's controller functionality", + 'description' => 'Test Unit for module photo_gallery and controller PhotoGalleryController.', + 'group' => 'Other', + ]; + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + } + + /** + * Tests photo_gallery functionality. + */ + public function testPhotoGalleryController() { + // Check that the basic functions of module photo_gallery. + $this->assertEquals(TRUE, TRUE, 'Test Unit Generated via Drupal Console.'); + } + +} diff --git a/modules/bhavika/photo_gallery/tests/src/Functional/LoadTest.php b/modules/bhavika/photo_gallery/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..dfe0211 --- /dev/null +++ b/modules/bhavika/photo_gallery/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('