Alter views contextual filter field
OK, I managed to achieve this by implementing hook_form_FORM_ID_alter() in my mytheme.theme file.

/**
 * Implements hook_form_FORM_ID_alter().
 */
function mytheme_form_views_exposed_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state) {
  if ($form['#id'] == 'my-views-exposed-form-id') {
    $query = db_select('node_field_data', 'n')
      -&gt;fields('n', array('nid', 'title'))
      -&gt;condition('type', 'sector')
      -&gt;condition('status', 1)
      -&gt;orderBy('title', 'ASC');
    $options = $query-&gt;execute()-&gt;fetchAllKeyed();

    // $form['sector'] is a type text, changing it to select.
    $form['sector'] = array(
      '#type' =&gt; 'select',
      '#options' =&gt; array('' =&gt; t('Filter by Sector')-&gt;render()) + $options
    );
  }
}


Hope it will help someone.