Skip to content

Commit

Permalink
[8.x] Remove cp_icon config option (#652)
Browse files Browse the repository at this point in the history
Co-authored-by: duncanmcclean <[email protected]>
  • Loading branch information
duncanmcclean and duncanmcclean authored Jan 23, 2025
1 parent 3cc15f6 commit 0a91f96
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 44 deletions.
17 changes: 0 additions & 17 deletions docs/control-panel.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,6 @@ Technically, you can’t fully disable Runway’s CP feature. However, what you
],
```

## Custom Icon for CP Nav Item

Runway has a rather generic icon for resources in the Control Panel Nav. Feel free to change this to something else that better suits your use case (in fact, I’d encourage it).

You can either provide the name of an existing icon [packaged into Statamic Core](https://github.com/statamic/cms/tree/3.1/resources/svg) or inline the SVG as a string.

```php
// config/runway.php

'resources' => [
\App\Models\Order::class => [
'name' => 'Orders',
'cp_icon' => 'date',
],
],
```

## Permissions

![Screenshot of Runway's User Permissions](/img/runway/cp-user-permissions.png)
Expand Down
15 changes: 0 additions & 15 deletions docs/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,6 @@ If you’d like to hide the CP Nav Item that’s registered for this model, just

> Bear in mind, this will just hide the Nav Item for the CP interface, it won’t actually get rid of the routes being registered. If someone knows where to look, they could still use the CP to manage your models (they could guess the URL).
### Control Panel Icon

You should set `icon` to the name of the icon you’d like to use instead.

Alternatively, if the icon you want isn’t [included in Statamic](https://github.com/statamic/cms/tree/3.1/resources/svg), you can also pass an inline SVG.

```php
'resources' => [
\App\Models\Order::class => [
'name' => 'Orders',
'cp_icon' => 'date',
],
],
```

### Route

If you want to take advantage of Runway’s front-end routing abilities, you can pass in a `route` to enable it.
Expand Down
13 changes: 13 additions & 0 deletions docs/upgrade-guides/v7-to-v8.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ To work around this, v8 introduces some changes around how nested fields are con

As an upside of this new approach, nested fields can now be used with Runway's [GraphQL API](/graphql).

### Removal of the `cp_icon` config option

The `cp_icon` configuration option has been removed in Runway 8, in favour of being able to change the icon using Statamic's [Nav Preferences](https://statamic.dev/preferences#accessing-preferences) feature.

```php
'resources' => [
\App\Models\Order::class => [
'name' => 'Orders',
'cp_icon' => 'date', // [tl! --]
],
],
```

## Previous upgrade guides

- [v3.x to v4.0](/upgrade-guides/v3-x-to-v4-0)
Expand Down
11 changes: 0 additions & 11 deletions src/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
use Statamic\Facades\Blink;
Expand Down Expand Up @@ -66,15 +65,6 @@ public function config(): Collection
return $this->config;
}

public function cpIcon(): string
{
if (! $this->config->has('cp_icon')) {
return File::get(__DIR__.'/../resources/svg/database.svg');
}

return $this->config->get('cp_icon');
}

public function hidden(): bool
{
return $this->config->get('hidden', false);
Expand Down Expand Up @@ -290,7 +280,6 @@ public function toArray(): array
'model' => $this->model(),
'name' => $this->name(),
'blueprint' => $this->blueprint(),
'cp_icon' => $this->cpIcon(),
'hidden' => $this->hidden(),
'route' => $this->route(),
'has_publish_states' => $this->hasPublishStates(),
Expand Down
1 change: 0 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ protected function registerNavigation(): self
->each(function (Resource $resource) use (&$nav) {
$nav->create($resource->name())
->section('Content')
->icon($resource->cpIcon())
->route('runway.index', ['resource' => $resource->handle()])
->can('view', $resource);
});
Expand Down

0 comments on commit 0a91f96

Please sign in to comment.