DEV-NOTES:
-
Add the entries
james-searchandjames-search-resultsto your page template.
If you need JamesSearch on all pages, add the entries to the filetemplates/layout/base.html.twig.
-
Live data is now the default!
By default, JamesSearch uses the live API endpoint via the following data attributes:
data-url="https://beta-admin.james-search.com/api/v1/search?access-token=f304203d-b9b2-4602-9493-164fb2a94667"
data-tracking-url="https://beta-admin.james-search.com/api/v1/search/tracking?access-token=f304203d-b9b2-4602-9493-164fb2a94667"
No further configuration is needed for live search.
-
Switching to dummy data (optional):
If you want to use local dummy data for development, change the data attributes to:
data-url="/api/james-search/suggest"
data-tracking-url="/api/james-search/tracking"
These are defined intemplates/partials/james-search/attributes.html.twig.
You may also need to configure$responsesPathinphp/Api/Action/JamesSearch.phpto point to your dummy responses directory.
For example:$responsesPath = __DIR__ . '/../../../storage/private/james-search/';
The subfolder structure should matchvendor/james-search.com/james-search.com-ui-component/api-dummy/responsesand filenames should represent the queries.
As a quickstart, copy the dummy responses and modify as needed.
Don't forget to whitelist the path in.gitignore.
- Documentation, samples and inputs available for testing: james-search.com-ui-component.netigo.dev.
-
Important: The delimiters in template are
<%and%>. To avoid escaping when rendering, use an ampersand<%&. BE
For a solution without james-search, click here.
James-Search in Modal:
To place James-Search (form & suggest-box) in a modal, please follow these instructions:
-
Create a new BS-modal for James-Search inside a new file:
templates/partials/modal/james-search.html.twig. -
Add to the modal an id e.g.
jamesSearchModal. -
Copy the James Search
james-search-ui-componentsnippet from heretemplates/partials/header/header.html.twigand paste it inside themodal-body. -
Change the James Search form id e.g.
modal-james-search-form. -
Add the James Search option
targetand its selector (container) e.g.data-target="#search-box-wrapper". -
Append to the
modal-bodythe container (target) element with the defined idsearch-box-wrapper. -
Add the modal to the DOM by including it to this file
templates/layout/base.html.twig. (insidebody-container) -
trigger the modal e.g.
data-bs-target="#jamesSearchModal".
Auto Suggest: Works only with dummy data, since this feature is not yet implemented from backend.