Skip to content

Commit

Permalink
Merge branch '1.2' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTowers committed Dec 4, 2024
2 parents 543bcb4 + ad09d06 commit 2a336a3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
10 changes: 5 additions & 5 deletions backend/lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ The toolbar configuration allows:

Option | Description
------------- | -------------
`buttons` | a reference to a controller partial file with the toolbar buttons. Eg: **_list_toolbar.htm**
`buttons` | a reference to a controller partial file with the toolbar buttons. Eg: **_list_toolbar.php**
`search` | reference to a Search Widget configuration file, or an array with configuration.

The search configuration supports the following options:
Expand Down Expand Up @@ -443,7 +443,7 @@ group_id:
content:
label: Content
type: partial
path: ~/plugins/acme/blog/models/comment/_content_column.htm
path: ~/plugins/acme/blog/models/comment/_content_column.php
```

### Color Picker
Expand Down Expand Up @@ -830,9 +830,9 @@ public function index()

### Overriding views

The `ListController` behavior has a main container view that you may override by creating a special file named `_list_container.htm` in your controller directory. The following example will add a sidebar to the list:
The `ListController` behavior has a main container view that you may override by creating a special file named `_list_container.php` in your controller directory. The following example will add a sidebar to the list:

```html
```php
<?php if ($toolbar): ?>
<?= $toolbar->render() ?>
<?php endif ?>
Expand Down Expand Up @@ -860,7 +860,7 @@ customViewPath: $/acme/blog/controllers/reviews/list

> **NOTE**: It is a good idea to use a sub-directory, for example `list`, to avoid conflicts.

For example, to modify the list body row markup, create a file called `list/_list_body_row.htm` in your controller directory.
For example, to modify the list body row markup, create a file called `list/_list_body_row.php` in your controller directory.

```php
<tr>
Expand Down
2 changes: 1 addition & 1 deletion cms/pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Parameter | Description
`title` | the page title, required.
`layout` | the page [layout](layouts), optional. If specified, should contain the name of the layout file, without extension, for example: `default`.
`description` | the page description for the backend interface, optional.
`hidden` | hidden pages are accessible only by logged-in backend users, optional.
`is_hidden` | hidden pages are accessible only by logged-in backend users, optional.

### URL syntax

Expand Down
33 changes: 19 additions & 14 deletions database/attachments.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ A single file attachment:

```php
public $attachOne = [
'avatar' => 'System\Models\File'
'avatar' => \System\Models\File::class,
];
```

Multiple file attachments:

```php
public $attachMany = [
'photos' => 'System\Models\File'
'photos' => \System\Models\File::class,
];
```

Expand All @@ -34,7 +34,10 @@ Protected attachments are uploaded to the File Upload disk's **uploads/protected

```php
public $attachOne = [
'avatar' => ['System\Models\File', 'public' => false]
'avatar' => [
\System\Models\File::class,
'public' => false,
],
];
```

Expand Down Expand Up @@ -137,14 +140,14 @@ Inside your model define a relationship to the `System\Models\File` class, for e
class Post extends Model
{
public $attachOne = [
'featured_image' => 'System\Models\File'
'featured_image' => \System\Models\File::class,
];
}
```

Build a form for uploading a file:

```html
```php
<?= Form::open(['files' => true]) ?>

<input name="example_file" type="file">
Expand Down Expand Up @@ -184,16 +187,18 @@ if ($fileFromPost) {
Display the uploaded file on a page:

```php
// Find the Blog Post model again
$post = Post::find(1);
<?php
// Find the Blog Post model again
$post = Post::find(1);

// Look for the featured image address, otherwise use a default one
if ($post->featured_image) {
$featuredImage = $post->featured_image->getPath();
}
else {
$featuredImage = 'http://placehold.it/220x300';
}
// Look for the featured image address, otherwise use a default one
if ($post->featured_image) {
$featuredImage = $post->featured_image->getPath();
}
else {
$featuredImage = 'http://placehold.it/220x300';
}
?>

<img src="<?= $featuredImage ?>" alt="Featured Image">
```
Expand Down

0 comments on commit 2a336a3

Please sign in to comment.