Last active
June 8, 2020 20:57
-
-
Save mjamilasfihani/63e21f8a06f686415877e4f683e7e1ec to your computer and use it in GitHub Desktop.
option helper with hidden attribute in CodeIgniter 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DONT FORGET TO BACKUP THE ORIGINAL SCRIPT | |
# NOT EDITED FOR <optgroup ...>...</optgroup> | |
# | |
# TESTING WITH CODEIGNITER 4.0.3 | |
# | |
# open form_helper.php in ../system/Helpers/ | |
# then change : (about line 423) | |
$form .= '<option value="' . htmlspecialchars($key) . '"' | |
# with : | |
$form .= '<option value="' . htmlspecialchars(str_replace('HIDE_', '', $key)) . '"' . (in_array($key, ['HIDE_']) ? ' hidden="" ' : '') | |
# How to use it | |
# | |
# ['HIDE_' => 'Your Position'] --> <option value="" hidden="">Your Position</option> | |
# | |
# if you set the array like this | |
# | |
# ['HIDE_' => 'Position 1', 'HIDE_' => 'Position 2'] | |
# | |
# it will show 'Position 2' directly, this is bug? you can say yes or no. | |
# I think the hidden option without value worked as PLACEHOLDER, so I say it's not a bug |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment