summaryrefslogtreecommitdiff
path: root/modules/bhavika/company
diff options
context:
space:
mode:
Diffstat (limited to 'modules/bhavika/company')
-rw-r--r--modules/bhavika/company/company.info.yml18
-rw-r--r--modules/bhavika/company/company.install64
-rw-r--r--modules/bhavika/company/company.module35
-rw-r--r--modules/bhavika/company/company.routing.yml8
-rw-r--r--modules/bhavika/company/composer.json13
-rw-r--r--modules/bhavika/company/config/install/core.entity_form_display.node.companies.default.yml105
-rw-r--r--modules/bhavika/company/config/install/core.entity_view_display.node.companies.default.yml56
-rw-r--r--modules/bhavika/company/config/install/core.entity_view_display.node.companies.teaser.yml33
-rw-r--r--modules/bhavika/company/config/install/core.entity_view_mode.node.teaser.yml12
-rw-r--r--modules/bhavika/company/config/install/field.field.node.companies.body.yml24
-rw-r--r--modules/bhavika/company/config/install/field.field.node.companies.field_company_link.yml25
-rw-r--r--modules/bhavika/company/config/install/field.field.node.companies.field_logo.yml40
-rw-r--r--modules/bhavika/company/config/install/field.storage.node.body.yml25
-rw-r--r--modules/bhavika/company/config/install/field.storage.node.field_company_link.yml21
-rw-r--r--modules/bhavika/company/config/install/field.storage.node.field_logo.yml36
-rw-r--r--modules/bhavika/company/config/install/image.style.thumbnail.yml17
-rw-r--r--modules/bhavika/company/config/install/migrate_plus.migration.company_import.yml50
-rw-r--r--modules/bhavika/company/config/install/node.type.companies.yml20
-rw-r--r--modules/bhavika/company/src/Controller/CompanyController.php25
-rw-r--r--modules/bhavika/company/templates/company.html.twig1
-rw-r--r--modules/bhavika/company/tests/Controller/CompanyControllerTest.php39
-rw-r--r--modules/bhavika/company/tests/src/Functional/LoadTest.php46
22 files changed, 713 insertions, 0 deletions
diff --git a/modules/bhavika/company/company.info.yml b/modules/bhavika/company/company.info.yml
new file mode 100644
index 0000000..3132ff7
--- /dev/null
+++ b/modules/bhavika/company/company.info.yml
@@ -0,0 +1,18 @@
+name: company
+type: module
+description: 'Company module is for companies content type for placements'
+core: 8.x
+package: Custom
+dependencies:
+ - drupal:node
+ - drupal:text
+ - drupal:user
+ - drupal:image
+ - drupal:link
+ - drupal:menu_ui
+ - drupal:taxonomy
+ - drupal:options
+ - drupal:path
+ - ds:ds
+ - pathauto:pathauto
+
diff --git a/modules/bhavika/company/company.install b/modules/bhavika/company/company.install
new file mode 100644
index 0000000..09b0cb0
--- /dev/null
+++ b/modules/bhavika/company/company.install
@@ -0,0 +1,64 @@
+
+<?php
+
+
+/**
+
+
+* Implements hook_uninstall().
+
+
+*/
+
+
+function company_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', 'companies');
+
+
+ $nids = $query->execute();
+
+
+
+
+
+
+
+ // Delete entities.
+
+
+ if (!empty($nids)) {
+
+
+ $entities = $nodeStorage->loadMultiple($nids);
+
+
+ $nodeStorage->delete($entities);
+
+
+ }
+
+
+}
diff --git a/modules/bhavika/company/company.module b/modules/bhavika/company/company.module
new file mode 100644
index 0000000..b060f46
--- /dev/null
+++ b/modules/bhavika/company/company.module
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * @file
+ * Contains company.module.
+ */
+
+use Drupal\Core\Routing\RouteMatchInterface;
+
+/**
+ * Implements hook_help().
+ */
+function company_help($route_name, RouteMatchInterface $route_match) {
+ switch ($route_name) {
+ // Main module help for the company module.
+ case 'help.page.company':
+ $output = '';
+ $output .= '<h3>' . t('About') . '</h3>';
+ $output .= '<p>' . t('Company module is for companies content type for placements') . '</p>';
+ return $output;
+
+ default:
+ }
+}
+
+/**
+ * Implements hook_theme().
+ */
+function company_theme() {
+ return [
+ 'company' => [
+ 'render element' => 'children',
+ ],
+ ];
+}
diff --git a/modules/bhavika/company/company.routing.yml b/modules/bhavika/company/company.routing.yml
new file mode 100644
index 0000000..1997efb
--- /dev/null
+++ b/modules/bhavika/company/company.routing.yml
@@ -0,0 +1,8 @@
+
+company.company_controller_company_43:
+ path: '/company_'
+ defaults:
+ _controller: '\Drupal\company\Controller\CompanyController::company'
+ _title: 'Company Module'
+ requirements:
+ _permission: 'access content'
diff --git a/modules/bhavika/company/composer.json b/modules/bhavika/company/composer.json
new file mode 100644
index 0000000..4158875
--- /dev/null
+++ b/modules/bhavika/company/composer.json
@@ -0,0 +1,13 @@
+{
+ "name": "company",
+ "type": "drupal-module",
+ "description": "Company module is for companies content type for placements",
+ "keywords": [
+ ],
+ "homepage": "https://www.drupal.org/project/company",
+ "minimum-stability": "dev",
+ "support": {
+ "issues": "https://www.drupal.org/project/issues/company",
+ "source": "http://cgit.drupalcode.org/company",
+ },
+}
diff --git a/modules/bhavika/company/config/install/core.entity_form_display.node.companies.default.yml b/modules/bhavika/company/config/install/core.entity_form_display.node.companies.default.yml
new file mode 100644
index 0000000..d8dc6ea
--- /dev/null
+++ b/modules/bhavika/company/config/install/core.entity_form_display.node.companies.default.yml
@@ -0,0 +1,105 @@
+langcode: en
+status: true
+dependencies:
+ config:
+ - field.field.node.companies.body
+ - field.field.node.companies.field_company_link
+ - field.field.node.companies.field_logo
+ - image.style.thumbnail
+ - node.type.companies
+ module:
+ - image
+ - link
+ - path
+ - text
+ enforced:
+ module:
+ - company
+id: node.companies.default
+targetEntityType: node
+bundle: companies
+mode: default
+content:
+ body:
+ type: text_textarea_with_summary
+ weight: 9
+ 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_company_link:
+ weight: 10
+ settings:
+ placeholder_url: ''
+ placeholder_title: ''
+ third_party_settings: { }
+ type: link_default
+ region: content
+ field_logo:
+ weight: 8
+ settings:
+ progress_indicator: throbber
+ preview_image_style: thumbnail
+ third_party_settings: { }
+ type: image_image
+ 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/company/config/install/core.entity_view_display.node.companies.default.yml b/modules/bhavika/company/config/install/core.entity_view_display.node.companies.default.yml
new file mode 100644
index 0000000..0f620cf
--- /dev/null
+++ b/modules/bhavika/company/config/install/core.entity_view_display.node.companies.default.yml
@@ -0,0 +1,56 @@
+langcode: en
+status: true
+dependencies:
+ config:
+ - field.field.node.companies.body
+ - field.field.node.companies.field_company_link
+ - field.field.node.companies.field_logo
+ - node.type.companies
+ module:
+ - image
+ - link
+ - text
+ - user
+ enforced:
+ module:
+ - company
+id: node.companies.default
+targetEntityType: node
+bundle: companies
+mode: default
+content:
+ body:
+ label: hidden
+ type: text_default
+ weight: 2
+ settings: { }
+ third_party_settings: { }
+ region: content
+ field_company_link:
+ weight: 3
+ label: hidden
+ settings:
+ trim_length: 80
+ url_only: false
+ url_plain: false
+ rel: ''
+ target: ''
+ third_party_settings: { }
+ type: link
+ region: content
+ field_logo:
+ weight: 1
+ label: hidden
+ settings:
+ image_style: ''
+ image_link: ''
+ third_party_settings: { }
+ type: image
+ region: content
+ links:
+ weight: 0
+ region: content
+ settings: { }
+ third_party_settings: { }
+hidden:
+ langcode: true
diff --git a/modules/bhavika/company/config/install/core.entity_view_display.node.companies.teaser.yml b/modules/bhavika/company/config/install/core.entity_view_display.node.companies.teaser.yml
new file mode 100644
index 0000000..8a0b84a
--- /dev/null
+++ b/modules/bhavika/company/config/install/core.entity_view_display.node.companies.teaser.yml
@@ -0,0 +1,33 @@
+langcode: en
+status: true
+dependencies:
+ config:
+ - core.entity_view_mode.node.teaser
+ - field.field.node.companies.body
+ - node.type.companies
+ module:
+ - text
+ - user
+ enforced:
+ module:
+ - company
+id: node.companies.teaser
+targetEntityType: node
+bundle: companies
+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/company/config/install/core.entity_view_mode.node.teaser.yml b/modules/bhavika/company/config/install/core.entity_view_mode.node.teaser.yml
new file mode 100644
index 0000000..6114f1f
--- /dev/null
+++ b/modules/bhavika/company/config/install/core.entity_view_mode.node.teaser.yml
@@ -0,0 +1,12 @@
+langcode: en
+status: true
+dependencies:
+ module:
+ - node
+ enforced:
+ module:
+ - company
+id: node.teaser
+label: Teaser
+targetEntityType: node
+cache: true
diff --git a/modules/bhavika/company/config/install/field.field.node.companies.body.yml b/modules/bhavika/company/config/install/field.field.node.companies.body.yml
new file mode 100644
index 0000000..47c8791
--- /dev/null
+++ b/modules/bhavika/company/config/install/field.field.node.companies.body.yml
@@ -0,0 +1,24 @@
+langcode: en
+status: true
+dependencies:
+ config:
+ - field.storage.node.body
+ - node.type.companies
+ module:
+ - text
+ enforced:
+ module:
+ - company
+id: node.companies.body
+field_name: body
+entity_type: node
+bundle: companies
+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/company/config/install/field.field.node.companies.field_company_link.yml b/modules/bhavika/company/config/install/field.field.node.companies.field_company_link.yml
new file mode 100644
index 0000000..f10a0ea
--- /dev/null
+++ b/modules/bhavika/company/config/install/field.field.node.companies.field_company_link.yml
@@ -0,0 +1,25 @@
+langcode: en
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_company_link
+ - node.type.companies
+ module:
+ - link
+ enforced:
+ module:
+ - company
+id: node.companies.field_company_link
+field_name: field_company_link
+entity_type: node
+bundle: companies
+label: company_link
+description: ''
+required: false
+translatable: false
+default_value: { }
+default_value_callback: ''
+settings:
+ link_type: 17
+ title: 1
+field_type: link
diff --git a/modules/bhavika/company/config/install/field.field.node.companies.field_logo.yml b/modules/bhavika/company/config/install/field.field.node.companies.field_logo.yml
new file mode 100644
index 0000000..f1df5b8
--- /dev/null
+++ b/modules/bhavika/company/config/install/field.field.node.companies.field_logo.yml
@@ -0,0 +1,40 @@
+langcode: en
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_logo
+ - node.type.companies
+ module:
+ - image
+ enforced:
+ module:
+ - company
+id: node.companies.field_logo
+field_name: field_logo
+entity_type: node
+bundle: companies
+label: logo
+description: ''
+required: false
+translatable: false
+default_value: { }
+default_value_callback: ''
+settings:
+ file_directory: company
+ 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/company/config/install/field.storage.node.body.yml b/modules/bhavika/company/config/install/field.storage.node.body.yml
new file mode 100644
index 0000000..e9f95b6
--- /dev/null
+++ b/modules/bhavika/company/config/install/field.storage.node.body.yml
@@ -0,0 +1,25 @@
+langcode: en
+status: true
+dependencies:
+ module:
+ # - field_permissions
+ - node
+ - text
+ enforced:
+ module:
+ - company
+# third_party_settings:
+# field_permissions:
+# permission_type: public
+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/company/config/install/field.storage.node.field_company_link.yml b/modules/bhavika/company/config/install/field.storage.node.field_company_link.yml
new file mode 100644
index 0000000..e5072b2
--- /dev/null
+++ b/modules/bhavika/company/config/install/field.storage.node.field_company_link.yml
@@ -0,0 +1,21 @@
+langcode: en
+status: true
+dependencies:
+ module:
+ - link
+ - node
+ enforced:
+ module:
+ - company
+id: node.field_company_link
+field_name: field_company_link
+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/bhavika/company/config/install/field.storage.node.field_logo.yml b/modules/bhavika/company/config/install/field.storage.node.field_logo.yml
new file mode 100644
index 0000000..a62c720
--- /dev/null
+++ b/modules/bhavika/company/config/install/field.storage.node.field_logo.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:
+ - company
+id: node.field_logo
+field_name: field_logo
+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/company/config/install/image.style.thumbnail.yml b/modules/bhavika/company/config/install/image.style.thumbnail.yml
new file mode 100644
index 0000000..946d0cd
--- /dev/null
+++ b/modules/bhavika/company/config/install/image.style.thumbnail.yml
@@ -0,0 +1,17 @@
+langcode: en
+status: true
+dependencies:
+ enforced:
+ module:
+ - company
+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/company/config/install/migrate_plus.migration.company_import.yml b/modules/bhavika/company/config/install/migrate_plus.migration.company_import.yml
new file mode 100644
index 0000000..25ebd55
--- /dev/null
+++ b/modules/bhavika/company/config/install/migrate_plus.migration.company_import.yml
@@ -0,0 +1,50 @@
+uuid: 1141ae0c-c5ac-4b8a-87a0-5a42d2504519
+language: en
+migration_group: default
+id: company_import
+class: null
+field_plugin_method: null
+cck_plugin_method: null
+label: 'company_import'
+source:
+ plugin: csv
+ path: /var/www/companies/csv files/company.csv
+ delimiter: ','
+ enclosure: '"'
+ header_row_count: 1
+ keys:
+ - id
+ constants:
+ file_source: /var/www/companies/images
+ file_dest: 'public://company/'
+process:
+ type:
+ plugin: default_value
+ default_value: companies
+ source_path:
+ -
+ plugin: skip_on_empty
+ method: process
+ source: logo
+ -
+ plugin: concat
+ delimiter: /
+ source:
+ - constants/file_source
+ - logo
+ title: title
+ body/value: body
+ body/format:
+ plugin: default_value
+ default_value: basic_html
+ field_company_link: link
+ field_logo:
+ plugin: file_import
+ source: '@source_path'
+ destination: constants/file_dest
+destination:
+ plugin: 'entity:node'
+ bundle: companies
+migration_dependencies:
+ required: { }
+ optional: { } \ No newline at end of file
diff --git a/modules/bhavika/company/config/install/node.type.companies.yml b/modules/bhavika/company/config/install/node.type.companies.yml
new file mode 100644
index 0000000..7552b9e
--- /dev/null
+++ b/modules/bhavika/company/config/install/node.type.companies.yml
@@ -0,0 +1,20 @@
+langcode: en
+status: true
+dependencies:
+ module:
+ - menu_ui
+ enforced:
+ module:
+ - company
+# 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/company/src/Controller/CompanyController.php b/modules/bhavika/company/src/Controller/CompanyController.php
new file mode 100644
index 0000000..3d0956d
--- /dev/null
+++ b/modules/bhavika/company/src/Controller/CompanyController.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace Drupal\company\Controller;
+
+use Drupal\Core\Controller\ControllerBase;
+
+/**
+ * Class CompanyController.
+ */
+class CompanyController extends ControllerBase {
+
+ /**
+ * Company.
+ *
+ * @return string
+ * Return Hello string.
+ */
+ public function company() {
+ return [
+ '#type' => 'markup',
+ '#markup' => $this->t('Implement method: company')
+ ];
+ }
+
+}
diff --git a/modules/bhavika/company/templates/company.html.twig b/modules/bhavika/company/templates/company.html.twig
new file mode 100644
index 0000000..95722bd
--- /dev/null
+++ b/modules/bhavika/company/templates/company.html.twig
@@ -0,0 +1 @@
+<!-- Add you custom twig html here -->
diff --git a/modules/bhavika/company/tests/Controller/CompanyControllerTest.php b/modules/bhavika/company/tests/Controller/CompanyControllerTest.php
new file mode 100644
index 0000000..66debed
--- /dev/null
+++ b/modules/bhavika/company/tests/Controller/CompanyControllerTest.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace Drupal\company\Tests;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Provides automated tests for the company module.
+ */
+class CompanyControllerTest extends WebTestBase {
+
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function getInfo() {
+ return [
+ 'name' => "company CompanyController's controller functionality",
+ 'description' => 'Test Unit for module company and controller CompanyController.',
+ 'group' => 'Other',
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setUp() {
+ parent::setUp();
+ }
+
+ /**
+ * Tests company functionality.
+ */
+ public function testCompanyController() {
+ // Check that the basic functions of module company.
+ $this->assertEquals(TRUE, TRUE, 'Test Unit Generated via Drupal Console.');
+ }
+
+}
diff --git a/modules/bhavika/company/tests/src/Functional/LoadTest.php b/modules/bhavika/company/tests/src/Functional/LoadTest.php
new file mode 100644
index 0000000..15e82ca
--- /dev/null
+++ b/modules/bhavika/company/tests/src/Functional/LoadTest.php
@@ -0,0 +1,46 @@
+<?php
+
+namespace Drupal\Tests\company\Functional;
+
+use Drupal\Core\Url;
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Simple test to ensure that main page loads with module enabled.
+ *
+ * @group company
+ */
+class LoadTest extends BrowserTestBase {
+
+ /**
+ * Modules to enable.
+ *
+ * @var array
+ */
+ public static $modules = ['company'];
+
+ /**
+ * 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);
+ }
+
+}