You are here

function LinkitPanelPagesPlugin::autocomplete_callback in Linkit panel pages 7.2

The autocomplete callback function for the Linkit Entity plugin.

Overrides LinkitPluginInterface::autocomplete_callback

File

plugins/linkit_plugins/linkt_panel_pages.class.php, line 11

Class

LinkitPanelPagesPlugin
Plugin class.

Code

function autocomplete_callback() {
  $matches = array();

  // Get page urls.
  $results = db_select('page_manager_pages', 'pmp')
    ->fields('pmp', array(
    'admin_title',
    'path',
  ))
    ->condition('pmp.name', '%' . db_like($this->serach_string) . '%', 'LIKE')
    ->execute();
  foreach ($results as $page) {
    $matches[] = array(
      'title' => $this
        ->buildLabel($page->admin_title),
      'path' => $this
        ->buildPath($page->path),
      'group' => $this
        ->buildGroup('Pages'),
    );
  }
  return $matches;
}