summaryrefslogtreecommitdiff
path: root/modules/bhavika/photo_gallery
diff options
context:
space:
mode:
authorNitesh Kumar Sinha2019-07-02 13:32:26 +0530
committerGitHub2019-07-02 13:32:26 +0530
commit222f1780ed0f5c3536392df3236284d3a9ab5405 (patch)
tree582f05cc645901dfeb002ed3fe856e642a79835d /modules/bhavika/photo_gallery
parent2ab059c88b1353a8e382f302ce9c2b6c2ef018ad (diff)
parent565af64fc81211897625be2b000a28c910174edb (diff)
downloadacadmix_distribution-222f1780ed0f5c3536392df3236284d3a9ab5405.tar.gz
acadmix_distribution-222f1780ed0f5c3536392df3236284d3a9ab5405.tar.bz2
acadmix_distribution-222f1780ed0f5c3536392df3236284d3a9ab5405.zip
Merge pull request #7 from Bhavika-keswani/master
Bhavika-Custom modules added
Diffstat (limited to 'modules/bhavika/photo_gallery')
-rw-r--r--modules/bhavika/photo_gallery/composer.json13
-rw-r--r--modules/bhavika/photo_gallery/config/install/core.entity_form_display.node.photo_gallery.default.yml52
-rw-r--r--modules/bhavika/photo_gallery/config/install/core.entity_view_display.node.photo_gallery.default.yml68
-rw-r--r--modules/bhavika/photo_gallery/config/install/core.entity_view_display.node.photo_gallery.teaser.yml21
-rw-r--r--modules/bhavika/photo_gallery/config/install/field.field.node.photo_gallery.body.yml24
-rw-r--r--modules/bhavika/photo_gallery/config/install/field.field.node.photo_gallery.field_photo_gallery_img.yml40
-rw-r--r--modules/bhavika/photo_gallery/config/install/field.storage.node.field_photo_gallery_img.yml36
-rw-r--r--modules/bhavika/photo_gallery/config/install/migrate_plus.migration.photo_gallery_import.yml51
-rw-r--r--modules/bhavika/photo_gallery/config/install/node.type.photo_gallery.yml20
-rw-r--r--modules/bhavika/photo_gallery/photo_gallery.info.yml18
-rw-r--r--modules/bhavika/photo_gallery/photo_gallery.install63
-rw-r--r--modules/bhavika/photo_gallery/photo_gallery.module35
-rw-r--r--modules/bhavika/photo_gallery/photo_gallery.routing.yml8
-rw-r--r--modules/bhavika/photo_gallery/src/Controller/PhotoGalleryController.php25
-rw-r--r--modules/bhavika/photo_gallery/templates/photo-gallery.html.twig1
-rw-r--r--modules/bhavika/photo_gallery/tests/Controller/PhotoGalleryControllerTest.php39
-rw-r--r--modules/bhavika/photo_gallery/tests/src/Functional/LoadTest.php46
17 files changed, 560 insertions, 0 deletions
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 @@
+<?php
+
+
+/**
+
+
+* Implements hook_uninstall().
+
+
+*/
+
+
+function photo_gallery_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', '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 @@
+<?php
+
+/**
+ * @file
+ * Contains photo_gallery.module.
+ */
+
+use Drupal\Core\Routing\RouteMatchInterface;
+
+/**
+ * Implements hook_help().
+ */
+function photo_gallery_help($route_name, RouteMatchInterface $route_match) {
+ switch ($route_name) {
+ // Main module help for the photo_gallery module.
+ case 'help.page.photo_gallery':
+ $output = '';
+ $output .= '<h3>' . t('About') . '</h3>';
+ $output .= '<p>' . t('This module is for various pictures uploaded on site') . '</p>';
+ 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 @@
+<?php
+
+namespace Drupal\photo_gallery\Controller;
+
+use Drupal\Core\Controller\ControllerBase;
+
+/**
+ * Class PhotoGalleryController.
+ */
+class PhotoGalleryController extends ControllerBase {
+
+ /**
+ * Photo_gallery.
+ *
+ * @return string
+ * Return Hello string.
+ */
+ public function photo_gallery() {
+ return [
+ '#type' => '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 @@
+<!-- Add you custom twig html here -->
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 @@
+<?php
+
+namespace Drupal\photo_gallery\Tests;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Provides automated tests for the photo_gallery module.
+ */
+class PhotoGalleryControllerTest extends WebTestBase {
+
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getInfo() {
+ return [
+ 'name' => "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 @@
+<?php
+
+namespace Drupal\Tests\photo_gallery\Functional;
+
+use Drupal\Core\Url;
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Simple test to ensure that main page loads with module enabled.
+ *
+ * @group photo_gallery
+ */
+class LoadTest extends BrowserTestBase {
+
+ /**
+ * Modules to enable.
+ *
+ * @var array
+ */
+ public static $modules = ['photo_gallery'];
+
+ /**
+ * 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);
+ }
+
+}