diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 3dc574d644..a65d3e4514 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2472,6 +2472,43 @@ function ui_print_help_tip( } +/** + * Generate a placeholder for inputs. + * + * @param string $text Text for show. + * @param boolean $return Text for show. + * @param array $options Text for show. + * + * @return string|void Formed element. + */ +function ui_print_input_placeholder( + string $text, + bool $return=false, + array $options=[] +) { + $wrapper = (isset($options['wrapper']) === true) ? $options['wrapper'] : 'span'; + $attibutes = []; + $attibutes[] = 'class="'.((isset($options['class']) === true) ? $options['class'] : 'input_sub_placeholder').'"'; + $attibutes[] = (isset($options['rawattributes']) === true) ? $options['rawattributes'] : ''; + $attibutes[] = (isset($options['style']) === true) ? 'style="'.$options['style'].'"' : ''; + $attibutes[] = (isset($options['title']) === true) ? 'title="'.$options['title'].'"' : ''; + + $output = sprintf( + '<%s %s>%s', + $wrapper, + implode(' ', $attibutes), + $text, + $wrapper + ); + + if ($return === true) { + return $output; + } else { + echo $output; + } +} + + /** * Prints link to show something. *