Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -65,7 +65,8 @@ class Text extends TextArea
|
||||
'disallowedCharacters' => array(), // An array of disallowed characters (default < > ' ")
|
||||
'minimized' => TRUE // Whether the autocomplete shows a 'choose' link to activate. Existing values or required = true will always override this.
|
||||
'alphabetical' => FALSE, // Force values to be sorted alphabetically.,
|
||||
'suggestionsOnly' => false, // Force values to come from the autocomplete suggestion form before submitting
|
||||
'suggestionsOnly' => false, // Force values to come from the autocomplete suggestion form before submitting,
|
||||
'separator' => null // Custom separator when multiple values are submitted in the request. Defaults to newline character.
|
||||
),
|
||||
'placeholder' => 'e.g. ...', // A placeholder (NB: Will only work on compatible browsers)
|
||||
'regex' => '/[A-Z]+/i', // RegEx of acceptable value
|
||||
@@ -203,7 +204,7 @@ class Text extends TextArea
|
||||
$return = trim( $return );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $this->options['autocomplete'] ) and $return !== null )
|
||||
{
|
||||
if ( is_array( $return ) )
|
||||
@@ -216,18 +217,19 @@ class Text extends TextArea
|
||||
{
|
||||
$return = htmlspecialchars_decode( $return, ENT_QUOTES );
|
||||
}
|
||||
|
||||
|
||||
if ( !is_array( $return ) and ( !isset( $this->options['autocomplete']['maxItems'] ) or $this->options['autocomplete']['maxItems'] != 1 ) )
|
||||
{
|
||||
$return = array_filter( array_map( 'trim', explode( "\n", $return ) ) );
|
||||
$separator = $this->options['autocomplete']['separator'] ?? "\n";
|
||||
$return = array_filter( array_map( 'trim', explode( $separator, $return ) ) );
|
||||
}
|
||||
|
||||
|
||||
if ( is_array( $return ) AND isset( $this->options['autocomplete']['alphabetical'] ) AND $this->options['autocomplete']['alphabetical'] )
|
||||
{
|
||||
natcasesort( $return );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Remove all invisible characters if this is a username */
|
||||
if( $this->options['accountUsername'] )
|
||||
{
|
||||
@@ -268,17 +270,18 @@ class Text extends TextArea
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Format Value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function formatValue(): mixed
|
||||
{
|
||||
{
|
||||
if ( $this->options['autocomplete'] !== NULL and ( !isset( $this->options['autocomplete']['maxItems'] ) or $this->options['autocomplete']['maxItems'] != 1 ) and !is_array( $this->value ) and $this->value !== NULL )
|
||||
{
|
||||
return array_filter( array_map( 'trim', explode( "\n", $this->value ) ) );
|
||||
$separator = $this->options['autocomplete']['separator'] ?? "\n";
|
||||
return array_filter( array_map( 'trim', explode( $separator, $this->value ) ) );
|
||||
}
|
||||
|
||||
return $this->value;
|
||||
|
||||
Reference in new issue
Block a user