diff options
Diffstat (limited to 'modules/bhavika/department')
27 files changed, 866 insertions, 0 deletions
diff --git a/modules/bhavika/department/composer.json b/modules/bhavika/department/composer.json new file mode 100644 index 0000000..a25a506 --- /dev/null +++ b/modules/bhavika/department/composer.json @@ -0,0 +1,13 @@ +{ + "name": "department", + "type": "drupal-module", + "description": "Department module is for department content type", + "keywords": [ + ], + "homepage": "https://www.drupal.org/project/department", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/department", + "source": "http://cgit.drupalcode.org/department", + }, +} diff --git a/modules/bhavika/department/config/install/core.entity_form_display.node.department.default.yml b/modules/bhavika/department/config/install/core.entity_form_display.node.department.default.yml new file mode 100644 index 0000000..bfaccb6 --- /dev/null +++ b/modules/bhavika/department/config/install/core.entity_form_display.node.department.default.yml @@ -0,0 +1,125 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.department.body + - field.field.node.department.field_dept_image + - field.field.node.department.field_dept_mission + - field.field.node.department.field_facilities + - field.field.node.department.field_placements + - image.style.thumbnail + - node.type.department + module: + - image + - path + - text + enforced: + module: + - department +id: node.department.default +targetEntityType: node +bundle: department +mode: default +content: + body: + type: text_textarea_with_summary + weight: 8 + settings: + rows: 9 + summary_rows: 3 + placeholder: '' + third_party_settings: { } + region: content + created: + type: datetime_timestamp + weight: 3 + region: content + settings: { } + third_party_settings: { } + field_dept_image: + weight: 9 + settings: + progress_indicator: throbber + preview_image_style: thumbnail + third_party_settings: { } + type: image_image + region: content + field_dept_mission: + weight: 12 + settings: + rows: 9 + summary_rows: 3 + placeholder: '' + third_party_settings: { } + type: text_textarea_with_summary + region: content + field_facilities: + weight: 10 + settings: + rows: 9 + summary_rows: 3 + placeholder: '' + third_party_settings: { } + type: text_textarea_with_summary + region: content + field_placements: + weight: 13 + settings: + match_operator: CONTAINS + size: 60 + placeholder: '' + third_party_settings: { } + type: entity_reference_autocomplete + region: content + langcode: + type: language_select + weight: 1 + region: content + settings: + include_locked: true + third_party_settings: { } + path: + type: path + weight: 6 + region: content + settings: { } + third_party_settings: { } + promote: + type: boolean_checkbox + settings: + display_label: true + weight: 4 + region: content + third_party_settings: { } + status: + type: boolean_checkbox + settings: + display_label: true + weight: 7 + region: content + third_party_settings: { } + sticky: + type: boolean_checkbox + settings: + display_label: true + weight: 5 + region: content + third_party_settings: { } + title: + type: string_textfield + weight: 0 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } + uid: + type: entity_reference_autocomplete + weight: 2 + settings: + match_operator: CONTAINS + size: 60 + placeholder: '' + region: content + third_party_settings: { } +hidden: { } diff --git a/modules/bhavika/department/config/install/core.entity_view_display.node.department.default.yml b/modules/bhavika/department/config/install/core.entity_view_display.node.department.default.yml new file mode 100644 index 0000000..cfff6fc --- /dev/null +++ b/modules/bhavika/department/config/install/core.entity_view_display.node.department.default.yml @@ -0,0 +1,67 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.department.body + - field.field.node.department.field_dept_image + - field.field.node.department.field_dept_mission + - field.field.node.department.field_facilities + - field.field.node.department.field_placements + - node.type.department + module: + - image + - text + - user + enforced: + module: + - department +id: node.department.default +targetEntityType: node +bundle: department +mode: default +content: + body: + label: hidden + type: text_default + weight: 2 + settings: { } + third_party_settings: { } + region: content + field_dept_image: + weight: 1 + label: hidden + settings: + image_style: '' + image_link: '' + third_party_settings: { } + type: image + region: content + field_dept_mission: + weight: 5 + label: hidden + settings: { } + third_party_settings: { } + type: text_default + region: content + field_facilities: + weight: 3 + label: above + settings: { } + third_party_settings: { } + type: text_default + region: content + field_placements: + weight: 6 + label: above + settings: + link: true + third_party_settings: { } + type: entity_reference_label + region: content + links: + weight: 0 + region: content + settings: { } + third_party_settings: { } +hidden: + langcode: true diff --git a/modules/bhavika/department/config/install/core.entity_view_display.node.department.teaser.yml b/modules/bhavika/department/config/install/core.entity_view_display.node.department.teaser.yml new file mode 100644 index 0000000..28c59d7 --- /dev/null +++ b/modules/bhavika/department/config/install/core.entity_view_display.node.department.teaser.yml @@ -0,0 +1,33 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.department.body + - node.type.department + module: + - text + - user + enforced: + module: + - department +id: node.department.teaser +targetEntityType: node +bundle: department +mode: teaser +content: + body: + label: hidden + type: text_summary_or_trimmed + weight: 101 + settings: + trim_length: 600 + third_party_settings: { } + region: content + links: + weight: 100 + settings: { } + third_party_settings: { } + region: content +hidden: + langcode: true diff --git a/modules/bhavika/department/config/install/core.entity_view_mode.node.teaser.yml b/modules/bhavika/department/config/install/core.entity_view_mode.node.teaser.yml new file mode 100644 index 0000000..22f411b --- /dev/null +++ b/modules/bhavika/department/config/install/core.entity_view_mode.node.teaser.yml @@ -0,0 +1,12 @@ +langcode: en +status: true +dependencies: + module: + - node + enforced: + module: + - department +id: node.teaser +label: Teaser +targetEntityType: node +cache: true diff --git a/modules/bhavika/department/config/install/field.field.node.department.body.yml b/modules/bhavika/department/config/install/field.field.node.department.body.yml new file mode 100644 index 0000000..fb7688f --- /dev/null +++ b/modules/bhavika/department/config/install/field.field.node.department.body.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.body + - node.type.department + module: + - text + enforced: + module: + - department +id: node.department.body +field_name: body +entity_type: node +bundle: department +label: Body +description: '' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: + display_summary: true +field_type: text_with_summary diff --git a/modules/bhavika/department/config/install/field.field.node.department.field_dept_image.yml b/modules/bhavika/department/config/install/field.field.node.department.field_dept_image.yml new file mode 100644 index 0000000..02ffffd --- /dev/null +++ b/modules/bhavika/department/config/install/field.field.node.department.field_dept_image.yml @@ -0,0 +1,40 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_dept_image + - node.type.department + module: + - image + enforced: + module: + - department +id: node.department.field_dept_image +field_name: field_dept_image +entity_type: node +bundle: department +label: dept_image +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: department + 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/department/config/install/field.field.node.department.field_dept_mission.yml b/modules/bhavika/department/config/install/field.field.node.department.field_dept_mission.yml new file mode 100644 index 0000000..a49ab2d --- /dev/null +++ b/modules/bhavika/department/config/install/field.field.node.department.field_dept_mission.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_dept_mission + - node.type.department + module: + - text + enforced: + module: + - department +id: node.department.field_dept_mission +field_name: field_dept_mission +entity_type: node +bundle: department +label: dept_mission +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + display_summary: false +field_type: text_with_summary diff --git a/modules/bhavika/department/config/install/field.field.node.department.field_facilities.yml b/modules/bhavika/department/config/install/field.field.node.department.field_facilities.yml new file mode 100644 index 0000000..24c2776 --- /dev/null +++ b/modules/bhavika/department/config/install/field.field.node.department.field_facilities.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_facilities + - node.type.department + module: + - text + enforced: + module: + - department +id: node.department.field_facilities +field_name: field_facilities +entity_type: node +bundle: department +label: facilities +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + display_summary: false +field_type: text_with_summary diff --git a/modules/bhavika/department/config/install/field.field.node.department.field_placements.yml b/modules/bhavika/department/config/install/field.field.node.department.field_placements.yml new file mode 100644 index 0000000..b242908 --- /dev/null +++ b/modules/bhavika/department/config/install/field.field.node.department.field_placements.yml @@ -0,0 +1,31 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_placements + - node.type.companies + - node.type.department + enforced: + module: + - department + - company +id: node.department.field_placements +field_name: field_placements +entity_type: node +bundle: department +label: placements +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + handler: 'default:node' + handler_settings: + target_bundles: + companies: companies + sort: + field: _none + auto_create: false + auto_create_bundle: '' +field_type: entity_reference diff --git a/modules/bhavika/department/config/install/field.storage.node.body.yml b/modules/bhavika/department/config/install/field.storage.node.body.yml new file mode 100644 index 0000000..1d190e7 --- /dev/null +++ b/modules/bhavika/department/config/install/field.storage.node.body.yml @@ -0,0 +1,25 @@ +langcode: en +status: true +dependencies: + module: + # - field_permissions + - node + - text +# third_party_settings: +# field_permissions: +# permission_type: public + enforced: + module: + - department +id: node.body +field_name: body +entity_type: node +type: text_with_summary +settings: { } +module: text +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: true +custom_storage: false diff --git a/modules/bhavika/department/config/install/field.storage.node.field_dept_image.yml b/modules/bhavika/department/config/install/field.storage.node.field_dept_image.yml new file mode 100644 index 0000000..23ef815 --- /dev/null +++ b/modules/bhavika/department/config/install/field.storage.node.field_dept_image.yml @@ -0,0 +1,36 @@ +langcode: en +status: true +dependencies: + module: + # - field_permissions + - file + - image + - node +# third_party_settings: +# field_permissions: +# permission_type: public + enforced: + module: + - department +id: node.field_dept_image +field_name: field_dept_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/bhavika/department/config/install/field.storage.node.field_dept_mission.yml b/modules/bhavika/department/config/install/field.storage.node.field_dept_mission.yml new file mode 100644 index 0000000..031ec1f --- /dev/null +++ b/modules/bhavika/department/config/install/field.storage.node.field_dept_mission.yml @@ -0,0 +1,21 @@ +langcode: en +status: true +dependencies: + module: + - node + - text + enforced: + module: + - department +id: node.field_dept_mission +field_name: field_dept_mission +entity_type: node +type: text_with_summary +settings: { } +module: text +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/bhavika/department/config/install/field.storage.node.field_facilities.yml b/modules/bhavika/department/config/install/field.storage.node.field_facilities.yml new file mode 100644 index 0000000..3900da7 --- /dev/null +++ b/modules/bhavika/department/config/install/field.storage.node.field_facilities.yml @@ -0,0 +1,21 @@ +langcode: en +status: true +dependencies: + module: + - node + - text + enforced: + module: + - department +id: node.field_facilities +field_name: field_facilities +entity_type: node +type: text_with_summary +settings: { } +module: text +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/bhavika/department/config/install/field.storage.node.field_placements.yml b/modules/bhavika/department/config/install/field.storage.node.field_placements.yml new file mode 100644 index 0000000..42483fb --- /dev/null +++ b/modules/bhavika/department/config/install/field.storage.node.field_placements.yml @@ -0,0 +1,21 @@ +langcode: en +status: true +dependencies: + module: + - node + enforced: + module: + - department +id: node.field_placements +field_name: field_placements +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/bhavika/department/config/install/image.style.thumbnail.yml b/modules/bhavika/department/config/install/image.style.thumbnail.yml new file mode 100644 index 0000000..2eda95b --- /dev/null +++ b/modules/bhavika/department/config/install/image.style.thumbnail.yml @@ -0,0 +1,17 @@ +langcode: en +status: true +dependencies: + enforced: + module: + - department +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/bhavika/department/config/install/migrate_plus.migration.department_import.yml b/modules/bhavika/department/config/install/migrate_plus.migration.department_import.yml new file mode 100644 index 0000000..a4d03ca --- /dev/null +++ b/modules/bhavika/department/config/install/migrate_plus.migration.department_import.yml @@ -0,0 +1,57 @@ +uuid: 5ce25402-34a6-46ee-aeef-3920e2cd0cb6 +language: en +migration_group: default +id: department_import +class: null +field_plugin_method: null +cck_plugin_method: null +label: 'department_import' +source: + plugin: csv + path: /var/www/Department/csv files/department.csv + delimiter: ',' + enclosure: '"' + header_row_count: 1 + keys: + - id + constants: + file_source: /var/www/Department/image + file_dest: 'public://department/' +process: + type: + plugin: default_value + default_value: department + source_path: + - + plugin: skip_on_empty + method: process + source: img + - + plugin: concat + delimiter: / + source: + - constants/file_source + - img + title: title + body/value: body + body/format: + plugin: default_value + default_value: full_html + field_dept_image: + plugin: file_import + source: '@source_path' + destination: constants/file_dest + field_dept_mission: mission + field_facilities/value: facilities + field_placements: + - + plugin: entity_lookup + entity_type: node + bundle: companies + source: placements +destination: + plugin: 'entity:node' + bundle: department +migration_dependencies: + required: { } + optional: { }
\ No newline at end of file diff --git a/modules/bhavika/department/config/install/node.type.companies.yml b/modules/bhavika/department/config/install/node.type.companies.yml new file mode 100644 index 0000000..6c8b80c --- /dev/null +++ b/modules/bhavika/department/config/install/node.type.companies.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - menu_ui + enforced: + module: + - department +# third_party_settings: +# menu_ui: +# available_menus: +# - main +# parent: 'main:' +name: Companies +type: companies +description: 'This is the content template for the various companies that visit L.D.C.E for Placements.' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: true diff --git a/modules/bhavika/department/config/install/node.type.department.yml b/modules/bhavika/department/config/install/node.type.department.yml new file mode 100644 index 0000000..4337ba1 --- /dev/null +++ b/modules/bhavika/department/config/install/node.type.department.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - menu_ui + enforced: + module: + - department +# third_party_settings: +# menu_ui: +# available_menus: +# - main +# parent: 'main:' +name: Department +type: department +description: 'This content type provides the information about the various department of L.D.C.E' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: true diff --git a/modules/bhavika/department/department.info.yml b/modules/bhavika/department/department.info.yml new file mode 100644 index 0000000..50cb4df --- /dev/null +++ b/modules/bhavika/department/department.info.yml @@ -0,0 +1,18 @@ +name: department +type: module +description: 'Department module is for department content type' +core: 8.x +package: Custom +dependencies: + - drupal:node + - drupal:text + - drupal:image + - drupal:user + - drupal:menu_ui + - drupal:taxonomy + - drupal:options + - drupal:path + - drupal:file + - ds:ds + - pathauto:pathauto + diff --git a/modules/bhavika/department/department.install b/modules/bhavika/department/department.install new file mode 100644 index 0000000..7ea1cea --- /dev/null +++ b/modules/bhavika/department/department.install @@ -0,0 +1,63 @@ +<?php + + +/** + + +* Implements hook_uninstall(). + + +*/ + + +function department_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', 'department'); + + + $nids = $query->execute(); + + + + + + + + // Delete entities. + + + if (!empty($nids)) { + + + $entities = $nodeStorage->loadMultiple($nids); + + + $nodeStorage->delete($entities); + + + } + + +} diff --git a/modules/bhavika/department/department.module b/modules/bhavika/department/department.module new file mode 100644 index 0000000..5d0dd00 --- /dev/null +++ b/modules/bhavika/department/department.module @@ -0,0 +1,35 @@ +<?php + +/** + * @file + * Contains department.module. + */ + +use Drupal\Core\Routing\RouteMatchInterface; + +/** + * Implements hook_help(). + */ +function department_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + // Main module help for the department module. + case 'help.page.department': + $output = ''; + $output .= '<h3>' . t('About') . '</h3>'; + $output .= '<p>' . t('Department module is for department content type') . '</p>'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function department_theme() { + return [ + 'department' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/bhavika/department/department.routing.yml b/modules/bhavika/department/department.routing.yml new file mode 100644 index 0000000..37f6dea --- /dev/null +++ b/modules/bhavika/department/department.routing.yml @@ -0,0 +1,8 @@ + +department.department_controller_department: + path: '/department_' + defaults: + _controller: '\Drupal\department\Controller\DepartmentController::department' + _title: 'Department Module' + requirements: + _permission: 'access content' diff --git a/modules/bhavika/department/src/Controller/DepartmentController.php b/modules/bhavika/department/src/Controller/DepartmentController.php new file mode 100644 index 0000000..58741f3 --- /dev/null +++ b/modules/bhavika/department/src/Controller/DepartmentController.php @@ -0,0 +1,25 @@ +<?php + +namespace Drupal\department\Controller; + +use Drupal\Core\Controller\ControllerBase; + +/** + * Class DepartmentController. + */ +class DepartmentController extends ControllerBase { + + /** + * Department. + * + * @return string + * Return Hello string. + */ + public function department() { + return [ + '#type' => 'markup', + '#markup' => $this->t('Implement method: department') + ]; + } + +} diff --git a/modules/bhavika/department/templates/department.html.twig b/modules/bhavika/department/templates/department.html.twig new file mode 100644 index 0000000..95722bd --- /dev/null +++ b/modules/bhavika/department/templates/department.html.twig @@ -0,0 +1 @@ +<!-- Add you custom twig html here --> diff --git a/modules/bhavika/department/tests/Controller/DepartmentControllerTest.php b/modules/bhavika/department/tests/Controller/DepartmentControllerTest.php new file mode 100644 index 0000000..8d7a0be --- /dev/null +++ b/modules/bhavika/department/tests/Controller/DepartmentControllerTest.php @@ -0,0 +1,39 @@ +<?php + +namespace Drupal\department\Tests; + +use Drupal\simpletest\WebTestBase; + +/** + * Provides automated tests for the department module. + */ +class DepartmentControllerTest extends WebTestBase { + + + /** + * {@inheritdoc} + */ + public static function getInfo() { + return [ + 'name' => "department DepartmentController's controller functionality", + 'description' => 'Test Unit for module department and controller DepartmentController.', + 'group' => 'Other', + ]; + } + + /** + * {@inheritdoc} + */ + public function setUp() { + parent::setUp(); + } + + /** + * Tests department functionality. + */ + public function testDepartmentController() { + // Check that the basic functions of module department. + $this->assertEquals(TRUE, TRUE, 'Test Unit Generated via Drupal Console.'); + } + +} diff --git a/modules/bhavika/department/tests/src/Functional/LoadTest.php b/modules/bhavika/department/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..423abc0 --- /dev/null +++ b/modules/bhavika/department/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +<?php + +namespace Drupal\Tests\department\Functional; + +use Drupal\Core\Url; +use Drupal\Tests\BrowserTestBase; + +/** + * Simple test to ensure that main page loads with module enabled. + * + * @group department + */ +class LoadTest extends BrowserTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['department']; + + /** + * 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); + } + +} |