| @@ -16,16 +16,30 @@ | ||
| 16 | 16 | public $form_admin = array(); |
| 17 | 17 | public $fields_list = NULL; |
| 18 | 18 | |
| 19 | 19 | public $fields_validations = array(); |
| 20 | + public $fields_autosuggestions = array(); | |
| 20 | 21 | |
| 21 | 22 | public function __construct(){ |
| 22 | 23 | $this->fields_validations = array( |
| 23 | 24 | 'is_numerical'=> __('Numerical', 'wpdirectorykit'), |
| 24 | 25 | 'is_phone'=> __('Phone', 'wpdirectorykit'), |
| 26 | + 'is_phone|wdk_viber'=> __('Phone(viber)', 'wpdirectorykit'), | |
| 27 | + 'is_phone|wdk_whatsapp'=> __('Phone(whatsApp)', 'wpdirectorykit'), | |
| 25 | 28 | 'is_email'=> __('Email', 'wpdirectorykit'), |
| 26 | 29 | ); |
| 27 | 30 | |
| 31 | + $this->fields_autosuggestions = array( | |
| 32 | + 'google_api_cities'=> __('Google Api Cities', 'wpdirectorykit'), | |
| 33 | + 'google_api_countries'=> __('Google Api Countries', 'wpdirectorykit'), | |
| 34 | + 'rapid_api_cities'=> __('Rapid Api Cities', 'wpdirectorykit'), | |
| 35 | + 'rapid_api_countries'=> __('Rapid Api Countries', 'wpdirectorykit'), | |
| 36 | + 'countries'=> __('Countries', 'wpdirectorykit'), | |
| 37 | + 'db_locations'=> __('Db Locations', 'wpdirectorykit'), | |
| 38 | + 'db_categories'=> __('Db Categories', 'wpdirectorykit'), | |
| 39 | + 'db_selft_field'=> __('Current Field Values', 'wpdirectorykit'), | |
| 40 | + ); | |
| 41 | + | |
| 28 | 42 | parent::__construct(); |
| 29 | 43 | } |
| 30 | 44 | |
| 31 | 45 | /* [START] For dynamic data table */ |
| @@ -169,7 +183,29 @@ | ||
| 169 | 183 | /* only admin can edit */ |
| 170 | 184 | public function is_related($item_id, $user_id, $method = 'edit') |
| 171 | 185 | { |
| 172 | 186 | return false; |
| 187 | + } | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + public function delete($field_id, $user_id=NULL) { | |
| 192 | + | |
| 193 | + if(!$this->check_deletable($field_id, $user_id)) return false; | |
| 194 | + | |
| 195 | + $this->load->model('listingfield_m'); | |
| 196 | + | |
| 197 | + /* remove from listing fields */ | |
| 198 | + $field_data = $this->get($field_id, TRUE); | |
| 199 | + | |
| 200 | + if($field_data) | |
| 201 | + $this->listingfield_m->delete_table_column($field_data, $field_id); | |
| 202 | + | |
| 203 | + | |
| 204 | + parent::delete($field_id); | |
| 205 | + | |
| 206 | + do_action('wpdirectorykit/model/field/delete', $field_id); | |
| 207 | + | |
| 208 | + return true; | |
| 173 | 209 | } |
| 174 | 210 | } |
| 175 | 211 | ?> |