← All changes
|
includes/Frontend/Form/View/Conversational/Fields/DropdownField.php
+61
-54
3.1.2
→
V3.3.2
View file →
| @@ -27,8 +27,10 @@ | ||
| 27 | 27 | $optionsList = ''; |
| 28 | 28 | $activeList = isset($field->config->activeList) ? $field->config->activeList : null; |
| 29 | 29 | $optionIcon = ''; |
| 30 | 30 | $allowCustomOption = isset($field->config->allowCustomOption) ? $field->config->allowCustomOption : false; |
| 31 | + $showSearch = !$fh->property_exists_nested($field, 'config->showSearch', false); | |
| 32 | + $searchMarkup = ''; | |
| 31 | 33 | $img = htmlentities("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'/>"); |
| 32 | 34 | |
| 33 | 35 | if ($fh->property_exists_nested($field, 'config->optionIcon', true)) { |
| 34 | 36 | $optionIcon = sprintf( |
| @@ -294,8 +296,66 @@ | ||
| 294 | 296 | ); |
| 295 | 297 | |
| 296 | 298 | $multiChipClass = ($fh->property_exists_nested($field, 'config->multipleSelect', true) && $fh->property_exists_nested($field, 'config->showChip', true)) ? 'multi-chip' : ''; |
| 297 | 299 | |
| 300 | + if ($showSearch) { | |
| 301 | + $searchMarkup = ' <div | |
| 302 | + ' . $fh->getCustomAttributes('option-search-wrp') . ' | |
| 303 | + class="' . $fh->getConversationalMultiCls('option-search-wrp') . ' ' . $fh->getCustomClasses('option-search-wrp') . '" | |
| 304 | + > | |
| 305 | + <input | |
| 306 | + ' . $fh->getCustomAttributes('opt-search-input') . ' | |
| 307 | + type="search" | |
| 308 | + class="' . $fh->getConversationalMultiCls('opt-search-input') . ' ' . $fh->getCustomClasses('opt-search-input') . '" | |
| 309 | + placeholder="Search Country" | |
| 310 | + aria-label="Search Options" | |
| 311 | + aria-hidden="true" | |
| 312 | + tabIndex="-1" | |
| 313 | + /> | |
| 314 | + <svg | |
| 315 | + ' . $fh->getCustomAttributes('opt-search-icn') . ' | |
| 316 | + class="' . $fh->getConversationalMultiCls('icn') . ' ' . $fh->getConversationalMultiCls('opt-search-icn') . ' ' . $fh->getCustomClasses('opt-search-icn') . '" | |
| 317 | + aria-hidden="true" | |
| 318 | + width="22" | |
| 319 | + height="22" | |
| 320 | + role="img" | |
| 321 | + title="Search icon" | |
| 322 | + viewBox="0 0 24 24" | |
| 323 | + fill="none" | |
| 324 | + stroke="currentColor" | |
| 325 | + stroke-width="2" | |
| 326 | + stroke-linecap="round" | |
| 327 | + stroke-linejoin="round" | |
| 328 | + > | |
| 329 | + <circle cx="11" cy="11" r="8" /> | |
| 330 | + <line x1="21" y1="21" x2="16.65" y2="16.65" /> | |
| 331 | + </svg> | |
| 332 | + <button | |
| 333 | + ' . $fh->getCustomAttributes('search-clear-btn') . ' | |
| 334 | + type="button" | |
| 335 | + aria-label="Clear search" | |
| 336 | + class="' . $fh->getConversationalMultiCls('icn') . ' ' . $fh->getConversationalMultiCls('search-clear-btn') . ' ' . $fh->getCustomClasses('search-clear-btn') . '" | |
| 337 | + tabIndex="-1" | |
| 338 | + > | |
| 339 | + <svg | |
| 340 | + width="13" | |
| 341 | + height="13" | |
| 342 | + role="img" | |
| 343 | + viewBox="0 0 24 24" | |
| 344 | + fill="none" | |
| 345 | + stroke="currentColor" | |
| 346 | + stroke-width="2" | |
| 347 | + stroke-linecap="round" | |
| 348 | + stroke-linejoin="round" | |
| 349 | + > | |
| 350 | + <line x1="18" y1="6" x2="6" y2="18" /> | |
| 351 | + <line x1="6" y1="6" x2="18" y2="18" /> | |
| 352 | + </svg> | |
| 353 | + </button> | |
| 354 | + </div> | |
| 355 | +'; | |
| 356 | + } | |
| 357 | + | |
| 298 | 358 | return ' <div class="' . $fh->getConversationalMultiCls('dpd-fld-container') . ' ' . $fh->getCustomClasses('dpd-fld-container') . '"> |
| 299 | 359 | <div |
| 300 | 360 | ' . $fh->getCustomAttributes('dpd-fld-wrp') . ' |
| 301 | 361 | class="' . $fh->getClassWithFieldKey('dpd-fld-wrp') . ' ' . $fh->getConversationalCls('dpd-slct-fld-wrp') . ' ' . $fh->getCustomClasses('dpd-fld-wrp') . ' ' . $readonlyCls . ' ' . $disabledCls . '" |
| @@ -390,62 +450,9 @@ | ||
| 390 | 450 | <div |
| 391 | 451 | ' . $fh->getCustomAttributes('option-inner-wrp') . ' |
| 392 | 452 | class="' . $fh->getConversationalMultiCls('option-inner-wrp') . ' ' . $fh->getCustomClasses('option-inner-wrp') . '" |
| 393 | 453 | > |
| 394 | - <div | |
| 395 | - ' . $fh->getCustomAttributes('option-search-wrp') . ' | |
| 396 | - class="' . $fh->getConversationalMultiCls('option-search-wrp') . ' ' . $fh->getCustomClasses('option-search-wrp') . '" | |
| 397 | - > | |
| 398 | - <input | |
| 399 | - ' . $fh->getCustomAttributes('opt-search-input') . ' | |
| 400 | - type="search" | |
| 401 | - class="' . $fh->getConversationalMultiCls('opt-search-input') . ' ' . $fh->getCustomClasses('opt-search-input') . '" | |
| 402 | - placeholder="Search Country" | |
| 403 | - aria-label="Search Options" | |
| 404 | - aria-hidden="true" | |
| 405 | - tabIndex="-1" | |
| 406 | - /> | |
| 407 | - <svg | |
| 408 | - ' . $fh->getCustomAttributes('opt-search-icn') . ' | |
| 409 | - class="' . $fh->getConversationalMultiCls('icn') . ' ' . $fh->getConversationalMultiCls('opt-search-icn') . ' ' . $fh->getCustomClasses('opt-search-icn') . '" | |
| 410 | - aria-hidden="true" | |
| 411 | - width="22" | |
| 412 | - height="22" | |
| 413 | - role="img" | |
| 414 | - title="Search icon" | |
| 415 | - viewBox="0 0 24 24" | |
| 416 | - fill="none" | |
| 417 | - stroke="currentColor" | |
| 418 | - stroke-width="2" | |
| 419 | - stroke-linecap="round" | |
| 420 | - stroke-linejoin="round" | |
| 421 | - > | |
| 422 | - <circle cx="11" cy="11" r="8" /> | |
| 423 | - <line x1="21" y1="21" x2="16.65" y2="16.65" /> | |
| 424 | - </svg> | |
| 425 | - <button | |
| 426 | - ' . $fh->getCustomAttributes('search-clear-btn') . ' | |
| 427 | - type="button" | |
| 428 | - aria-label="Clear search" | |
| 429 | - class="' . $fh->getConversationalMultiCls('icn') . ' ' . $fh->getConversationalMultiCls('search-clear-btn') . ' ' . $fh->getCustomClasses('search-clear-btn') . '" | |
| 430 | - tabIndex="-1" | |
| 431 | - > | |
| 432 | - <svg | |
| 433 | - width="13" | |
| 434 | - height="13" | |
| 435 | - role="img" | |
| 436 | - viewBox="0 0 24 24" | |
| 437 | - fill="none" | |
| 438 | - stroke="currentColor" | |
| 439 | - stroke-width="2" | |
| 440 | - stroke-linecap="round" | |
| 441 | - stroke-linejoin="round" | |
| 442 | - > | |
| 443 | - <line x1="18" y1="6" x2="6" y2="18" /> | |
| 444 | - <line x1="6" y1="6" x2="18" y2="18" /> | |
| 445 | - </svg> | |
| 446 | - </button> | |
| 447 | - </div> | |
| 454 | + ' . $searchMarkup . ' | |
| 448 | 455 | ' . $optionsList . ' |
| 449 | 456 | </div> |
| 450 | 457 | </div> |
| 451 | 458 | </div> |