diff options
Diffstat (limited to 'modules/fahad/facility')
16 files changed, 726 insertions, 0 deletions
diff --git a/modules/fahad/facility/composer.json b/modules/fahad/facility/composer.json new file mode 100644 index 0000000..8429c38 --- /dev/null +++ b/modules/fahad/facility/composer.json @@ -0,0 +1,14 @@ +{ + "name": "drupal/facility", + "type": "drupal-module", + "description": "My Awesome Module", + "keywords": ["Drupal"], + "license": "GPL-2.0+", + "homepage": "https://www.drupal.org/project/facility", + "minimum-stability": "dev", + "support": { + "issues": "https://www.drupal.org/project/issues/facility", + "source": "http://cgit.drupalcode.org/facility" + }, + "require": { } +} diff --git a/modules/fahad/facility/config/install/core.entity_form_display.node.facility.default.yml b/modules/fahad/facility/config/install/core.entity_form_display.node.facility.default.yml new file mode 100644 index 0000000..6be20e0 --- /dev/null +++ b/modules/fahad/facility/config/install/core.entity_form_display.node.facility.default.yml @@ -0,0 +1,105 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.facility.body + - field.field.node.facility.field_facility_ + - field.field.node.facility.field_facility_image + - image.style.thumbnail + - node.type.facility + module: + - image + - link + - path + - text + enforced: + module: + - facility +id: node.facility.default +targetEntityType: node +bundle: facility +mode: default +content: + body: + type: text_textarea_with_summary + weight: 121 + settings: + rows: 9 + summary_rows: 3 + placeholder: '' + third_party_settings: { } + region: content + created: + type: datetime_timestamp + weight: 10 + region: content + settings: { } + third_party_settings: { } + field_facility_: + weight: 123 + settings: + placeholder_url: '' + placeholder_title: '' + third_party_settings: { } + type: link_default + region: content + field_facility_image: + weight: 122 + 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/fahad/facility/config/install/core.entity_view_display.node.facility.default.yml b/modules/fahad/facility/config/install/core.entity_view_display.node.facility.default.yml new file mode 100644 index 0000000..71e3c6f --- /dev/null +++ b/modules/fahad/facility/config/install/core.entity_view_display.node.facility.default.yml @@ -0,0 +1,56 @@ +langcode: en +status: true +dependencies: + config: + - field.field.node.facility.body + - field.field.node.facility.field_facility_ + - field.field.node.facility.field_facility_image + - node.type.facility + module: + - image + - link + - text + - user + enforced: + module: + - facility +id: node.facility.default +targetEntityType: node +bundle: facility +mode: default +content: + body: + label: hidden + type: text_default + weight: 101 + settings: { } + third_party_settings: { } + region: content + field_facility_: + weight: 103 + label: above + settings: + trim_length: 80 + url_only: false + url_plain: false + rel: '' + target: '' + third_party_settings: { } + type: link + region: content + field_facility_image: + weight: 102 + 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/fahad/facility/config/install/core.entity_view_display.node.facility.teaser.yml b/modules/fahad/facility/config/install/core.entity_view_display.node.facility.teaser.yml new file mode 100644 index 0000000..035fe40 --- /dev/null +++ b/modules/fahad/facility/config/install/core.entity_view_display.node.facility.teaser.yml @@ -0,0 +1,33 @@ +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.teaser + - field.field.node.facility.body + - node.type.facility + module: + - text + - user + enforced: + module: + - facility +id: node.facility.teaser +targetEntityType: node +bundle: facility +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/fahad/facility/config/install/field.field.node.facility.body.yml b/modules/fahad/facility/config/install/field.field.node.facility.body.yml new file mode 100644 index 0000000..19634de --- /dev/null +++ b/modules/fahad/facility/config/install/field.field.node.facility.body.yml @@ -0,0 +1,24 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.body + - node.type.facility + module: + - text + enforced: + module: + - facility +id: node.facility.body +field_name: body +entity_type: node +bundle: facility +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/fahad/facility/config/install/field.field.node.facility.field_facility_.yml b/modules/fahad/facility/config/install/field.field.node.facility.field_facility_.yml new file mode 100644 index 0000000..96146f2 --- /dev/null +++ b/modules/fahad/facility/config/install/field.field.node.facility.field_facility_.yml @@ -0,0 +1,25 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_facility_ + - node.type.facility + module: + - link + enforced: + module: + - facility +id: node.facility.field_facility_ +field_name: field_facility_ +entity_type: node +bundle: facility +label: 'facility link' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + link_type: 17 + title: 1 +field_type: link diff --git a/modules/fahad/facility/config/install/field.field.node.facility.field_facility_image.yml b/modules/fahad/facility/config/install/field.field.node.facility.field_facility_image.yml new file mode 100644 index 0000000..3cbc23c --- /dev/null +++ b/modules/fahad/facility/config/install/field.field.node.facility.field_facility_image.yml @@ -0,0 +1,40 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_facility_image + - node.type.facility + module: + - image + enforced: + module: + - facility +id: node.facility.field_facility_image +field_name: field_facility_image +entity_type: node +bundle: facility +label: 'facility image' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + file_directory: '[date:custom:Y]-[date:custom:m]' + 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/fahad/facility/config/install/field.storage.node.field_facility_.yml b/modules/fahad/facility/config/install/field.storage.node.field_facility_.yml new file mode 100644 index 0000000..02b2c92 --- /dev/null +++ b/modules/fahad/facility/config/install/field.storage.node.field_facility_.yml @@ -0,0 +1,22 @@ +uuid: 0fb10736-72c3-46f9-bd50-0380df9ca0e8 +langcode: en +status: true +dependencies: + module: + - link + - node + enforced: + module: + - facility +id: node.field_facility_ +field_name: field_facility_ +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/fahad/facility/config/install/field.storage.node.field_facility_image.yml b/modules/fahad/facility/config/install/field.storage.node.field_facility_image.yml new file mode 100644 index 0000000..b1dc938 --- /dev/null +++ b/modules/fahad/facility/config/install/field.storage.node.field_facility_image.yml @@ -0,0 +1,33 @@ +uuid: e5ae6aa1-7ca8-47bb-99a1-926d47c3427f +langcode: en +status: true +dependencies: + module: + - file + - image + - node + enforced: + module: + - facility +id: node.field_facility_image +field_name: field_facility_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/fahad/facility/config/install/migrate_plus.migration.facilities.yml b/modules/fahad/facility/config/install/migrate_plus.migration.facilities.yml new file mode 100644 index 0000000..37ea4de --- /dev/null +++ b/modules/fahad/facility/config/install/migrate_plus.migration.facilities.yml @@ -0,0 +1,46 @@ +langcode: en +status: true +dependencies: { } +id: facilities +class: null +field_plugin_method: null +cck_plugin_method: null +migration_tags: null +migration_group: null +label: 'Custom Content migration from CSV Facility' +source: + plugin: csv + path: /var/www/html/project/docroot/facility.csv + header_row_count: 1 + keys: + - id + constants: + file_source: /var/www/html/project/docroot/fac_images + file_dest: 'public://fac_images/' +process: + type: + plugin: default_value + default_value: facility + source_path: + - + plugin: skip_on_empty + method: process + source: phuto + - + plugin: concat + delimiter: / + source: + - constants/file_source + - phuto + title: title + body: body + field_facility_: email + field_facility_image: + plugin: file_import + source: '@source_path' + destination: constants/file_dest +destination: + plugin: 'entity:node' +migration_dependencies: + required: { } + optional: { } diff --git a/modules/fahad/facility/config/install/node.type.facility.yml b/modules/fahad/facility/config/install/node.type.facility.yml new file mode 100644 index 0000000..37eee05 --- /dev/null +++ b/modules/fahad/facility/config/install/node.type.facility.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - menu_ui + enforced: + module: + - facility +third_party_settings: + menu_ui: + available_menus: + - main + parent: 'main:' +name: Facility +type: facility +description: '' +help: '' +new_revision: true +preview_mode: 1 +display_submitted: true diff --git a/modules/fahad/facility/config/install/views.view.facilities.yml b/modules/fahad/facility/config/install/views.view.facilities.yml new file mode 100644 index 0000000..3049f64 --- /dev/null +++ b/modules/fahad/facility/config/install/views.view.facilities.yml @@ -0,0 +1,212 @@ +langcode: en +status: true +dependencies: + config: + - node.type.facility + - system.menu.main + module: + - node + - user + - views_bootstrap +id: facilities +label: Facilities +module: views +description: '' +tag: '' +base_table: node_field_data +base_field: nid +core: 8.x +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: perm + options: + perm: 'access content' + cache: + type: tag + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: mini + options: + items_per_page: 10 + offset: 0 + id: 0 + total_pages: null + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + tags: + previous: ‹‹ + next: ›› + style: + type: views_bootstrap_grid + options: + row_class: '' + default_row_class: true + uses_fields: false + alignment: horizontal + columns: '2' + col_xs: col-xs-6 + col_sm: col-sm-6 + col_md: col-md-6 + col_lg: col-lg-6 + row: + type: 'entity:node' + options: + relationship: none + view_mode: default + fields: + title: + id: title + table: node_field_data + field: title + entity_type: node + entity_field: title + label: '' + alter: + alter_text: false + make_link: false + absolute: false + trim: false + word_boundary: false + ellipsis: false + strip_tags: false + html: false + hide_empty: false + empty_zero: false + settings: + link_to_entity: true + plugin_id: field + relationship: none + group_type: group + admin_label: '' + exclude: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_alter_empty: true + click_sort_column: value + type: string + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + filters: + status: + value: '1' + table: node_field_data + field: status + plugin_id: boolean + entity_type: node + entity_field: status + id: status + expose: + operator: '' + group: 1 + type: + id: type + table: node_field_data + field: type + value: + facility: facility + entity_type: node + entity_field: type + plugin_id: bundle + sorts: + created: + id: created + table: node_field_data + field: created + order: DESC + entity_type: node + entity_field: created + plugin_id: date + relationship: none + group_type: group + admin_label: '' + exposed: false + expose: + label: '' + granularity: second + title: Facilities + header: { } + footer: { } + empty: { } + relationships: { } + arguments: { } + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: { } + page_1: + display_plugin: page + id: page_1 + display_title: Page + position: 1 + display_options: + display_extenders: { } + path: facilities + menu: + type: normal + title: Facilities + description: '' + expanded: true + parent: '' + weight: -38 + context: '0' + menu_name: main + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: { } diff --git a/modules/fahad/facility/facility.info.yml b/modules/fahad/facility/facility.info.yml new file mode 100644 index 0000000..97a55f0 --- /dev/null +++ b/modules/fahad/facility/facility.info.yml @@ -0,0 +1,14 @@ +name: 'facility' +type: module +description: 'My Awesome Module' +core: 8.x +package: 'Custom' +dependencies: + - drupal:text + - drupal:image + - drupal:link + - drupal:path + - drupal:user + - drupal:node + - drupal:file + - drupal:menu_ui diff --git a/modules/fahad/facility/facility.module b/modules/fahad/facility/facility.module new file mode 100644 index 0000000..ee4bd23 --- /dev/null +++ b/modules/fahad/facility/facility.module @@ -0,0 +1,35 @@ +<?php + +/** + * @file + * Contains facility.module. + */ + +use Drupal\Core\Routing\RouteMatchInterface; + +/** + * Implements hook_help(). + */ +function facility_help($route_name, RouteMatchInterface $route_match) { + switch ($route_name) { + // Main module help for the facility module. + case 'help.page.facility': + $output = ''; + $output .= '<h3>' . t('About') . '</h3>'; + $output .= '<p>' . t('My Awesome Module') . '</p>'; + return $output; + + default: + } +} + +/** + * Implements hook_theme(). + */ +function facility_theme() { + return [ + 'facility' => [ + 'render element' => 'children', + ], + ]; +} diff --git a/modules/fahad/facility/templates/facility.html.twig b/modules/fahad/facility/templates/facility.html.twig new file mode 100644 index 0000000..91e43c8 --- /dev/null +++ b/modules/fahad/facility/templates/facility.html.twig @@ -0,0 +1 @@ +<!-- Add you custom twig html here -->
\ No newline at end of file diff --git a/modules/fahad/facility/tests/src/Functional/LoadTest.php b/modules/fahad/facility/tests/src/Functional/LoadTest.php new file mode 100644 index 0000000..10db5fe --- /dev/null +++ b/modules/fahad/facility/tests/src/Functional/LoadTest.php @@ -0,0 +1,46 @@ +<?php + +namespace Drupal\Tests\facility\Functional; + +use Drupal\Core\Url; +use Drupal\Tests\BrowserTestBase; + +/** + * Simple test to ensure that main page loads with module enabled. + * + * @group facility + */ +class LoadTest extends BrowserTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['facility']; + + /** + * 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); + } + +} |