Skip to content

Commit

Permalink
Merge branch '5.0' into feature/acc-360-when-zooming-text-to-200-in-c…
Browse files Browse the repository at this point in the history
…ollapsed-navigation-mode

# Conflicts:
#	src/web/assets/cp/dist/css/cp.css
#	src/web/assets/cp/dist/css/cp.css.map
  • Loading branch information
brandonkelly committed Feb 15, 2024
2 parents 14b30d0 + 988bf47 commit a67b827
Show file tree
Hide file tree
Showing 127 changed files with 2,001 additions and 792 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/BUG-REPORT-V3.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Bug ReportCraft 3
name: 'Bug Report: Craft 3'
description: Report an issue or unexpected behavior pertaining to Craft 3
title: '[3.x]: '
labels:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/BUG-REPORT-V4.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Bug ReportCraft 4
name: 'Bug Report: Craft 4'
description: Report an issue or unexpected behavior pertaining to Craft 4
title: '[4.x]: '
labels:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/BUG-REPORT-V5.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Bug ReportCraft 5
name: 'Bug Report: Craft 5'
description: Report an issue or unexpected behavior pertaining to Craft 5
title: '[5.x]: '
labels:
Expand Down
33 changes: 27 additions & 6 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
blank_issues_enabled: false
contact_links:
- name: Feature Request
url: https://github.com/craftcms/cms/discussions/new?category=ideas
about: Start a new discussion about your idea
- name: Documentation
url: https://docs.craftcms.com/
url: https://craftcms.com/docs
about: Read the official documentation
- name: Knowledge Base
url: https://craftcms.com/knowledge-base
about: Find answers to common problems
about: Find official answers to common problems
- name: Developer Support Services
url: https://craftcms.com/support-services
about: Priority developer support from the team that makes Craft
- name: Craft Discord
url: https://craftcms.com/discord
about: Meet the community
- name: Stack Exchange
- name: Craft Stack Exchange
url: https://craftcms.stackexchange.com/
about: Get help and help others
- name: 'Feature Request: Craft CMS'
url: https://github.com/craftcms/cms/discussions/new?category=ideas
about: Make a feature request or enhancement for Craft CMS
- name: 'Feature Request: Craft Console / Plugin Store'
url: https://github.com/craftcms/console/discussions/new?category=ideas
about: Make a feature request or enhancement for Craft Console or the Plugin Store
- name: 'Feature Request: Craft Cloud'
url: https://github.com/craftcms/cloud/discussions/new?category=ideas
about: Make a feature request or enhancement for Craft Cloud
- name: 'Feature Request: Craft Commerce'
url: https://github.com/craftcms/commerce/discussions/new?category=ideas
about: Make a feature request or enhancement for Craft Commerce
- name: 'Bug Report: Craft CMS'
url: https://github.com/craftcms/cms/issues/new/choose
about: Create a bug report for Craft CMS
- name: 'Bug Report: Craft Console / Plugin Store'
url: https://github.com/craftcms/console/issues/new/choose
about: Create a bug report for Craft Console or the Plugin Store
- name: 'Bug Report: Craft Cloud'
url: https://craftcms.com/contact
about: Create a bug report for Craft Cloud
- name: 'Bug Report: Craft Commerce'
url: https://github.com/craftcms/commerce/issues/new/choose
about: Create a bug report for Craft Commerce
15 changes: 15 additions & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
- Improved the accessibility of layout tabs. ([#14215](https://github.com/craftcms/cms/pull/14215))
- Improved the accessibility of overflow tab menus. ([#14214](https://github.com/craftcms/cms/pull/14214))
- Increased the hit area for range select options.
- Improved the accessibility of the global sidebar. ([#14335](https://github.com/craftcms/cms/pull/14335))

### Administration
- Added the “Color” entry type setting. ([#14187](https://github.com/craftcms/cms/pull/14187))
Expand All @@ -75,6 +76,7 @@
- Entry types are now managed independently of sections.
- Entry types are no longer required to have a Title Format, if the Title field isn’t shown.
- Entry types now have a “Show the Slug field” setting. ([#13799](https://github.com/craftcms/cms/discussions/13799))
- Entry type and field edit pages now list their usages. ([#14397](https://github.com/craftcms/cms/pull/14397))
- Sites’ Language settings can now be set to environment variables. ([#14235](https://github.com/craftcms/cms/pull/14235), [#14135](https://github.com/craftcms/cms/discussions/14135))
- Matrix fields now manage nested entries, rather than Matrix blocks. During the upgrade, existing Matrix block types will be converted to entry types; their nested fields will be made global; and Matrix blocks will be converted to entries.
- Matrix fields now have “Entry URI Format” and “Template” settings for each site.
Expand Down Expand Up @@ -109,6 +111,10 @@
- Entry queries now have `field`, `fieldId`, `primaryOwner`, `primaryOwnerId`, `owner`, `ownerId`, `allowOwnerDrafts`, and `allowOwnerRevisions` params.
- Entry queries’ `authorId` params now support passing multiple IDs prefixed with `and`, to fetch entries with multiple listed authors.
- User queries now have an `authorOf` param.
- Nested addresses are now cached by their field ID, and address queries now register cache tags based on their `field` and `fieldId` params.
- Nested entries are now cached by their field ID, and entry queries now register cache tags based on their `field` and `fieldId` params.
- GraphQL schemas can now include queries and mutations for nested entries (e.g. within Matrix or CKEditor fields) directly. ([#14366](https://github.com/craftcms/cms/pull/14366))
- Added the `fieldId`, `fieldHandle`, `ownerId`, and `sortOrder` entry GraphQL fields. ([#14366](https://github.com/craftcms/cms/pull/14366))
- Entries’ GraphQL type names are now formatted as `<entryTypeHandle>_Entry`, and are no longer prefixed with their section’s handle. (That goes for Matrix-nested entries as well.)
- Entries now have `author` and `authorIds` GraphQL field.
- Matrix fields’ GraphQL mutation types now expect nested entries to be defined by an `entries` field rather than `blocks`.
Expand Down Expand Up @@ -139,6 +145,7 @@
- Added `craft\base\ApplicationTrait::getAuth()`.
- Added `craft\base\Chippable`. ([#14169](https://github.com/craftcms/cms/pull/14169))
- Added `craft\base\Colorable`. ([#14187](https://github.com/craftcms/cms/pull/14187))
- Added `craft\base\CpEditable`.
- Added `craft\base\Element::EVENT_DEFINE_ACTION_MENU_ITEMS`.
- Added `craft\base\Element::EVENT_DEFINE_INLINE_ATTRIBUTE_INPUT_HTML`.
- Added `craft\base\Element::crumbs()`.
Expand Down Expand Up @@ -314,6 +321,7 @@
- Added `craft\log\Dispatcher::getDefaultTarget()`. ([#14283](https://github.com/craftcms/cms/pull/14283))
- Added `craft\migrations\BaseContentRefactorMigration`.
- Added `craft\models\EntryType::$color`.
- Added `craft\models\EntryType::findUsages()`.
- Added `craft\models\FieldLayout::getCardBodyFields()`.
- Added `craft\models\FieldLayout::getElementByUid()`.
- Added `craft\models\FieldLayout::getFieldById()`.
Expand Down Expand Up @@ -356,7 +364,10 @@
- Added `craft\services\Entries::refreshEntryTypes()`.
- Added `craft\services\Entries::saveSection()`.
- Added `craft\services\Fields::$fieldContext`, which replaces `craft\services\Content::$fieldContext`.
- Added `craft\services\Fields::EVENT_REGISTER_NESTED_ENTRY_FIELD_TYPES`.
- Added `craft\services\Fields::findFieldUsages()`.
- Added `craft\services\Fields::getAllLayouts()`.
- Added `craft\services\Fields::getNestedEntryFieldTypes()`.
- Added `craft\services\Gql::defineContentArgumentsForFieldLayouts()`.
- Added `craft\services\Gql::defineContentArgumentsForFields()`.
- Added `craft\services\Gql::getOrSetContentArguments()`.
Expand Down Expand Up @@ -420,6 +431,7 @@
- `craft\base\Field::inputHtml()` now has an `$inline` argument.
- `craft\base\FieldInterface::getIsTranslatable()`, `getTranslationDescription()`, `getInputHtml()`, `normalizeValue()`, `normalizeValueFromRequest()`, and `serializeValue()` no longer need to specify a default value for the `$element` argument.
- `craft\base\WidgetInterface::icon()` can now return a system icon name. ([#14169](https://github.com/craftcms/cms/pull/14169))
- `craft\behaviors\SessionBehavior::setSuccess()` and `getSuccess()` use the `success` flash key now, rather than `notice`. ([#14345](https://github.com/craftcms/cms/pull/14345))
- `craft\db\Connection::getSupportsMb4()` is now dynamic for MySQL installs, based on whether the `elements_sites` table has an `mb4` charset.
- `craft\elemens\db\ElementQueryInterface::collect()` now has an `ElementCollection` return type, rather than `Collection`.
- `craft\elements\Entry::getSection()` can now return `null`, for nested entries.
Expand All @@ -431,6 +443,7 @@
- `craft\fields\fieldlayoutelements\BaseUiElement::selectorIcon()` can now return a system icon name. ([#14169](https://github.com/craftcms/cms/pull/14169))
- `craft\gql\mutations\Entry::createSaveMutations()` now accepts a `$section` argument.
- `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))
- `craft\helpers\Assets::generateUrl()` no longer has an `$fs` argument. ([#14353](https://github.com/craftcms/cms/pull/14353))
- `craft\helpers\Cp::fieldHtml()` now supports a `labelExtra` config value.
- `craft\helpers\Db::parseParam()`, `parseDateParam()`, `parseMoneyParam()`, and `parseNumericParam()` now return `null` instead of an empty string if no condition should be applied.
- `craft\helpers\Html::id()` and `Craft.formatInputId()` now retain colons and periods, and ensure the string begins with a letter.
Expand All @@ -440,6 +453,7 @@
- `craft\helpers\StringHelper::toString()` now supports backed enums.
- `craft\i18n\I18N::getPrimarySiteLocale()` is now deprecated. `craft\models\Site::getLocale()` should be used instead.
- `craft\i18n\I18N::getPrimarySiteLocaleId()` is now deprecated. `craft\models\Site::$language` should be used instead.
- `craft\models\FieldLayout::getField()` and `isFieldIncluded()` now now have a `$filter` argument rather than `$attribute`, and it can be set to a callable.
- `craft\models\Section::$propagationMethod` now has a type of `craft\enums\PropagationMethod`.
- `craft\services\AssetIndexer::indexFileByListing()` now has a `$volume` argument in place of `$volumeId`.
- `craft\services\AssetIndexer::indexFolderByListing()` now has a `$volume` argument in place of `$volumeId`.
Expand All @@ -459,6 +473,7 @@
- `craft\services\Users::verifyEmailForUser()` now has a `void` return type, and throws an `InvalidElementException` in case of failure.
- `craft\web\Controller::asModelSuccess()` now includes a `modelClass` key in the response data (and `modelId` if the model implements `craft\base\Identifiable`).
- Colors defined by elements’ `statuses()` methods can now be a `craft\enums\Color` instance.
- Exception response data no longer includes an `error` key with the exception message. `message` should be used instead. ([#14346](https://github.com/craftcms/cms/pull/14346))
- Deprecated `craft\events\DefineElementInnerHtmlEvent`.
- Deprecated `craft\events\SearchEvent::$siteId`.
- Deprecated `craft\helpers\Component::iconSvg()`. `craft\helpers\Cp::iconSvg()` and `fallbackIconSvg()` should be used instead. ([#14169](https://github.com/craftcms/cms/pull/14169))
Expand Down
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# Release Notes for Craft CMS 5

## Unreleased

- Entry type and field edit pages now list their usages. ([#14397](https://github.com/craftcms/cms/pull/14397))
- Restored the “Preview” and “Edit Image” buttons on asset image previews. ([#14333](https://github.com/craftcms/cms/discussions/14333))
- Improved the accessibility of the global sidebar. ([#14335](https://github.com/craftcms/cms/pull/14335))
- Improved the contrast of the Dev Mode caution tape indicator. ([#14336](https://github.com/craftcms/cms/pull/14336))
- GraphQL schemas can now include queries and mutations for nested entries (e.g. within Matrix or CKEditor fields) directly. ([#14366](https://github.com/craftcms/cms/pull/14366))
- Added the `fieldId`, `fieldHandle`, `ownerId`, and `sortOrder` entry GraphQL fields. ([#14366](https://github.com/craftcms/cms/pull/14366))
- Nested addresses are now cached by their field ID, and address queries now register cache tags based on their `field` and `fieldId` params.
- Nested entries are now cached by their field ID, and entry queries now register cache tags based on their `field` and `fieldId` params.
- Added `craft\base\CpEditable`.
- Added `craft\models\EntryType::findUsages()`.
- Added `craft\services\Fields::EVENT_REGISTER_NESTED_ENTRY_FIELD_TYPES`.
- Added `craft\services\Fields::findFieldUsages()`.
- Added `craft\services\Fields::getNestedEntryFieldTypes()`.
- Added `craft\services\ProjectConfig::EVENT_AFTER_WRITE_YAML_FILES`. ([#14365](https://github.com/craftcms/cms/discussions/14365))
- Added `craft\services\Relations::deleteLeftoverRelations()`. ([#13956](https://github.com/craftcms/cms/issues/13956))
- Added `craft\services\Search::shouldCallSearchElements()`. ([#14293](https://github.com/craftcms/cms/issues/14293))
- `craft\behaviors\SessionBehavior::setSuccess()` and `getSuccess()` use the `success` flash key now, rather than `notice`. ([#14345](https://github.com/craftcms/cms/pull/14345))
- `craft\helpers\Assets::generateUrl()` no longer has an `$fs` argument. ([#14353](https://github.com/craftcms/cms/pull/14353))
- `craft\models\FieldLayout::getField()` and `isFieldIncluded()` now now have a `$filter` argument rather than `$attribute`, and it can be set to a callable.
- Exception response data no longer includes an `error` key with the exception message. `message` should be used instead. ([#14346](https://github.com/craftcms/cms/pull/14346))
- Relations for fields that are no longer included in an element’s field layout are now deleted after element save. ([#13956](https://github.com/craftcms/cms/issues/13956))
- Assets fields’ selection modals now open to the last-viewed location by default, if their Default Upload Location doesn’t specify a subpath. ([#14382](https://github.com/craftcms/cms/pull/14382))
- Fixed an error that occurred when adding a new block to a Matrix field with an overridden handle. ([#14350](https://github.com/craftcms/cms/issues/14350))
- Fixed a bug where opening a disclosure menu wasn’t hiding others. ([#14354](https://github.com/craftcms/cms/issues/14354))
- Fixed a bug where non-global custom fields were being shown on the Fields index page when searching. ([#14344](https://github.com/craftcms/cms/issues/14344))
- Fixed a bug where component slideouts would open when long-pressing on a component’s action menu button or drag handle within a component select input.
- Fixed various issues with Tags fields. ([#14356](https://github.com/craftcms/cms/issues/14356), [#14359](https://github.com/craftcms/cms/pull/14359))
- Fixed a bug where it was possible to include single-instance fields multiple times in a field layout. ([#14352](https://github.com/craftcms/cms/issues/14352))
- Fixed a bug where nested entries could become orphaned when pressing “Save as a new entry”. ([#14378](https://github.com/craftcms/cms/issues/14378))
- Fixed a bug where read/write splitting was always getting disabled for GraphQL POST requests. ([#14324](https://github.com/craftcms/cms/issues/14324))
- Fixed a bug where GraphQL schema edit pages could include empty category headings.
- Fixed a bug where asset slideouts weren’t showing validation errors on the Filename field. ([#14329](https://github.com/craftcms/cms/issues/14329))
- Fixed a bug where element slideouts would open when long-pressing on an element’s “Remove” button within an element select input.
- Fixed a bug where relations weren’t getting deleted when an element was deleted for a site. ([#14347](https://github.com/craftcms/cms/issues/14347))

## 5.0.0-beta.1 - 2024-02-08

### Content Management
Expand Down
5 changes: 2 additions & 3 deletions packages/craftcms-vue/admintable/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1150,11 +1150,10 @@
background-color: #fff;
border-top: 1px solid #f3f7fc;
bottom: 0;
margin-bottom: -14px;
margin-bottom: calc(var(--xl) * -1);
margin-top: 14px;
padding-bottom: 14px;
padding-top: 14px;
position: sticky;
min-height: 44px;
}
.vue-admin-tablepane + .vue-admin-table-footer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
type: Object,
default: () => {
return {
singular: Craft.t('app', 'Item'),
plural: Craft.t('app', 'Items'),
singular: Craft.t('app', 'item'),
plural: Craft.t('app', 'items'),
};
},
},
Expand Down
25 changes: 25 additions & 0 deletions src/base/CpEditable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* @link https://craftcms.com/
* @copyright Copyright (c) Pixel & Tonic, Inc.
* @license https://craftcms.github.io/license/
*/

namespace craft\base;

/**
* CpEditable defines the common interface to be implemented by components that
* have a dedicated edit page in the control panel.
*
* @author Pixel & Tonic, Inc. <[email protected]>
* @since 5.0.0
*/
interface CpEditable
{
/**
* Returns the URL to the component’s edit page in the control panel.
*
* @return string|null
*/
public function getCpEditUrl(): ?string;
}
5 changes: 5 additions & 0 deletions src/base/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -5693,6 +5693,11 @@ public function afterPropagate(bool $isNew): void
$field->afterElementPropagate($this, $isNew);
}

// Delete relations that don’t belong to a relational field on the element's field layout
if (!ElementHelper::isDraftOrRevision($this)) {
Craft::$app->getRelations()->deleteLeftoverRelations($this);
}

// Trigger an 'afterPropagate' event
if ($this->hasEventHandlers(self::EVENT_AFTER_PROPAGATE)) {
$this->trigger(self::EVENT_AFTER_PROPAGATE, new ModelEvent([
Expand Down
15 changes: 7 additions & 8 deletions src/base/ElementInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@
* @author Pixel & Tonic, Inc. <[email protected]>
* @since 3.0.0
*/
interface ElementInterface extends ComponentInterface, Chippable, Thumbable, Statusable, Actionable
interface ElementInterface extends
ComponentInterface,
Chippable,
CpEditable,
Thumbable,
Statusable,
Actionable
{
/**
* Returns the lowercase version of [[displayName()]].
Expand Down Expand Up @@ -907,13 +913,6 @@ public function hasRevisions(): bool;
*/
public function prepareEditScreen(Response $response, string $containerId): void;

/**
* Returns the element’s edit URL in the control panel.
*
* @return string|null
*/
public function getCpEditUrl(): ?string;

/**
* Returns the URL that users should be redirected to after editing the element.
*
Expand Down
11 changes: 4 additions & 7 deletions src/behaviors/SessionBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public function setNotice(string $message, array $settings = []): void
'icon' => 'info',
'iconLabel' => Craft::t('app', 'Notice'),
]);
$this->owner->setFlash('cp-notice', $message);
} else {
$this->owner->setFlash('notice', $message);
}
Expand All @@ -72,8 +71,8 @@ public function setNotice(string $message, array $settings = []): void
* Stores a success message in the user’s flash data.
*
* The message will be stored on the session, and can be retrieved by calling
* [[getFlash()|`getFlash('notice')`]] or [[getAllFlashes()]].
* Only one flash notice can be stored at a time.
* [[getFlash()|`getFlash('success')`]] or [[getAllFlashes()]].
* Only one flash success message can be stored at a time.
*
* @param string $message The message
* @param array $settings The control panel notification settings
Expand All @@ -87,8 +86,7 @@ public function setSuccess(string $message, array $settings = []): void
'iconLabel' => Craft::t('app', 'Success'),
]);
} else {
// todo: switch to `success` in Craft 5
$this->owner->setFlash('notice', $message);
$this->owner->setFlash('success', $message);
}
}

Expand Down Expand Up @@ -140,8 +138,7 @@ public function getSuccess(): ?string
return $this->_getNotificationFlashMessage('success');
}

// todo: switch to `success` in Craft 5
return $this->owner->getFlash('notice');
return $this->owner->getFlash('success');
}

/**
Expand Down
Loading

0 comments on commit a67b827

Please sign in to comment.