Skip to content

Commit e40778a

Browse files
committed
Show entry type icons on the index page
1 parent 0dd390f commit e40778a

7 files changed

Lines changed: 21 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Added support for inline field creation and editing within field layout designers. ([#14260](https://github.com/craftcms/cms/pull/14260))
66
- Layout elements within field layout designers now have action menus. ([#14260](https://github.com/craftcms/cms/pull/14260))
77
- Improved the performance of control panel screens that include field layout designers.
8+
- The Entry Types index page now shows entry type icons.
89
- Added `craft\base\FieldLayoutComponent::hasSettings()`.
910
- Added `craft\helpers\Cp::layoutElementSelectorHtml()`.
1011
- `craft\helpers\App::parseEnv()` now returns `null` when a missing environment variable name is passed to it. ([#14253](https://github.com/craftcms/cms/pull/14253))

packages/craftcms-vue/admintable/App.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,16 @@
114114
v-on:removeCheck="removeCheck"
115115
></admin-table-checkbox>
116116
</template>
117-
<template slot="title" slot-scope="props">
117+
<div
118+
slot="title"
119+
slot-scope="props"
120+
class="flex flex-nowrap gap-xs"
121+
>
122+
<span
123+
v-if="props.rowData.icon"
124+
:class="['cp-icon', props.rowData.iconColor]"
125+
v-html="props.rowData.icon"
126+
></span>
118127
<span
119128
v-if="props.rowData.status"
120129
class="status"
@@ -129,7 +138,7 @@
129138
<span :class="{'cell-bold': !props.rowData.status}" v-else>{{
130139
props.rowData.title
131140
}}</span>
132-
</template>
141+
</div>
133142

134143
<template slot="handle" slot-scope="props">
135144
<admin-table-copy-text-button

src/services/Entries.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use craft\events\SectionEvent;
2525
use craft\helpers\AdminTable;
2626
use craft\helpers\ArrayHelper;
27+
use craft\helpers\Cp;
2728
use craft\helpers\Db;
2829
use craft\helpers\Json;
2930
use craft\helpers\ProjectConfig as ProjectConfigHelper;
@@ -1662,6 +1663,7 @@ public function getTableData(int $page, int $limit, ?string $searchTerm): array
16621663

16631664
$results = $query->all();
16641665

1666+
/** @var EntryType[] $entryTypes */
16651667
$entryTypes = array_values(array_filter(
16661668
array_map(fn(array $result) => $this->_entryTypes()->firstWhere('id', $result['id']), $results)
16671669
));
@@ -1677,6 +1679,8 @@ public function getTableData(int $page, int $limit, ?string $searchTerm): array
16771679
$tableData[] = [
16781680
'id' => $entryType->id,
16791681
'title' => Craft::t('site', $entryType->name),
1682+
'icon' => $entryType->icon ? Cp::iconSvg($entryType->icon) : null,
1683+
'iconColor' => $entryType->color?->value,
16801684
'url' => $entryType->getCpEditUrl(),
16811685
'name' => Craft::t('site', $entryType->name),
16821686
'handle' => $entryType->handle,

src/templates/settings/entry-types/index.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
{% do view.registerTranslations('app', [
77
'Are you sure you want to delete “{name}” and all entries of that type?',
8+
'Entry Type',
89
'Handle',
9-
'Name',
1010
'No entry types exist yet.',
1111
'No results.',
1212
'Used by',
@@ -31,7 +31,7 @@
3131

3232
{% js %}
3333
var columns = [
34-
{ name: '__slot:title', title: Craft.t('app', 'Name') },
34+
{ name: '__slot:title', title: Craft.t('app', 'Entry Type') },
3535
{ name: '__slot:handle', title: Craft.t('app', 'Handle') },
3636
{
3737
name: 'usages',

src/web/assets/admintable/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ There are a few special column type that provide extra functionality. To use any
214214

215215
#### Title
216216

217-
The title column allows the use of `status`, `title` and `url` in the data to create a column similar to that of the title column in element index tables.
217+
The title column allows the use of `icon`, `iconColor`, `status`, `title` and `url` in the data to create a column similar to that of the title column in element index tables.
218218

219219
```javascript
220220
var data = [

src/web/assets/admintable/dist/js/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/admintable/dist/js/app.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)