mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 02:46:29 +00:00
Merge branch '3.x' into 4.x
* 3.x: Simplify code Fix CHANGELOG Improve YieldReady support docs Fix some typos in `html_cva` docs Fix wrong type for cycle position Add type for join method
This commit is contained in:
@@ -15,7 +15,7 @@ function where you define ``base`` classes that should always be present and the
|
||||
|
||||
{# templates/alert.html.twig #}
|
||||
{% set alert = html_cva(
|
||||
base='alert ',
|
||||
base='alert',
|
||||
variants={
|
||||
color: {
|
||||
blue: 'bg-blue',
|
||||
@@ -40,13 +40,13 @@ Then use the ``color`` and ``size`` variants to select the needed classes:
|
||||
|
||||
{# index.html.twig #}
|
||||
{{ include('alert.html.twig', {'color': 'blue', 'size': 'md'}) }}
|
||||
// class="alert bg-red text-lg"
|
||||
// class="alert bg-red text-md"
|
||||
|
||||
{{ include('alert.html.twig', {'color': 'green', 'size': 'sm'}) }}
|
||||
// class="alert bg-green text-sm"
|
||||
|
||||
{{ include('alert.html.twig', {'color': 'red', 'class': 'flex items-center justify-center'}) }}
|
||||
// class="alert bg-red text-md flex items-center justify-center"
|
||||
// class="alert bg-red flex items-center justify-center"
|
||||
|
||||
CVA and Tailwind CSS
|
||||
--------------------
|
||||
@@ -113,7 +113,7 @@ when multiple other variant conditions are met:
|
||||
// class="alert bg-green text-sm"
|
||||
|
||||
{{ include('alert.html.twig', {color: 'red', size: 'md'}) }}
|
||||
// class="alert bg-green text-lg font-bold"
|
||||
// class="alert bg-green text-md font-bold"
|
||||
|
||||
Default Variants
|
||||
----------------
|
||||
@@ -123,7 +123,7 @@ If no variants match, you can define a default set of classes to apply:
|
||||
.. code-block:: html+twig
|
||||
|
||||
{% set alert = html_cva(
|
||||
base='alert ',
|
||||
base='alert',
|
||||
variants={
|
||||
color: {
|
||||
blue: 'bg-blue',
|
||||
@@ -153,7 +153,7 @@ If no variants match, you can define a default set of classes to apply:
|
||||
{# index.html.twig #}
|
||||
|
||||
{{ include('alert.html.twig', {color: 'red', size: 'lg'}) }}
|
||||
// class="alert bg-red text-lg font-bold rounded-md"
|
||||
// class="alert bg-red text-lg rounded-md"
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@@ -363,7 +363,7 @@ final class CoreExtension extends AbstractExtension
|
||||
* Cycles over a sequence.
|
||||
*
|
||||
* @param array|\ArrayAccess $values A non-empty sequence of values
|
||||
* @param positive-int $position The position of the value to return in the cycle
|
||||
* @param int<0, max> $position The position of the value to return in the cycle
|
||||
*
|
||||
* @return mixed The value at the given position in the sequence, wrapping around as needed
|
||||
*
|
||||
@@ -776,9 +776,9 @@ final class CoreExtension extends AbstractExtension
|
||||
* {{ [1, 2, 3]|join }}
|
||||
* {# returns 123 #}
|
||||
*
|
||||
* @param array $value An array
|
||||
* @param string $glue The separator
|
||||
* @param string|null $and The separator for the last pair
|
||||
* @param iterable|array|string|float|int|bool|null $value An array
|
||||
* @param string $glue The separator
|
||||
* @param string|null $and The separator for the last pair
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user