1

I am using ECk module in one of my content for displaying content in managed way . The problem which i am facing the content in eck fields not creating search index when we are searching its content by input any string in search block nothing is searching regarding that field.

I have properly indexed all the node in admin/config/search/pages

Actually when i am enabling search index view mode in any content type then its content is searchable otherwise not. There is no option to add search index view mode in Eck entity type like node content type.

I want to programatically add search index view mode in ECK field.

I want to do something like below code

$entity_type="eck"; //The entity for which you want to create the view mode
$view_mode="search index"; //The name of the new view mode
$settings=Array();
$settings["id"]=$entity_type.".".$view_mode;
$settings["targetEntityType"]=$entity_type;
$evm=Drupal\Core\Entity\Entity\EntityViewMode::create($settings);
$evm->save();
7
  • Have you tried using drupal.org/project/search_api module which supports all entities? Commented Aug 31, 2018 at 13:05
  • Actually i am creating drupal 8 based site which is having only 4 pages ,to implement search_api its a bulky process on clients server,thats why i am looking for some alternative solution.
    – user52318
    Commented Aug 31, 2018 at 13:40
  • You don't need a special view mode for the ECK entity (it wouldn't help much, because ECK has no search plugin). Since you only want to index the ECK entity when referenced from a content type, not on its own, you can display the reference field as rendered entity with the default view mode.
    – 4uk4
    Commented Aug 31, 2018 at 13:47
  • can you elaborate more in answer i am in great need of help?
    – user52318
    Commented Aug 31, 2018 at 13:52
  • You ask specifically for a ECK view mode and how to create it programmatically. My comment is not to answer, but to clarify if you need to do this.
    – 4uk4
    Commented Aug 31, 2018 at 13:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.