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
f9fab5d4
Commit
f9fab5d4
authored
Aug 25, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lazy fallback of label creation for Sort class
parent
713a987a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
Sort.php
framework/yii/data/Sort.php
+8
-5
No files found.
framework/yii/data/Sort.php
View file @
f9fab5d4
...
...
@@ -127,7 +127,7 @@ class Sort extends Object
* a sort link. If not set, [[Inflector::camel2words()]] will be called to get a label.
*
* Note that if the Sort object is already created, you can only use the full format
* to configure every attribute. Each attribute must include these elements: asc
, desc and label
.
* to configure every attribute. Each attribute must include these elements: asc
and desc
.
*/
public
$attributes
=
array
();
/**
...
...
@@ -195,13 +195,11 @@ class Sort extends Object
$attributes
[
$attribute
]
=
array
(
'asc'
=>
array
(
$attribute
=>
self
::
ASC
),
'desc'
=>
array
(
$attribute
=>
self
::
DESC
),
'label'
=>
Inflector
::
camel2words
(
$attribute
),
);
}
elseif
(
!
isset
(
$attribute
[
'asc'
],
$attribute
[
'desc'
]
,
$attribute
[
'label'
]
))
{
}
elseif
(
!
isset
(
$attribute
[
'asc'
],
$attribute
[
'desc'
]))
{
$attributes
[
$name
]
=
array_merge
(
array
(
'asc'
=>
array
(
$name
=>
self
::
ASC
),
'desc'
=>
array
(
$name
=>
self
::
DESC
),
'label'
=>
Inflector
::
camel2words
(
$name
),
),
$attribute
);
}
else
{
$attributes
[
$name
]
=
$attribute
;
...
...
@@ -304,7 +302,12 @@ class Sort extends Object
$url
=
$this
->
createUrl
(
$attribute
);
$options
[
'data-sort'
]
=
$this
->
createSortVar
(
$attribute
);
return
Html
::
a
(
$this
->
attributes
[
$attribute
][
'label'
],
$url
,
$options
);
if
(
isset
(
$this
->
attributes
[
$attribute
][
'label'
]))
{
$label
=
$this
->
attributes
[
$attribute
][
'label'
];
}
else
{
$label
=
Inflector
::
camel2words
(
$attribute
);
}
return
Html
::
a
(
$label
,
$url
,
$options
);
}
/**
...
...
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