Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -11,7 +11,7 @@
|
||||
namespace IPS\Helpers\Form;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -34,6 +34,8 @@ class _Codemirror extends TextArea
|
||||
'mode' => 'php' // Formatting mode. Default is htmlmixed.
|
||||
'height' => 300 // Height of code mirror editor
|
||||
'preview' => 'http://...' // A URL where the value can be POSTed (as "value") and will return a preview. Defaults to NULL, which will hide the preview button.
|
||||
'tagLinks' => array(), // An array of links to display next to the headers for tags.
|
||||
'tagSource' => \IPS\Http\Url( ... ), // A URL that will fetch tags using AJAX.
|
||||
);
|
||||
* @endcode
|
||||
*/
|
||||
@@ -46,20 +48,28 @@ class _Codemirror extends TextArea
|
||||
'mode' => 'htmlmixed',
|
||||
'nullLang' => NULL,
|
||||
'height' => 300,
|
||||
'preview' => NULL
|
||||
'preview' => NULL,
|
||||
'tagLinks' => array(),
|
||||
'tagSource' => NULL
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Sets that the field is required if there is a minimum length and vice-versa
|
||||
*
|
||||
* @see \IPS\Helpers\Form\FormAbstract::__construct
|
||||
* @param string $name Name
|
||||
* @param mixed $defaultValue Default value
|
||||
* @param bool|NULL $required Required? (NULL for not required, but appears to be so)
|
||||
* @param array $options Type-specific options
|
||||
* @param callback $customValidationCode Custom validation code
|
||||
* @param string $prefix HTML to show before input field
|
||||
* @param string $suffix HTML to show after input field
|
||||
* @param string $id The ID to add to the row
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct( $name, $defaultValue=NULL, $required=FALSE, $options=array(), $customValidationCode=NULL, $prefix=NULL, $suffix=NULL, $id=NULL )
|
||||
{
|
||||
/* Call parent constructor */
|
||||
call_user_func_array( 'parent::__construct', func_get_args() );
|
||||
parent::__construct( $name, $defaultValue, $required, $options, $customValidationCode, $prefix, $suffix, $id );
|
||||
|
||||
/* We don't support this feature */
|
||||
$this->options['nullLang'] = NULL;
|
||||
@@ -79,9 +89,9 @@ class _Codemirror extends TextArea
|
||||
{
|
||||
if ( $this->options['height'] )
|
||||
{
|
||||
$this->options['height'] = is_numeric( $this->options['height'] ) ? $this->options['height'] . 'px' : $this->options['height'];
|
||||
$this->options['height'] = \is_numeric( $this->options['height'] ) ? $this->options['height'] . 'px' : $this->options['height'];
|
||||
}
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->codemirror( $this->name, $this->value, $this->required, $this->options['maxLength'], $this->options['disabled'], '', $this->options['placeholder'], $this->options['tags'], $this->options['mode'], $this->htmlId ? "{$this->htmlId}-input" : NULL, $this->options['height'], $this->options['preview'] );
|
||||
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->codemirror( $this->name, $this->value, $this->required, $this->options['maxLength'], $this->options['disabled'], '', $this->options['placeholder'], $this->options['tags'], $this->options['mode'], $this->htmlId ? "{$this->htmlId}-input" : NULL, $this->options['height'], $this->options['preview'], $this->options['tagLinks'], $this->options['tagSource'] );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user