Skip to content

Commit

Permalink
Merge branch '5.x' of github.com:craftcms/cms into fork/cp-sidebar-ui…
Browse files Browse the repository at this point in the history
…-fixes
  • Loading branch information
brianjhanson committed Apr 30, 2024
2 parents c1cd686 + 963ff6d commit b14e83f
Show file tree
Hide file tree
Showing 126 changed files with 1,984 additions and 805 deletions.
55 changes: 53 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,72 @@
# Release Notes for Craft CMS 5

## Unreleased
## 5.1.0 - 2024-04-30

### Content Management
- Sort options are now sorted alphabetically within element indexes, and custom fields’ options are now listed in a “Fields” group. ([#14725](https://github.com/craftcms/cms/issues/14725))
- Unselected table column options are now sorted alphabetically within element indexes.
- Table views within element index pages are now scrolled directly, so that their horizontal scrollbars are always visible without scrolling to the bottom of the page. ([#14765](https://github.com/craftcms/cms/issues/14765))
- Element tooltips now appear after a half-second delay. ([#14836](https://github.com/craftcms/cms/issues/14836))
- Thumbnails within element cards are slightly larger.
- Improved element editor page styling on mobile. ([#14898](https://github.com/craftcms/cms/pull/14898), [#14885](https://github.com/craftcms/cms/issues/14885))

### User Management
- Team edition users are no longer required to be admins.
- Added the “User Permissions” settings page for managing the permissions of non-admin Team edition users. ([#14768](https://github.com/craftcms/cms/discussions/14768))

### Administration
- Element conditions within field layout designers’ component settings now only list custom fields present in the current field layout. ([#14787](https://github.com/craftcms/cms/issues/14787))
- Improved the behavior of the URI input within Edit Route modals. ([#14884](https://github.com/craftcms/cms/issues/14884))
- The “Upgrade Craft CMS” page in the Plugin Store no longer lists unsupported editions.
- Added the `asyncCsrfInputs` config setting. ([#14625](https://github.com/craftcms/cms/pull/14625))
- Added the `backupCommandFormat` config setting. ([#14897](https://github.com/craftcms/cms/pull/14897))
- The `backupCommand` config setting can now be set to a closure, which will be passed a `mikehaertl\shellcommand\Command` object. ([#14897](https://github.com/craftcms/cms/pull/14897))
- Added the `safeMode` config setting. ([#14734](https://github.com/craftcms/cms/pull/14734))
- `resave` commands now support an `--if-invalid` option. ([#14731](https://github.com/craftcms/cms/issues/14731))
- Improved the styling of conditional tabs and UI elements within field layout designers.

### Extensibility
- Added `craft\conditions\ConditionInterface::getBuilderConfig()`.
- Added `craft\controllers\EditUserTrait`. ([#14789](https://github.com/craftcms/cms/pull/14789))
- Added `craft\controllers\UsersController::EVENT_DEFINE_EDIT_SCREENS`. ([#14789](https://github.com/craftcms/cms/pull/14789))
- Added `craft\elements\conditions\ElementConditionInterface::setFieldLayouts()`.
- Added `craft\events\DefineEditUserScreensEvent`. ([#14789](https://github.com/craftcms/cms/pull/14789))
- Added `craft\helpers\Cp::parseTimestampParam()`.
- Added `craft\models\FieldLayoutTab::labelHtml()`.
- Added `craft\services\ProjectConfig::getAppliedChanges()`. ([#14851](https://github.com/craftcms/cms/discussions/14851))
- Added `craft\web\Request::getBearerToken()`. ([#14784](https://github.com/craftcms/cms/pull/14784))
- Added `craft\db\CoalesceColumnsExpression`.
- Added `craft\db\ExpressionBuilder`.
- Added `craft\db\ExpressionInterface`.
- `craft\base\NameTrait::prepareNamesForSave()` no longer updates the name properties if `fullName`, `firstName`, and `lastName` are already set. ([#14665](https://github.com/craftcms/cms/issues/14665))
- `craft\helpers\Typecast::properties()` now typecasts numeric strings to integers, for `int|string` properties. ([#14618](https://github.com/craftcms/cms/issues/14618))
- Added `Craft.MatrixInput.Entry`. ([#14730](https://github.com/craftcms/cms/pull/14730))

### System
- Batched queue jobs now set their progress based on the total progress across all batches, rather than just the current batch. ([#14817](https://github.com/craftcms/cms/pull/14817))
- Fixed a bug where ordering by a custom field would only partially work, if the custom field was included in multiple field layouts for the resulting elements. ([#14821](https://github.com/craftcms/cms/issues/14821))
- Fixed a bug where element conditions within field layout designers’ component settings weren’t listing custom fields which were just added to the layout. ([#14787](https://github.com/craftcms/cms/issues/14787))
- Fixed a bug where asset thumbnails within element cards were blurry. ([#14866](https://github.com/craftcms/cms/issues/14866))
- Fixed a styling issue with Categories and Entries fields when “Maintain Hierarchy” was enabled.
- Fixed a bug where Delete actions weren’t working in admin tables. ([craftcms/commerce#3444](https://github.com/craftcms/commerce/issues/3444))

## 5.0.6 - 2024-04-29

- Fixed a bug where element caches weren’t getting invalidated when an element was moved within a structure. ([#14846](https://github.com/craftcms/cms/issues/14846))
- Fixed a bug where CSV’s header rows weren’t using the configured delimiter. ([#14855](https://github.com/craftcms/cms/issues/14855))
- Fixed a bug where editable table cell text styling could change after initial focus. ([#14857](https://github.com/craftcms/cms/issues/14857))
- Fixed a bug where conditions could list rules with duplicate labels.
- Fixed a bug where admin tables weren’t displaying disabled statuses. ([#14861](https://github.com/craftcms/cms/issues/14861))
- Fixed a bug where clicking on drag handles within element index tables could select the element. ([#14669](https://github.com/craftcms/cms/issues/14669))
- Fixed a bug where nested related categories and entries weren’t removable when the Categories/Entries field’s “Maintain hierarchy” setting was enabled. ([#14843](https://github.com/craftcms/cms/issues/14843))
- Fixed a bug where nested related categories and entries weren’t directly removable, and could be unintentionally overwritten, when the Categories/Entries field’s “Maintain hierarchy” setting was enabled. ([#14843](https://github.com/craftcms/cms/issues/14843), [#14872](https://github.com/craftcms/cms/issues/14872))
- Fixed a SQL error that could occur on PostgreSQL. ([#14860](https://github.com/craftcms/cms/pull/14870))
- Fixed a bug where field layout designers were showing redundant field indicators, for fields with hidden labels. ([#14859](https://github.com/craftcms/cms/issues/14859))
- Fixed a bug where field type names weren’t sorted alphabetically when editing an existing field. ([#14858](https://github.com/craftcms/cms/issues/14858))
- Fixed a JavaScript error that could occur when removing elements from an element select input. ([#14873](https://github.com/craftcms/cms/pull/14873))
- Fixed a bug where queue jobs’ progress indicators in the control panel sidebar weren’t fully cleaned up when jobs were finished. ([#14856](https://github.com/craftcms/cms/issues/14856))
- Fixed a bug where errors weren’t getting logged. ([#14863](https://github.com/craftcms/cms/issues/14863))
- Fixed a bug where asset thumbnails could have the wrong aspect ratio. ([#14866](https://github.com/craftcms/cms/issues/14866))
- Fixed an infinite recursion bug that occurred when selecting elements, if no sources were enabled for the selected site. ([#14882](https://github.com/craftcms/cms/issues/14882))

## 5.0.5 - 2024-04-23

Expand Down
16 changes: 15 additions & 1 deletion bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,25 @@
'components' => $components,
],
require $srcPath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.php',
require $srcPath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . "app.{$appType}.php",
require $srcPath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . "app.{$appType}.php"
);

$localConfig = ArrayHelper::merge(
$configService->getConfigFromFile('app'),
$configService->getConfigFromFile("app.{$appType}")
);

$safeMode = App::env('CRAFT_SAFE_MODE') ?? $generalConfig['safeMode'] ?? false;

if ($safeMode) {
ArrayHelper::remove($localConfig, 'bootstrap');
ArrayHelper::remove($localConfig, 'components');
ArrayHelper::remove($localConfig, 'extensions');
ArrayHelper::remove($localConfig, 'container');
}

$config = ArrayHelper::merge($config, $localConfig);

if (function_exists('craft_modify_app_config')) {
craft_modify_app_config($config, $appType);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/craftcms-vue/admintable/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@
label: Craft.t('app', 'Delete'),
action: this.deleteAction,
error: true,
ajax: true,
ajax: this.tableDataEndpoint ? true : false,
allowMultiple: this.allowMultipleDeletions,
separator: itemActions.length ? true : false,
});
Expand Down
4 changes: 1 addition & 3 deletions src/base/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -1249,9 +1249,7 @@ public static function indexHtml(
$elements = static::indexElements($elementQuery, $sourceKey);

if (empty($elements)) {
$message = Craft::t('app', 'No {type} yet.', [
'type' => static::pluralLowerDisplayName(),
]);
$message = Craft::t('app', 'Nothing yet.');
return Html::tag('div', $message, [
'class' => ['zilch', 'small'],
]);
Expand Down
13 changes: 12 additions & 1 deletion src/base/FieldLayoutComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ public function setUserCondition(mixed $userCondition): void
public function getElementCondition(): ?ElementConditionInterface
{
if (isset($this->_elementCondition) && !$this->_elementCondition instanceof ElementConditionInterface) {
if (is_string($this->_elementCondition)) {
$this->_elementCondition = ['class' => $this->_elementCondition];
}
$this->_elementCondition = array_merge(
['fieldLayouts' => [$this->getLayout()]],
$this->_elementCondition,
);
$this->_elementCondition = $this->_normalizeCondition($this->_elementCondition);
}

Expand Down Expand Up @@ -266,7 +273,11 @@ public function getSettingsHtml(): string
$elementType = $this->elementType ?? $this->getLayout()->type;

if ($elementType && is_subclass_of($elementType, ElementInterface::class)) {
$elementCondition = $this->getElementCondition() ?? self::defaultElementCondition($elementType);
$elementCondition = $this->getElementCondition();
if (!$elementCondition) {
$elementCondition = clone self::defaultElementCondition($elementType);
$elementCondition->setFieldLayouts([$this->getLayout()]);
}
$elementCondition->mainTag = 'div';
$elementCondition->id = 'element-condition';
$elementCondition->name = 'elementCondition';
Expand Down
6 changes: 6 additions & 0 deletions src/base/NameTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ protected function normalizeNames(): void
protected function prepareNamesForSave(): void
{
if ($this->fullName !== null) {
// if firstName/lastName are also set, just leave them alone
// (https://github.com/craftcms/cms/issues/14665)
if ($this->firstName !== null || $this->lastName !== null) {
return;
}

$generalConfig = Craft::$app->getConfig()->getGeneral();
$languages = [
// Load our custom language file first so config settings can override the defaults
Expand Down
12 changes: 10 additions & 2 deletions src/base/conditions/BaseCondition.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public function getBuilderInnerHtml(bool $autofocusAddButton = false): string
]);

$html .= Html::hiddenInput('class', get_class($this));
$html .= Html::hiddenInput('config', Json::encode($this->config()));
$html .= Html::hiddenInput('config', Json::encode($this->getBuilderConfig()));

foreach ($this->getConditionRules() as $rule) {
try {
Expand Down Expand Up @@ -588,6 +588,14 @@ protected function defineRules(): array
];
}

/**
* @inheritdoc
*/
public function getBuilderConfig(): array
{
return $this->config();
}

/**
* @inheritdoc
*/
Expand All @@ -611,7 +619,7 @@ public function getConfig(): array
}

/**
* Returns the condition’s portable config.
* Returns the base config that should be maintained by the builder and included in the condition’s portable config.
*
* @return array
*/
Expand Down
8 changes: 8 additions & 0 deletions src/base/conditions/ConditionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public function getBuilderHtml(): string;
*/
public function getBuilderInnerHtml(bool $autofocusAddButton = false): string;

/**
* Returns configuration that should be maintained for the builder.
*
* @return array
* @since 5.1.0
*/
public function getBuilderConfig(): array;

/**
* Returns the condition’s portable config.
*
Expand Down
Loading

0 comments on commit b14e83f

Please sign in to comment.