Added search module with database server, Person index and view
This commit is contained in:
parent
b629a13ec8
commit
f764ed5670
@ -0,0 +1,34 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- search_api.server.zencrm_server
|
||||
module:
|
||||
- search_api
|
||||
- zencrm_entities
|
||||
id: person_index
|
||||
name: 'Person Index'
|
||||
description: ''
|
||||
read_only: false
|
||||
field_settings:
|
||||
full_name:
|
||||
label: 'Full Name'
|
||||
datasource_id: 'entity:person'
|
||||
property_path: full_name
|
||||
type: text
|
||||
datasource_settings:
|
||||
'entity:person':
|
||||
languages:
|
||||
default: true
|
||||
selected: { }
|
||||
processor_settings:
|
||||
rendered_item: { }
|
||||
aggregated_field: { }
|
||||
add_url: { }
|
||||
tracker_settings:
|
||||
default:
|
||||
indexing_order: fifo
|
||||
options:
|
||||
index_directly: true
|
||||
cron_limit: 50
|
||||
server: zencrm_server
|
@ -0,0 +1,16 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- search_api_db
|
||||
id: zencrm_server
|
||||
name: 'Zen CRM Server'
|
||||
description: ''
|
||||
backend: search_api_db
|
||||
backend_config:
|
||||
database: 'default:default'
|
||||
min_chars: 3
|
||||
partial_matches: false
|
||||
autocomplete:
|
||||
suggest_suffix: true
|
||||
suggest_words: true
|
@ -0,0 +1,230 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- search_api.index.person_index
|
||||
module:
|
||||
- search_api
|
||||
id: person_search
|
||||
label: 'Person Search'
|
||||
module: views
|
||||
description: ''
|
||||
tag: ''
|
||||
base_table: search_api_index_person_index
|
||||
base_field: search_api_id
|
||||
core: 8.x
|
||||
display:
|
||||
default:
|
||||
display_plugin: default
|
||||
id: default
|
||||
display_title: Master
|
||||
position: 0
|
||||
display_options:
|
||||
access:
|
||||
type: none
|
||||
options: { }
|
||||
cache:
|
||||
type: tag
|
||||
options: { }
|
||||
query:
|
||||
type: views_query
|
||||
options:
|
||||
bypass_access: false
|
||||
skip_access: false
|
||||
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: 20
|
||||
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: default
|
||||
row:
|
||||
type: fields
|
||||
fields:
|
||||
full_name:
|
||||
id: full_name
|
||||
table: search_api_index_person_index
|
||||
field: full_name
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: ''
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: false
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: string
|
||||
settings:
|
||||
link_to_entity: true
|
||||
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
|
||||
field_rendering: true
|
||||
fallback_handler: search_api
|
||||
fallback_options:
|
||||
link_to_item: false
|
||||
use_highlighting: false
|
||||
multi_type: separator
|
||||
multi_separator: ', '
|
||||
entity_type: null
|
||||
entity_field: null
|
||||
plugin_id: search_api_field
|
||||
filters:
|
||||
search_api_fulltext:
|
||||
id: search_api_fulltext
|
||||
table: search_api_index_person_index
|
||||
field: search_api_fulltext
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
operator: or
|
||||
value: ''
|
||||
group: 1
|
||||
exposed: true
|
||||
expose:
|
||||
operator_id: search_api_fulltext_op
|
||||
label: 'Search for People'
|
||||
description: ''
|
||||
use_operator: false
|
||||
operator: search_api_fulltext_op
|
||||
identifier: search_api_fulltext
|
||||
required: false
|
||||
remember: false
|
||||
multiple: false
|
||||
remember_roles:
|
||||
authenticated: authenticated
|
||||
anonymous: '0'
|
||||
administrator: '0'
|
||||
standard_user: '0'
|
||||
is_grouped: false
|
||||
group_info:
|
||||
label: ''
|
||||
description: ''
|
||||
identifier: ''
|
||||
optional: true
|
||||
widget: select
|
||||
multiple: false
|
||||
remember: false
|
||||
default_group: All
|
||||
default_group_multiple: { }
|
||||
group_items: { }
|
||||
parse_mode: terms
|
||||
min_length: null
|
||||
fields: { }
|
||||
plugin_id: search_api_fulltext
|
||||
sorts: { }
|
||||
title: 'Person Search'
|
||||
header: { }
|
||||
footer: { }
|
||||
empty: { }
|
||||
relationships: { }
|
||||
arguments: { }
|
||||
display_extenders: { }
|
||||
use_ajax: true
|
||||
cache_metadata:
|
||||
max-age: -1
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
- url
|
||||
- url.query_args
|
||||
tags: { }
|
||||
block_1:
|
||||
display_plugin: block
|
||||
id: block_1
|
||||
display_title: Block
|
||||
position: 2
|
||||
display_options:
|
||||
display_extenders: { }
|
||||
cache_metadata:
|
||||
max-age: -1
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
- url
|
||||
- url.query_args
|
||||
tags: { }
|
||||
page_1:
|
||||
display_plugin: page
|
||||
id: page_1
|
||||
display_title: Page
|
||||
position: 1
|
||||
display_options:
|
||||
display_extenders: { }
|
||||
path: person-search
|
||||
exposed_block: true
|
||||
cache_metadata:
|
||||
max-age: -1
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
- url
|
||||
- url.query_args
|
||||
tags: { }
|
1
modules/zencrm_search/templates/zen-crm-search.html.twig
Normal file
1
modules/zencrm_search/templates/zen-crm-search.html.twig
Normal file
@ -0,0 +1 @@
|
||||
<!-- Add you custom twig html here -->
|
46
modules/zencrm_search/tests/src/Functional/LoadTest.php
Normal file
46
modules/zencrm_search/tests/src/Functional/LoadTest.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\zencrm_search\Functional;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
/**
|
||||
* Simple test to ensure that main page loads with module enabled.
|
||||
*
|
||||
* @group zencrm_search
|
||||
*/
|
||||
class LoadTest extends BrowserTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['zencrm_search'];
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
}
|
9
modules/zencrm_search/zencrm_search.info.yml
Normal file
9
modules/zencrm_search/zencrm_search.info.yml
Normal file
@ -0,0 +1,9 @@
|
||||
name: 'Zen CRM Search'
|
||||
type: module
|
||||
description: 'Provides search functionality for Zen CRM'
|
||||
core: 8.x
|
||||
package: 'Zen CRM'
|
||||
dependencies:
|
||||
- zencrm_entities
|
||||
- search_api
|
||||
- search_api_db
|
35
modules/zencrm_search/zencrm_search.module
Normal file
35
modules/zencrm_search/zencrm_search.module
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains zencrm_search.module.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
*/
|
||||
function zencrm_search_help($route_name, RouteMatchInterface $route_match) {
|
||||
switch ($route_name) {
|
||||
// Main module help for the zencrm_search module.
|
||||
case 'help.page.zencrm_search':
|
||||
$output = '';
|
||||
$output .= '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('Provides search functionality for Zen CRM') . '</p>';
|
||||
return $output;
|
||||
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_theme().
|
||||
*/
|
||||
function zencrm_search_theme() {
|
||||
return [
|
||||
'zencrm_search' => [
|
||||
'render element' => 'children',
|
||||
],
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user