Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for wrapper prefix and suffix #389

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion 6.x/crud-columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -1556,14 +1556,17 @@ $this->crud->column([
},
// 'target' => '_blank',
// 'class' => 'some-class',
// 'prefix' => '(',
// 'suffix' => ')',
],
]);
```

If you specify ```wrapper``` to a column, the entries in that column will be wrapped in the element you specify. Note that:
- To get an HTML anchor (a link), you can specify ```a``` for the element (but that's also the default); to get a paragraph you'd specify ```p``` for the element; to get an inline element you'd specify ```span``` for the element; etc;
- Anything you declare in the ```wrapper``` array (other than ```element```) will be used as HTML attributes for that element (ex: ```class```, ```style```, ```target``` etc);
- Anything you declare in the ```wrapper``` array (other than ```element```, ```prefix``` and ```suffix```) will be used as HTML attributes for that element (ex: ```class```, ```style```, ```target``` etc);
- Each wrapper attribute, including the element itself, can be declared as a `string` OR as a `callback`;
- `prefix` and `suffix` will be placed inside the wrapper element, it is particularly useful when you have a list of entries (eg. `select_multiple`) you may have a general prefix and suffix on the column, and a specific one for each element.

Let's take another example, and wrap a boolean column into a green/red span:

Expand Down