Added funcion for set placeholders

This commit is contained in:
Jose Gonzalez 2023-02-07 13:20:23 +01:00
parent 8f78f89aa3
commit 0eaa52a042
1 changed files with 37 additions and 0 deletions

View File

@ -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</%s>',
$wrapper,
implode(' ', $attibutes),
$text,
$wrapper
);
if ($return === true) {
return $output;
} else {
echo $output;
}
}
/** /**
* Prints link to show something. * Prints link to show something.
* *