← All changes
|
includes/Frontend/Form/View/Theme/Fields/DropdownField.php
+80
-71
3.1.0
→
V3.3.2
View file →
| @@ -24,8 +24,10 @@ | ||
| 24 | 24 | $selectedOptImage = ''; |
| 25 | 25 | $optionsList = ''; |
| 26 | 26 | $activeList = isset($field->config->activeList) ? $field->config->activeList : null; |
| 27 | 27 | $allowCustomOption = apply_filters('bitform_dropdown_allow_custom_option', false, $field); |
| 28 | + $showSearch = !$fh->property_exists_nested($field, 'config->showSearch', false); | |
| 29 | + $searchMarkup = ''; | |
| 28 | 30 | $img = htmlentities("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>"); |
| 29 | 31 | |
| 30 | 32 | $selectedOptImage = apply_filters('bitform_dropdown_selected_opt_image', '', $field, $fh); |
| 31 | 33 | |
| @@ -245,8 +247,82 @@ | ||
| 245 | 247 | ); |
| 246 | 248 | |
| 247 | 249 | $multiChipClass = ($fh->property_exists_nested($field, 'config->multipleSelect', true) && $fh->property_exists_nested($field, 'config->showChip', true)) ? 'multi-chip' : ''; |
| 248 | 250 | |
| 251 | + if ($showSearch) { | |
| 252 | + $searchMarkup = sprintf( | |
| 253 | + '<div | |
| 254 | + %1$s | |
| 255 | + class="%2$s %3$s" | |
| 256 | + > | |
| 257 | + <input | |
| 258 | + %4$s | |
| 259 | + type="search" | |
| 260 | + class="%5$s %6$s" | |
| 261 | + placeholder="Search Country" | |
| 262 | + aria-label="Search Options" | |
| 263 | + aria-hidden="true" | |
| 264 | + tabIndex="-1" | |
| 265 | + inert | |
| 266 | + /> | |
| 267 | + <svg | |
| 268 | + %7$s | |
| 269 | + class="%8$s %9$s %10$s" | |
| 270 | + aria-hidden="true" | |
| 271 | + width="22" | |
| 272 | + height="22" | |
| 273 | + role="img" | |
| 274 | + title="Search icon" | |
| 275 | + viewBox="0 0 24 24" | |
| 276 | + fill="none" | |
| 277 | + stroke="currentColor" | |
| 278 | + stroke-width="2" | |
| 279 | + stroke-linecap="round" | |
| 280 | + stroke-linejoin="round" | |
| 281 | + > | |
| 282 | + <circle cx="11" cy="11" r="8" /> | |
| 283 | + <line x1="21" y1="21" x2="16.65" y2="16.65" /> | |
| 284 | + </svg> | |
| 285 | + <button | |
| 286 | + %11$s | |
| 287 | + type="button" | |
| 288 | + aria-label="Clear search" | |
| 289 | + class="%12$s %13$s %14$s" | |
| 290 | + tabIndex="-1" | |
| 291 | + > | |
| 292 | + <svg | |
| 293 | + width="13" | |
| 294 | + height="13" | |
| 295 | + role="img" | |
| 296 | + viewBox="0 0 24 24" | |
| 297 | + fill="none" | |
| 298 | + stroke="currentColor" | |
| 299 | + stroke-width="2" | |
| 300 | + stroke-linecap="round" | |
| 301 | + stroke-linejoin="round" | |
| 302 | + > | |
| 303 | + <line x1="18" y1="6" x2="6" y2="18" /> | |
| 304 | + <line x1="6" y1="6" x2="18" y2="18" /> | |
| 305 | + </svg> | |
| 306 | + </button> | |
| 307 | + </div>', | |
| 308 | + $fh->getCustomAttributes('option-search-wrp'), | |
| 309 | + $fh->getAtomicCls('option-search-wrp'), | |
| 310 | + $fh->getCustomClasses('option-search-wrp'), | |
| 311 | + $fh->getCustomAttributes('opt-search-input'), | |
| 312 | + $fh->getAtomicCls('opt-search-input'), | |
| 313 | + $fh->getCustomClasses('opt-search-input'), | |
| 314 | + $fh->getCustomAttributes('opt-search-icn'), | |
| 315 | + $fh->getAtomicCls('icn'), | |
| 316 | + $fh->getAtomicCls('opt-search-icn'), | |
| 317 | + $fh->getCustomClasses('opt-search-icn'), | |
| 318 | + $fh->getCustomAttributes('search-clear-btn'), | |
| 319 | + $fh->getAtomicCls('icn'), | |
| 320 | + $fh->getAtomicCls('search-clear-btn'), | |
| 321 | + $fh->getCustomClasses('search-clear-btn') | |
| 322 | + ); | |
| 323 | + } | |
| 324 | + | |
| 249 | 325 | return sprintf( |
| 250 | 326 | '<div class="%1$s %2$s"> |
| 251 | 327 | <div |
| 252 | 328 | %3$s |
| @@ -340,64 +416,10 @@ | ||
| 340 | 416 | <div |
| 341 | 417 | %38$s |
| 342 | 418 | class="%39$s %40$s" |
| 343 | 419 | > |
| 344 | - <div | |
| 345 | - %41$s | |
| 346 | - class="%42$s %43$s" | |
| 347 | - > | |
| 348 | - <input | |
| 349 | - %44$s | |
| 350 | - type="search" | |
| 351 | - class="%45$s %46$s" | |
| 352 | - placeholder="Search Country" | |
| 353 | - aria-label="Search Options" | |
| 354 | - aria-hidden="true" | |
| 355 | - tabIndex="-1" | |
| 356 | - inert | |
| 357 | - /> | |
| 358 | - <svg | |
| 359 | - %47$s | |
| 360 | - class="%48$s %49$s %50$s" | |
| 361 | - aria-hidden="true" | |
| 362 | - width="22" | |
| 363 | - height="22" | |
| 364 | - role="img" | |
| 365 | - title="Search icon" | |
| 366 | - viewBox="0 0 24 24" | |
| 367 | - fill="none" | |
| 368 | - stroke="currentColor" | |
| 369 | - stroke-width="2" | |
| 370 | - stroke-linecap="round" | |
| 371 | - stroke-linejoin="round" | |
| 372 | - > | |
| 373 | - <circle cx="11" cy="11" r="8" /> | |
| 374 | - <line x1="21" y1="21" x2="16.65" y2="16.65" /> | |
| 375 | - </svg> | |
| 376 | - <button | |
| 377 | - %51$s | |
| 378 | - type="button" | |
| 379 | - aria-label="Clear search" | |
| 380 | - class="%52$s %53$s %54$s" | |
| 381 | - tabIndex="-1" | |
| 382 | - > | |
| 383 | - <svg | |
| 384 | - width="13" | |
| 385 | - height="13" | |
| 386 | - role="img" | |
| 387 | - viewBox="0 0 24 24" | |
| 388 | - fill="none" | |
| 389 | - stroke="currentColor" | |
| 390 | - stroke-width="2" | |
| 391 | - stroke-linecap="round" | |
| 392 | - stroke-linejoin="round" | |
| 393 | - > | |
| 394 | - <line x1="18" y1="6" x2="6" y2="18" /> | |
| 395 | - <line x1="6" y1="6" x2="18" y2="18" /> | |
| 396 | - </svg> | |
| 397 | - </button> | |
| 398 | - </div> | |
| 399 | - %55$s | |
| 420 | + %41$s | |
| 421 | + %42$s | |
| 400 | 422 | </div> |
| 401 | 423 | </div> |
| 402 | 424 | </div> |
| 403 | 425 | </div>', |
| @@ -440,23 +462,10 @@ | ||
| 440 | 462 | $fh->getCustomClasses('option-wrp'), // 37 |
| 441 | 463 | $fh->getCustomAttributes('option-inner-wrp'), // 38 |
| 442 | 464 | $fh->getAtomicCls('option-inner-wrp'), // 39 |
| 443 | 465 | $fh->getCustomClasses('option-inner-wrp'), // 40 |
| 444 | - $fh->getCustomAttributes('option-search-wrp'), // 41 | |
| 445 | - $fh->getAtomicCls('option-search-wrp'), // 42 | |
| 446 | - $fh->getCustomClasses('option-search-wrp'), // 43 | |
| 447 | - $fh->getCustomAttributes('opt-search-input'), // 44 | |
| 448 | - $fh->getAtomicCls('opt-search-input'), // 45 | |
| 449 | - $fh->getCustomClasses('opt-search-input'), // 46 | |
| 450 | - $fh->getCustomAttributes('opt-search-icn'), // 47 | |
| 451 | - $fh->getAtomicCls('icn'), // 48 | |
| 452 | - $fh->getAtomicCls('opt-search-icn'), // 49 | |
| 453 | - $fh->getCustomClasses('opt-search-icn'), // 50 | |
| 454 | - $fh->getCustomAttributes('search-clear-btn'), // 51 | |
| 455 | - $fh->getAtomicCls('icn'), // 52 | |
| 456 | - $fh->getAtomicCls('search-clear-btn'), // 53 | |
| 457 | - $fh->getCustomClasses('search-clear-btn'), // 54 | |
| 458 | - $optionsList // 55 | |
| 466 | + $searchMarkup, // 41 | |
| 467 | + $optionsList // 42 | |
| 459 | 468 | ); |
| 460 | 469 | } |
| 461 | 470 | } |
| 462 | 471 | } |