/** * Menu callback for Views tag autocompletion. * * Like other autocomplete functions, this function inspects the 'q' query * parameter for the string to use to search for suggestions. * * @return \Symfony\Component\HttpFoundation\JsonResponse * A JSON response containing the autocomplete suggestions for Views tags. */ public function autocompleteTag(Request $request) { $matches = array(); $string = $request->query->get('q'); // Get matches from default views. $views = $this->entityManager->getStorageController('view')->load(); foreach ($views as $view) { $tag = $view->get('tag'); if ($tag && strpos($tag, $string) === 0) { $matches[$tag] = $tag; if (count($matches) >= 10) { break; } } } return new JsonResponse($matches); }
/** * Constructs a DeleteMultiple form object. * * @param \Drupal\user\TempStoreFactory $temp_store_factory * The tempstore factory. * @param \Drupal\Core\Entity\EntityManager $manager * The entity manager. */ public function __construct(TempStoreFactory $temp_store_factory, EntityManager $manager) { $this->tempStoreFactory = $temp_store_factory; $this->storageController = $manager->getStorageController('feeds_feed'); }