Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
51a4a9ee
Commit
51a4a9ee
authored
May 21, 2013
by
Antonio Ramirez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply latest feedback
parent
74aaa4f0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
TypeAhead.php
yii/bootstrap/TypeAhead.php
+9
-4
No files found.
yii/bootstrap/TypeAhead.php
View file @
51a4a9ee
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
namespace
yii\bootstrap
;
namespace
yii\bootstrap
;
use
Yii
;
use
Yii
;
use
yii\base\InvalidConfigException
;
use
yii\base\Model
;
use
yii\base\Model
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
...
@@ -52,11 +53,15 @@ class TypeAhead extends Widget
...
@@ -52,11 +53,15 @@ class TypeAhead extends Widget
* @var string the model attribute that this field is associated with
* @var string the model attribute that this field is associated with
*/
*/
public
$attribute
;
public
$attribute
;
/**
/**
* @var string the input name. This must be set if [[form]] is not set.
* @var string the input name. This must be set if [[form]] is not set.
*/
*/
public
$name
;
public
$name
;
/**
* @var string the input value.
*/
public
$value
;
/**
/**
* Renders the widget
* Renders the widget
...
@@ -72,20 +77,20 @@ class TypeAhead extends Widget
...
@@ -72,20 +77,20 @@ class TypeAhead extends Widget
* If [[model]] is null or not from an [[Model]] instance, then the field will be rendered according to
* If [[model]] is null or not from an [[Model]] instance, then the field will be rendered according to
* the [[name]] attribute.
* the [[name]] attribute.
* @return string the rendering result
* @return string the rendering result
* @throws Invalid
Param
Exception when none of the required attributes are set to render the textInput. That is,
* @throws Invalid
Config
Exception when none of the required attributes are set to render the textInput. That is,
* if [[model]] and [[attribute]] are not set, then [[name]] is required.
* if [[model]] and [[attribute]] are not set, then [[name]] is required.
*/
*/
public
function
renderField
()
public
function
renderField
()
{
{
if
(
$this
->
model
instanceof
Model
&&
$this
->
attribute
!==
null
)
{
if
(
$this
->
model
instanceof
Model
&&
$this
->
attribute
!==
null
)
{
$this
->
options
[
'id'
]
=
$this
->
id
=
Html
::
getInputId
(
$this
->
model
,
$this
->
attribute
);
$this
->
options
[
'id'
]
=
Html
::
getInputId
(
$this
->
model
,
$this
->
attribute
);
return
Html
::
activeTextInput
(
$this
->
model
,
$this
->
attribute
,
$this
->
options
);
return
Html
::
activeTextInput
(
$this
->
model
,
$this
->
attribute
,
$this
->
options
);
}
}
if
(
$this
->
name
===
null
)
{
if
(
$this
->
name
===
null
)
{
throw
new
Invalid
Param
Exception
(
throw
new
Invalid
Config
Exception
(
get_class
(
$this
)
.
' must specify "form", "model" and "attribute" or "name" property values'
get_class
(
$this
)
.
' must specify "form", "model" and "attribute" or "name" property values'
);
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment