New in Craft CMS 4.3
I want to positively mention the changelogs, which have become much clearer and more reader-friendly thanks to their new format. Divided into sections such as Authoring, Accessibility, Development, or Extended, every user should be able to find the information that is important to them more quickly.
Element and Asset Indexes
In addition, the index pages have received a new button at the end of the sidebar, where you can select the "Customize sources" option and thus create and manage your sources.
The index page for assets has been updated to include a button with the actions "New subfolder", "Rename folder", and "Delete folder".
Conditional Rules
The condition rules for date ranges have been extended to support relative range types such as "Today", "This week", "This month", "This year", "Past 7 days", "Past 30 days", "Past year", "Before..." and "After..." , in addition to specifying specific date ranges.
Number condition rules support the "is between..." operator to define a minimum and maximum value. All text, number and date range condition rules now support the "has a value" and "is empty" operators.
Twig Global Variables
With Craft 4.3 some new Twig Global Variables have been added. There are now Today, tomorrow, and yesterday as Date objects, which are formatted by filters. As the names suggest, Today's, yesterday's, and tomorrow's date can be output.
{{ today | date('M d, Y') }}
{{ tomorrow | date('M d, Y') }}
{{ yesterday | date('M d, Y') }}
Ryan Irelan presented all the features in detail in a video on Craftquest. He also gave an example of how to use these new Twig Globals in Element Queries and define the exact period of Today. You should watch the video to know precisely why he wrote the queries this way.
{% set todayPosts = craft.entries
.section('testimonials')
.postDate([
'and',
">= #{today|date('Y-m-d')}",
"< #{tomorrow|date('Y-m-d')}"
])
.all() %}
{% for post in todaysPosts %}
<li>{{ post.title }} - {{ post.postDate | date("M d, Y") }}</li>
{% endfor %}
Twig Filter
With boolean, float, integer, and string, new Twig filters have been added. A welcome innovation since Craft moved to an explicitly typed API with version 4, and with the new filters, it can now be ensured that the parameters have the expected type.
{% set val1 = true | boolean %} {# true #}
{% set val2 = "Hello" | integer %} {# 0 #}
{% set val3 = 12345.1 | float %} {% {# 12345.1 #}
{% set val4 = 12345 | string %} {# '12345' #}
Twig function
There are new global Twig functions for element authorization for Craft 4.3 with canCreateDrafts() , canDelete(), canDeleteForSite(), canDuplicate(), canSave() and canView(). These functions include element and user arguments, but the user is optional, and the default value is set to the current user.
{% if not canView(entry) %}
{% redirect siteUrl %}
{% endif %}
If you want to know all the details, it is best to read the changelog.