Create an example search plugin for the Content Entity Example for integrating custom entity data into the core search system.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kentr created an issue. See original summary.

kentr’s picture

Issue tags: +Plugin system, +examples
kentr’s picture

Status: Active » Needs review
FileSize
33.3 KB
jkopel’s picture

Category: Task » Feature request
Status: Needs review » Needs work
Issue tags: +Needs tests

Patch intalls cleanly.
Should probably include some documentation indicating what the plugin does at content_entity_example_contact/list and also indicate that one has to add a search page for "content entity example contacts" in order to make use of the plugin.

The patch introduces an error when creating search pages in the UI (for any entity type).
To reproduce:
1. Apply patch
2. Enable content_entity_example
3. Add a search page

Type	php
Date	Saturday, January 30, 2016 - 14:46
User	d8
Location	http://d8/admin/config/search/pages
Referrer	http://d8/admin/config/search/pages/add/content_entity_example_contact_search
Message	Symfony\Component\Routing\Exception\RouteNotFoundException: Route "search.view_content_entity_example_contacts" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 191 of /core/lib/Drupal/Core/Routing/RouteProvider.php).
Severity	Error
Hostname	127.0.0.1
Operations	

This seems to happen regardless of which entity type I try to add a search page for.
The pages do get created, and the plugin/search seems to work just fine once the page is there.

Mile23’s picture

Could we make this into a separate module which depends on content_entity_example?

That way we can do a better job of illustrating only one thing with each module.

kentr’s picture

Could we make this into a separate module which depends on content_entity_example?

Good point.

kentr’s picture

Status: Needs work » Needs review
FileSize
35.64 KB

This patch:

  • Contains the example in an independent module: search_plugin_example.
  • Adds usage instructions to content_entity_example_contact/list.

I couldn't reproduce the error mentioned in #4 when testing on core `8.0.3`.

Status: Needs review » Needs work

The last submitted patch, 7: example-search-plugin-2643048-7-D8.patch, failed testing.

kentr’s picture

Assigned: kentr » Unassigned

I don't know why the patch failed testing. In manual testing, it applied and worked as expected without introducing errors.

Unassigning myself from the issue until I have more time to work on it.

Mile23’s picture

It seems some of this patch made its way to https://www.drupal.org/docs/8/api/entity-api/making-the-content-entity-s... (or vice-versa).