Config Changes in Craft CMS 5

Craft 5 introduced several general configuration changes that give you more control over your Craft installation.

Image

dis­ableAut­o­Fo­cus #

Part of the accessibilityDefaults con­fig­u­ra­tion array to con­trol if search inputs should be focused on page load. 

💾 See Craft source code

dis­able­dU­til­i­ties #

You can set the Util­i­ties you don’t want to show in the con­trol pan­el across all envi­ron­ments. The set­ting takes a string of com­ma-sep­a­rat­ed util­i­ty han­dles (find them in the URL slug; e.g. system-messages, deprecation-errors). You can also set this via an envi­ron­ment vari­able called CRAFT_DISABLED_UTILITIES.

return GeneralConfig::create()
     //...
    ->disabledUtilities('system-messages, deprecation-error');

In your .env file:

CRAFT_DISABLED_UTILITIES=system-messages, deprecation-errors

💾 See Craft source code

🎥 Watch CraftQuest video

localeAlias­es #

Spec­i­fy cus­tom locale alias­es that will be includ­ed when fetch­ing locales. Should be defined as an array per GeneralConfig.php.

💾 See Craft source code

par­tial­Tem­plates­Path #

Sup­ports the new par­tials ren­der­ing fea­ture for ele­ments (with the new long­form con­tent fea­ture of CKEd­i­tor specif­i­cal­ly in mind. The path can be any­where with­in your project, but the default is _partials at the root of your tem­plates direc­to­ry. The par­tials tem­plate path will auto­mat­i­cal­ly have an ele­ment type han­dle includ­ed, e.g. _partials/entry/. You will need to cre­ate that sub­di­rec­to­ry yourself.

return GeneralConfig::create()
     //...
    ->partialTemplatesPath('_special/partials');

In your .env file:

CRAFT_PARTIAL_TEMPLATES_PATH=_special/partials

💾 See Craft source code

🎥 Watch CraftQuest video

tem­pAs­se­tU­pload­Fs #

Set the han­dle that Craft should use for stor­ing tem­po­rary file uploads. To set this per envi­ron­ment, you can use the CRAFT_TEMP_ASSET_UPLOAD_FS envri­on­ment vari­able with the han­dle of the filesystem.

return GeneralConfig::create()
     //...
    ->tempAssetUploadFs('tempFs');

In your .env file:

CRAFT_TEMP_ASSET_UPLOAD_FS=tempFs

💾 See Craft source code

default­Tem­pla­te­Ex­ten­sions #

When Craft looks up a tem­plate file on the front-end, it will now look for .twig tem­plates before .html tem­plates since the rec­om­mend­ed exten­sion is .twig.

💾 See Craft source code