Retrieve a custom form field modified by a filter

I figured out how to proceed. I created a text file with the desired select options and just replaced the input field from the template with the bellow code.

<?php
    $file_path="FILE_PATH_HERE"; // path to the file with select options
    if ( !file_exists( $file_path ) ) {
        echo '<input type="text" name="location" placeholder="' . __("Location ...", "custom-settings") . '" value="' . esc_attr($location) . '" />';
    } else {
        $file_array = str_replace("\n","", file($file_path));
        $options="<option value="">" . __("Select a location ...", "custom-settings") . '</option>';
        $options .= '<option value="0">' . __("All locations", "custom-settings") . '</option>';

        foreach ($file_array as $location)
            $options .= '<option value="' . $location . '">' . $location .'</option>';

        $select="<select id="location" name="location">" . $options . '</select>';
        echo $select;
    }
?>