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
0723f409
Commit
0723f409
authored
Sep 10, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finished the first structure of the guide on formatting
parent
c8f8f654
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
25 deletions
+3
-25
output-data-widgets.md
docs/guide/output-data-widgets.md
+2
-24
output-formatter.md
docs/guide/output-formatter.md
+0
-0
Formatter.php
framework/i18n/Formatter.php
+1
-1
No files found.
docs/guide/output-data-widgets.md
View file @
0723f409
...
@@ -162,30 +162,8 @@ In the above `text` corresponds to [[\yii\i18n\Formatter::asText()]]. The value
...
@@ -162,30 +162,8 @@ In the above `text` corresponds to [[\yii\i18n\Formatter::asText()]]. The value
argument. In the second column definition `date` corresponds to [[\yii\i18n\Formatter::asDate()]]. The value of the
argument. In the second column definition `date` corresponds to [[\yii\i18n\Formatter::asDate()]]. The value of the
column is, again, passed as the first argument while 'Y-m-d' is used as the second argument value.
column is, again, passed as the first argument while 'Y-m-d' is used as the second argument value.
Here's the bundled formatters list:
For a list of available formatters see the [section about Data Formatting](output-formatter.md).
- [[\yii\base\Formatter::asRaw()|raw]] - the value is outputted as is.
- [[\yii\base\Formatter::asText()|text]] - the value is HTML-encoded. This format is used by default.
- [[\yii\base\Formatter::asNtext()|ntext]] - the value is formatted as an HTML-encoded plain text with newlines converted
into line breaks.
- [[\yii\base\Formatter::asParagraphs()|paragraphs]] - the value is formatted as HTML-encoded text paragraphs wrapped
into `<p>` tags.
- [[\yii\base\Formatter::asHtml()|html]] - the value is purified using [[HtmlPurifier]] to avoid XSS attacks. You can
pass additional options such as `['html', ['Attr.AllowedFrameTargets' => ['_blank']]]`.
- [[\yii\base\Formatter::asEmail()|email]] - the value is formatted as a mailto link.
- [[\yii\base\Formatter::asImage()|image]] - the value is formatted as an image tag.
- [[\yii\base\Formatter::asUrl()|url]] - the value is formatted as a hyperlink.
- [[\yii\base\Formatter::asBoolean()|boolean]] - the value is formatted as a boolean. You can set what's rendered for
true and false values by calling `Yii::$app->formatter->booleanFormat = ['No', 'Yes'];` before outputting GridView.
- [[\yii\base\Formatter::asDate()|date]] - the value is formatted as date.
- [[\yii\base\Formatter::asTime()|time]] - the value is formatted as time.
- [[\yii\base\Formatter::asDatetime()|datetime]] - the value is formatted as datetime.
- [[\yii\base\Formatter::asInteger()|integer]] - the value is formatted as an integer.
- [[\yii\base\Formatter::asDouble()|double]] - the value is formatted as a double number.
- [[\yii\base\Formatter::asNumber()|number]] - the value is formatted as a number with decimal and thousand separators.
- [[\yii\base\Formatter::asSize()|size]] - the value that is a number of bytes is formatted as a human readable size.
- [[\yii\base\Formatter::asRelativeTime()|relativeTime]] - the value is formatted as the time interval between a date
and now in human readable form.
#### Action column
#### Action column
...
...
docs/guide/output-formatter.md
View file @
0723f409
This diff is collapsed.
Click to expand it.
framework/i18n/Formatter.php
View file @
0723f409
...
@@ -536,7 +536,7 @@ class Formatter extends Component
...
@@ -536,7 +536,7 @@ class Formatter extends Component
}
}
/**
/**
* Normalizes the given datetime value as
one
that can be taken by various date/time formatting methods.
* Normalizes the given datetime value as
a UNIX timestamp
that can be taken by various date/time formatting methods.
*
*
* @param mixed $value the datetime value to be normalized.
* @param mixed $value the datetime value to be normalized.
* @return float the normalized datetime value (int64)
* @return float the normalized datetime value (int64)
...
...
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