Problem/motivation

When autocomplete is configured to show unpublished entities and searching for an entity-type that does not have the key 'status' in the entity definition, like a drupal group, the unpublished entity is not displayed with the 'unpublished' CSS class, so it appears in the autocomplete visually the same as a published entity.

Steps to reproduce

  1. install the groups module
  2. Create a group that is published, Name: "Test Linkit Published"
  3. Create a group with a similar name that is unpublished . Name:"Test Linkit unpublished"
  4. configure linkit to show unpublished entities
  5. create an entity with a linkit field
  6. in the linkit field, start typing the similar name for the two groups created above "Test Linkit "
  7. Observe that the unpublished group and published group are both displayed the same and that
    the unpublished group does not have the 'unpublished' class on the HTML element with class inkit-result-line-wrapper

Proposed resolution

Add the following lines to EntityMatcher::buildStatus()

if ($entity instanceof EntityPublishedInterface) {
      return $entity->isPublished() ? 'published' : 'unpublished';
    }

Issue fork linkit-3625059

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

koolaidguy created an issue.