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

Support for 5.5 #40

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
config: 5.3
- constraint: ~5.4.0
config: 5.4
- constraint: ~5.5.0
config: 5.5

env:
CRAFT_APP_ID: pest
Expand Down
5 changes: 5 additions & 0 deletions src/factories/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Composer\InstalledVersions;
use Composer\Semver\VersionParser;
use Craft;
use craft\fieldlayoutelements\entries\EntryTitleField;
use craft\helpers\StringHelper;
use craft\models\EntryType;
use craft\models\Section_SiteSettings;
Expand Down Expand Up @@ -113,6 +114,10 @@ public function inferences(array $definition = [])
'name' => $name,
'handle' => StringHelper::toHandle($name),
]);
if (InstalledVersions::satisfies(new VersionParser, 'craftcms/cms', '>=5.5.0')) {
// @phpstan-ignore-next-line
$entryType->getFieldLayout()->prependElements([new EntryTitleField]);
}
service(SectionsServiceInterface::class)->saveEntryType($entryType);
throw_if($entryType->errors, 'Problem saving entry type: '.implode(', ', $entryType->getFirstErrors()));
$definition['entryTypes'] = [$entryType];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
color: null
fieldLayouts:
2f77cf1c-a3db-4396-8d2f-efff2172466e:
tabs:
-
elementCondition: null
elements:
-
autocapitalize: true
autocomplete: false
autocorrect: true
class: null
dateAdded: '2024-11-20T09:14:23-08:00'
disabled: false
elementCondition: null
id: null
includeInCards: false
inputType: null
instructions: null
label: null
max: null
min: null
name: null
orientation: null
placeholder: null
providesThumbs: false
readonly: false
requirable: false
size: null
step: null
tip: null
title: null
type: craft\fieldlayoutelements\entries\EntryTitleField
uid: 463de371-8db2-4f1d-b9b1-b9aca58b5c86
userCondition: null
warning: null
width: 100
-
dateAdded: '2024-11-20T09:14:23-08:00'
elementCondition: null
fieldUid: c05f8773-60a8-4f5e-9925-3cc36a064793 # Field One
handle: null
includeInCards: true
instructions: null
label: 'Field One'
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 6a242257-5d04-4ffb-8afb-f0b091472335
userCondition: null
warning: null
width: 100
-
dateAdded: '2024-11-20T09:14:23-08:00'
elementCondition: null
fieldUid: 10199d0e-57f0-4724-aefb-1ef4ed73b408 # Field Two
handle: null
includeInCards: false
instructions: null
label: 'Field Two'
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 4b8f210d-545c-4d57-9777-08cdb93862df
userCondition: null
warning: null
width: 100
name: Content
uid: aad92478-a4a8-49e5-b88b-5fff4734eb2c
userCondition: null
handle: blockTypeOne
hasTitleField: false
icon: null
name: 'Block Type One'
showSlugField: true
showStatusField: true
slugTranslationKeyFormat: null
slugTranslationMethod: site
titleFormat: null
titleTranslationKeyFormat: null
titleTranslationMethod: site
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
color: null
fieldLayouts:
50cdf242-1476-44dc-ab8b-e3ad70ef3163:
tabs:
-
elementCondition: null
elements:
-
autocapitalize: true
autocomplete: false
autocorrect: true
class: null
dateAdded: '2024-11-20T09:14:23-08:00'
disabled: false
elementCondition: null
id: null
includeInCards: false
inputType: null
instructions: null
label: null
max: null
min: null
name: null
orientation: null
placeholder: null
providesThumbs: false
readonly: false
requirable: false
size: null
step: null
tip: null
title: null
type: craft\fieldlayoutelements\entries\EntryTitleField
uid: 880e50a3-79fb-4456-836b-89c970af40b9
userCondition: null
warning: null
width: 100
-
dateAdded: '2024-11-20T09:14:23-08:00'
elementCondition: null
fieldUid: c7529b61-60cd-4e18-a272-3084aee7fa89 # Matrix Field
handle: null
includeInCards: false
instructions: null
label: null
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 90a7fa0d-77cd-4612-92f9-4fafd4c1a66d
userCondition: null
warning: null
width: 100
-
dateAdded: '2024-11-20T09:14:23-08:00'
elementCondition: null
fieldUid: c148dfb3-a122-49ed-8538-de26d0482663 # Entries Field
handle: null
includeInCards: false
instructions: null
label: null
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: efbdd2ca-b829-4604-bd1e-f66fad9093e2
userCondition: null
warning: null
width: 100
-
dateAdded: '2024-11-20T09:14:23-08:00'
elementCondition: null
fieldUid: 7d1a7bf3-c346-48bc-bb77-f7d76fcacf2e # Text Field
handle: null
includeInCards: false
instructions: null
label: null
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 189519d9-7809-47fc-bc54-d2441a85ae9d
userCondition: null
warning: null
width: 100
-
dateAdded: '2024-11-20T09:14:23-08:00'
elementCondition: null
fieldUid: 17685ada-d64c-459c-b9fc-678d43e4bee8 # Dropdown Field
handle: null
includeInCards: false
instructions: null
label: null
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 1440d116-5fe9-45a3-8031-7f3c9b71ef9d
userCondition: null
warning: null
width: 100
name: Content
uid: a914e695-0910-4b04-841b-cbe6f689856b
userCondition: null
handle: default
hasTitleField: true
icon: null
name: Default
showSlugField: true
showStatusField: true
slugTranslationKeyFormat: null
slugTranslationMethod: site
titleFormat: null
titleTranslationKeyFormat: null
titleTranslationMethod: site
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
columnSuffix: vqczhrcp
handle: dropdownField
instructions: null
name: 'Dropdown Field'
searchable: false
settings:
options:
-
__assoc__:
-
- label
- One
-
- value
- one
-
- default
- ''
-
__assoc__:
-
- label
- Two
-
- value
- two
-
- default
- ''
translationKeyFormat: null
translationMethod: none
type: craft\fields\Dropdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
columnSuffix: null
handle: entriesField
instructions: null
name: 'Entries Field'
searchable: false
settings:
allowSelfRelations: false
branchLimit: null
maintainHierarchy: false
maxRelations: null
minRelations: null
selectionLabel: null
showCardsInGrid: false
showSiteMenu: false
sources: '*'
targetSiteId: null
validateRelatedElements: false
viewMode: null
translationKeyFormat: null
translationMethod: none
type: craft\fields\Entries
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
columnSuffix: jnvscjst
handle: fieldOne
instructions: null
name: 'Matrix Field - Block Type One - Field One'
searchable: false
settings:
byteLimit: null
charLimit: null
code: false
initialRows: 4
multiline: false
placeholder: null
uiMode: normal
translationKeyFormat: null
translationMethod: none
type: craft\fields\PlainText
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
columnSuffix: swmzeype
handle: fieldTwo
instructions: null
name: 'Matrix Field - Block Type One - Field Two'
searchable: false
settings:
byteLimit: null
charLimit: null
code: false
initialRows: 4
multiline: false
placeholder: null
uiMode: normal
translationKeyFormat: null
translationMethod: none
type: craft\fields\PlainText
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
columnSuffix: null
handle: matrixField
instructions: null
name: 'Matrix Field'
searchable: false
settings:
createButtonLabel: null
entryTypes:
- b5c238dd-588f-4f0a-b9e4-8a988f0e7468 # Block Type One
includeTableView: false
maxEntries: null
minEntries: null
pageSize: null
propagationKeyFormat: null
propagationMethod: all
showCardsInGrid: false
viewMode: blocks
translationKeyFormat: null
translationMethod: site
type: craft\fields\Matrix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
columnSuffix: irlrybem
handle: textField
instructions: null
name: 'Text Field'
searchable: false
settings:
byteLimit: null
charLimit: null
code: false
initialRows: 4
multiline: false
placeholder: null
uiMode: normal
translationKeyFormat: null
translationMethod: none
type: craft\fields\PlainText
3 changes: 3 additions & 0 deletions stubs/config/project-5.5/graphql/graphql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
publicToken:
enabled: false
expiryDate: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
isPublic: true
name: 'Public Schema'
Loading
Loading