Loading core/lib/Drupal/Core/Htmx/Htmx.php +44 −0 Changes for core/lib/Drupal/Core/Htmx/Htmx.php: 44 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1229,6 +1229,50 @@ public function indicator(string $selector, int $modifiers = self::NO_MODIFIER): return $this; } /** * Creates a `data-hx-morph-skip` attribute. * * The hx-morph-skip attribute leaves an element untouched during * a morph swap. htmx copies no attributes and morphs no children. * * As this attribute always marks a single element, modifiers are not * applicable. * * @param bool $toggle * Whether to toggle the attribute on or off. Defaults to TRUE. * * @return static * Returns this object to allow chaining methods. * * @see https://four.htmx.org/reference/attributes/hx-morph-skip/ */ public function morphSkip(bool $toggle = TRUE): static { $this->createBooleanAttribute('hx-morph-skip', $toggle, self::NO_MODIFIER); return $this; } /** * Creates a `data-hx-morph-skip-children` attribute. * * The hx-morph-skip-children attribute updates an element’s attributes * during a morph swap but leaves its children alone. * * As this attribute always marks a single element, modifiers are not * applicable. * * @param bool $toggle * Whether to toggle the attribute on or off. Defaults to TRUE. * * @return static * Returns this object to allow chaining methods. * * @see https://four.htmx.org/reference/attributes/hx-morph-skip-children/ */ public function morphSkipChildren(bool $toggle = TRUE): static { $this->createBooleanAttribute('hx-morph-skip-children', $toggle, self::NO_MODIFIER); return $this; } /** * Creates a `data-hx-preserve` attribute. * Loading core/tests/Drupal/Tests/Core/Htmx/HtmxAttributesTest.php +2 −0 Changes for core/tests/Drupal/Tests/Core/Htmx/HtmxAttributesTest.php: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -359,6 +359,8 @@ public static function hxSimpleStringAttributesDataProvider(): array { ['method', 'PUT', 'data-hx-method', 'PUT'], ['method', 'patch', 'data-hx-method', 'patch'], ['method', 'delete', 'data-hx-method', 'delete'], ['morphSkip', NULL, 'data-hx-morph-skip', TRUE], ['morphSkipChildren', NULL, 'data-hx-morph-skip-children', TRUE], ]; } Loading Loading
core/lib/Drupal/Core/Htmx/Htmx.php +44 −0 Changes for core/lib/Drupal/Core/Htmx/Htmx.php: 44 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1229,6 +1229,50 @@ public function indicator(string $selector, int $modifiers = self::NO_MODIFIER): return $this; } /** * Creates a `data-hx-morph-skip` attribute. * * The hx-morph-skip attribute leaves an element untouched during * a morph swap. htmx copies no attributes and morphs no children. * * As this attribute always marks a single element, modifiers are not * applicable. * * @param bool $toggle * Whether to toggle the attribute on or off. Defaults to TRUE. * * @return static * Returns this object to allow chaining methods. * * @see https://four.htmx.org/reference/attributes/hx-morph-skip/ */ public function morphSkip(bool $toggle = TRUE): static { $this->createBooleanAttribute('hx-morph-skip', $toggle, self::NO_MODIFIER); return $this; } /** * Creates a `data-hx-morph-skip-children` attribute. * * The hx-morph-skip-children attribute updates an element’s attributes * during a morph swap but leaves its children alone. * * As this attribute always marks a single element, modifiers are not * applicable. * * @param bool $toggle * Whether to toggle the attribute on or off. Defaults to TRUE. * * @return static * Returns this object to allow chaining methods. * * @see https://four.htmx.org/reference/attributes/hx-morph-skip-children/ */ public function morphSkipChildren(bool $toggle = TRUE): static { $this->createBooleanAttribute('hx-morph-skip-children', $toggle, self::NO_MODIFIER); return $this; } /** * Creates a `data-hx-preserve` attribute. * Loading
core/tests/Drupal/Tests/Core/Htmx/HtmxAttributesTest.php +2 −0 Changes for core/tests/Drupal/Tests/Core/Htmx/HtmxAttributesTest.php: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -359,6 +359,8 @@ public static function hxSimpleStringAttributesDataProvider(): array { ['method', 'PUT', 'data-hx-method', 'PUT'], ['method', 'patch', 'data-hx-method', 'patch'], ['method', 'delete', 'data-hx-method', 'delete'], ['morphSkip', NULL, 'data-hx-morph-skip', TRUE], ['morphSkipChildren', NULL, 'data-hx-morph-skip-children', TRUE], ]; } Loading