Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/youwegit/pimcorehreftypeahead
Adds typeahead functionality to href fields using a modified default search functionality
https://github.com/youwegit/pimcorehreftypeahead
href-typeahead pimcore pimcore-bundle
Last synced: about 2 months ago
JSON representation
Adds typeahead functionality to href fields using a modified default search functionality
- Host: GitHub
- URL: https://github.com/youwegit/pimcorehreftypeahead
- Owner: YouweGit
- Created: 2017-02-03T14:59:01.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-01-09T14:48:00.000Z (12 months ago)
- Last Synced: 2024-08-10T07:27:58.916Z (5 months ago)
- Topics: href-typeahead, pimcore, pimcore-bundle
- Language: PHP
- Homepage:
- Size: 838 KB
- Stars: 2
- Watchers: 11
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Href typeahead field type
![Demo](Docs/demo.gif)Adds typeahead functionality to href fields using a modified default search functionality
I temporary made documents and assets read only field in field configurator to prevent users to
select assets as a valid link at static/js/pimcore/object/classes/data/hrefTypeahead.js, but i didn't want
to remove it because maybe we will add functionality to support assets and document
Also i added validation to prevent users to select more then one class### Install
```bash
composer require youwe/pimcore-href-typeahead
```### Usage
The HrefTypeahead field will be available to use in your model classes, it's similar to href, but has
typeahead functionality.### Configuration
When using the HrefAutocomplete in your model, you can use the "show_trigger" option by checking the checkbox.
This will display a little dropdown icon, so you can click this instead of typing in the box.### Files
- static/js/pimcore/object/classes/data/hrefTypeahead.js
- An exact copy of default href
- static/js/pimcore/object/tags/hrefTypeahead.js
- An exact copy of default href, with the change that textbox is now a combo with autocomplete provided by SearchController::findAction
- models/Pimcore/Model/Object/ClassDefinition/Data/HrefTypeahead.php
- An exact copy of default href
- HrefTypeahead/controllers/SearchController.php
- A controller containing autocomplete source
### Events
When you want to add some extra filters to the search done by the href typeahead, you can use a listener.
An example:
Listener config (ie. in src/AppBundle/Resources/config/services.yml):
AppBundle\EventListener\HreftypeaheadSearchListener:
tags:
- { name: kernel.event_listener, event: hreftypeahead.search, method: onSearch }
Listener code (ie. in AppBundle\EventListener\HreftypeaheadSearchListener):
class HreftypeaheadSearchListener
{
/* @var HreftypeaheadSearchEvent */
protected $e;
public function __construct()
{
}
public function onSearch(HreftypeaheadSearchEvent $e)
{
$this->e = $e;
$e->addCondition('(0 = 0)'); // just an example
}
......
### Limitations
* It only supports one object linked in href