Difference between #1 and #2 of
A universal model attribute for its synthetic representation

Revision #2 has been created by Alexandre Rodichevski on Aug 20, 2016, 7:20:22 AM with the memo:

Moscow -> Seattle, added comments
« previous (#1)

Changes

Title unchanged

A universal model attribute for its synthetic representation

Category unchanged

Tips

Yii version unchanged

Tags unchanged

active record, model, virtual attribute

Content changed

[...]
$this->params['breadcrumbs'][] = ['label' => $model->state->info, 'url' => ['state/view', 'id' => $model->state_id]];
$this->params['breadcrumbs'][] = ['label' => $model->info, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
```

The page title "Update
MoscowSeattle" is more informative then "Update City: 123" generated by the standard Gii template.

### Cancel button
[...]
```

This button, when pressed, asks: "Deleting
MoscowSeattle. Are you sure?" instead of the standard "Are you sure you want to delete this item?".

### DetailView attribute
[...]
{
// ...

 
public function attributeLabels()
{
return [
[...]
public function getInfo()
{
$i = trim(implode(' ', [// The first and the last names combined
 
        $i = trim(
trim($this->name), . ' ' . trim($this->lastname)]));

// If empty, take the default value
[...]
```

The `info` value is
always notnever empty. Some possible examples of its values:

1. Jane Doe
2. Jane
3. Doe
4. Person 123
[...]
0 0
3 followers
Viewed: 14 622 times
Version: 2.0
Category: Tips
Last updated by: Alexandre Rodichevski
Created on: Aug 19, 2016
Last updated: 7 years ago
Update Article

Revisions

View all history