Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.

This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/).

## [8.14.6]

### Fixed

- Input, date, phone, rating, and textarea components: separated `fieldHideLabel` into a conditional assignment so it is only passed when explicitly set to true, allowing the field component's default hide-label behavior to work correctly.
- Removed unused `missingType.generics` PHPStan ignore rule.

## [8.14.5]

### Fixed
Expand Down Expand Up @@ -1709,6 +1716,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a

- Initial production release.

[8.14.6]: https://github.com/infinum/eightshift-forms/compare/8.14.5...8.14.6
[8.14.5]: https://github.com/infinum/eightshift-forms/compare/8.14.4...8.14.5
[8.14.4]: https://github.com/infinum/eightshift-forms/compare/8.14.3...8.14.4
[8.14.3]: https://github.com/infinum/eightshift-forms/compare/8.14.2...8.14.3
Expand Down
2 changes: 1 addition & 1 deletion eightshift-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Description: Eightshift Forms is a complete form builder plugin that utilizes modern Block editor features with multiple third-party integrations, bringing your project to a new level.
* Author: WordPress team @Infinum
* Author URI: https://eightshift.com/
* Version: 8.14.5
* Version: 8.14.6
* Text Domain: eightshift-forms
*
* @package EightshiftForms
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ parameters:
ignoreErrors:
# Block templates
- '/^Variable (\$attributes|\$renderContent|\$manifest|\$globalManifest) might not be defined\.$/'
- identifier: missingType.generics

40 changes: 23 additions & 17 deletions src/Blocks/components/date/date.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,32 @@ class="' . esc_attr($dateClass) . '"
' . $additionalContent . '
';

$fieldOutput = [
'fieldContent' => $date,
'fieldId' => $dateId,
'fieldTypeInternal' => FormsHelper::getStateFieldType($dateType === 'date' ? 'date' : 'dateTime'),
'fieldName' => $dateName,
'fieldTwSelectorsData' => $dateTwSelectorsData,
'fieldIsRequired' => $dateIsRequired,
'fieldDisabled' => !empty($dateIsDisabled),
'fieldTypeCustom' => $dateTypeCustom ?: $dateType, // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
'fieldTracking' => $dateTracking,
'fieldConditionalTags' => Helpers::render(
'conditional-tags',
Helpers::props('conditionalTags', $attributes)
),
'fieldAttrs' => $dateFieldAttrs,
];

// Hide label if needed but separated like this so we can utilize normal fieldHideLabel attribute from field component.
if ($dateHideLabel) {
$fieldOutput['fieldHideLabel'] = true;
}

echo Helpers::render(
'field',
array_merge(
Helpers::props('field', $attributes, [
'fieldContent' => $date,
'fieldId' => $dateId,
'fieldTypeInternal' => FormsHelper::getStateFieldType($dateType === 'date' ? 'date' : 'dateTime'),
'fieldName' => $dateName,
'fieldTwSelectorsData' => $dateTwSelectorsData,
'fieldIsRequired' => $dateIsRequired,
'fieldDisabled' => !empty($dateIsDisabled),
'fieldTypeCustom' => $dateTypeCustom ?: $dateType, // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
'fieldTracking' => $dateTracking,
'fieldHideLabel' => $dateHideLabel,
'fieldConditionalTags' => Helpers::render(
'conditional-tags',
Helpers::props('conditionalTags', $attributes)
),
'fieldAttrs' => $dateFieldAttrs,
]),
Helpers::props('field', $attributes, $fieldOutput),
[
'additionalFieldClass' => $attributes['additionalFieldClass'] ?? '',
'selectorClass' => $manifest['componentName'] ?? ''
Expand Down
42 changes: 24 additions & 18 deletions src/Blocks/components/input/input.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,27 +163,33 @@ class="' . esc_attr(FormsHelper::getTwBase($twClasses, 'range', "{$componentClas
$input .= $additionalContent;
}

$fieldOutput = [
'fieldContent' => $input,
'fieldId' => $inputId,
'fieldName' => $inputName,
'fieldTwSelectorsData' => $inputTwSelectorsData,
'fieldTypeInternal' => FormsHelper::getStateFieldType($inputType === 'range' ? 'range' : 'input'),
'fieldIsRequired' => $inputIsRequired,
'fieldDisabled' => !empty($inputIsDisabled),
'fieldUseError' => $inputType !== 'hidden',
'fieldTypeCustom' => $inputTypeCustom ?: $inputType, // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
'fieldTracking' => $inputTracking,
'fieldConditionalTags' => Helpers::render(
'conditional-tags',
Helpers::props('conditionalTags', $attributes)
),
'fieldAttrs' => $inputFieldAttrs,
];

// Hide label if needed but separated like this so we can utilize normal fieldHideLabel attribute from field component.
if ($inputHideLabel || $inputType === 'hidden') {
$fieldOutput['fieldHideLabel'] = true;
}

echo Helpers::render(
'field',
array_merge(
Helpers::props('field', $attributes, [
'fieldContent' => $input,
'fieldId' => $inputId,
'fieldName' => $inputName,
'fieldTwSelectorsData' => $inputTwSelectorsData,
'fieldTypeInternal' => FormsHelper::getStateFieldType($inputType === 'range' ? 'range' : 'input'),
'fieldIsRequired' => $inputIsRequired,
'fieldDisabled' => !empty($inputIsDisabled),
'fieldUseError' => $inputType !== 'hidden',
'fieldTypeCustom' => $inputTypeCustom ?: $inputType, // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
'fieldTracking' => $inputTracking,
'fieldHideLabel' => $inputHideLabel || $inputType === 'hidden',
'fieldConditionalTags' => Helpers::render(
'conditional-tags',
Helpers::props('conditionalTags', $attributes)
),
'fieldAttrs' => $inputFieldAttrs,
]),
Helpers::props('field', $attributes, $fieldOutput),
[
'additionalFieldClass' => $attributes['additionalFieldClass'] ?? '',
'selectorClass' => $inputType === 'range' ? 'range' : $manifest['componentName'] ?? '',
Expand Down
40 changes: 23 additions & 17 deletions src/Blocks/components/phone/phone.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,26 +157,32 @@ class="' . esc_attr($phoneClass) . '"
' . $additionalContent . '
';

$fieldOutput = [
'fieldContent' => $phone,
'fieldId' => $phoneId,
'fieldName' => $phoneName,
'fieldTwSelectorsData' => $phoneTwSelectorsData,
'fieldTypeInternal' => FormsHelper::getStateFieldType('phone'),
'fieldIsRequired' => $phoneIsRequired,
'fieldDisabled' => !empty($phoneIsDisabled),
'fieldTypeCustom' => $phoneTypeCustom ?: 'phone', // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
'fieldTracking' => $phoneTracking,
'fieldConditionalTags' => Helpers::render(
'conditional-tags',
Helpers::props('conditionalTags', $attributes)
),
'fieldAttrs' => $phoneFieldAttrs,
];

// Hide label if needed but separated like this so we can utilize normal fieldHideLabel attribute from field component.
if ($phoneHideLabel) {
$fieldOutput['fieldHideLabel'] = true;
}

echo Helpers::render(
'field',
array_merge(
Helpers::props('field', $attributes, [
'fieldContent' => $phone,
'fieldId' => $phoneId,
'fieldName' => $phoneName,
'fieldTwSelectorsData' => $phoneTwSelectorsData,
'fieldTypeInternal' => FormsHelper::getStateFieldType('phone'),
'fieldIsRequired' => $phoneIsRequired,
'fieldDisabled' => !empty($phoneIsDisabled),
'fieldTypeCustom' => $phoneTypeCustom ?: 'phone', // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
'fieldTracking' => $phoneTracking,
'fieldHideLabel' => $phoneHideLabel,
'fieldConditionalTags' => Helpers::render(
'conditional-tags',
Helpers::props('conditionalTags', $attributes)
),
'fieldAttrs' => $phoneFieldAttrs,
]),
Helpers::props('field', $attributes, $fieldOutput),
[
'additionalFieldClass' => $attributes['additionalFieldClass'] ?? '',
'selectorClass' => $manifest['componentName'] ?? ''
Expand Down
36 changes: 18 additions & 18 deletions src/Blocks/components/rating/rating.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
$ratingAmount = Helpers::checkAttr('ratingAmount', $attributes, $manifest);
$ratingSingleSubmit = Helpers::checkAttr('ratingSingleSubmit', $attributes, $manifest);
$ratingTwSelectorsData = Helpers::checkAttr('ratingTwSelectorsData', $attributes, $manifest);
$ratingHideLabel = false;

$ratingId = $ratingName . '-' . Helpers::getUnique();

Expand Down Expand Up @@ -98,26 +97,27 @@ class="' . esc_attr(FormsHelper::getTwPart($twClasses, 'rating', 'star', "{$comp
' . $additionalContent . '
';

$fieldOutput = [
'fieldContent' => $rating,
'fieldId' => $ratingId,
'fieldName' => $ratingName,
'fieldTwSelectorsData' => $ratingTwSelectorsData,
'fieldTypeInternal' => FormsHelper::getStateFieldType('rating'),
'fieldIsRequired' => $ratingIsRequired,
'fieldDisabled' => !empty($ratingIsDisabled),
'fieldTypeCustom' => $ratingTypeCustom ?: 'rating', // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
'fieldTracking' => $ratingTracking,
'fieldConditionalTags' => Helpers::render(
'conditional-tags',
Helpers::props('conditionalTags', $attributes)
),
'fieldAttrs' => array_merge($ratingFieldAttrs, ['role' => 'radiogroup']),
];

echo Helpers::render(
'field',
array_merge(
Helpers::props('field', $attributes, [
'fieldContent' => $rating,
'fieldId' => $ratingId,
'fieldName' => $ratingName,
'fieldTwSelectorsData' => $ratingTwSelectorsData,
'fieldTypeInternal' => FormsHelper::getStateFieldType('rating'),
'fieldIsRequired' => $ratingIsRequired,
'fieldDisabled' => !empty($ratingIsDisabled),
'fieldTypeCustom' => $ratingTypeCustom ?: 'rating', // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
'fieldTracking' => $ratingTracking,
'fieldHideLabel' => $ratingHideLabel,
'fieldConditionalTags' => Helpers::render(
'conditional-tags',
Helpers::props('conditionalTags', $attributes)
),
'fieldAttrs' => array_merge($ratingFieldAttrs, ['role' => 'radiogroup']),
]),
Helpers::props('field', $attributes, $fieldOutput),
[
'additionalFieldClass' => $attributes['additionalFieldClass'] ?? '',
'selectorClass' => $manifest['componentName'] ?? ''
Expand Down
40 changes: 23 additions & 17 deletions src/Blocks/components/textarea/textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,32 @@ class="' . esc_attr($textareaClass) . '"
' . $additionalContent . '
';

$fieldOutput = [
'fieldContent' => $textarea,
'fieldId' => $textareaId,
'fieldName' => $textareaName,
'fieldTwSelectorsData' => $textareaTwSelectorsData,
'fieldTypeInternal' => FormsHelper::getStateFieldType('textarea'),
'fieldIsRequired' => $textareaIsRequired,
'fieldDisabled' => !empty($textareaIsDisabled),
'fieldTypeCustom' => $textareaTypeCustom ?: 'textarea', // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
'fieldTracking' => $textareaTracking,
'fieldConditionalTags' => Helpers::render(
'conditional-tags',
Helpers::props('conditionalTags', $attributes)
),
'fieldAttrs' => $textareaFieldAttrs,
];

// Hide label if needed but separated like this so we can utilize normal fieldHideLabel attribute from field component.
if ($textareaHideLabel) {
$fieldOutput['fieldHideLabel'] = true;
}

echo Helpers::render(
'field',
array_merge(
Helpers::props('field', $attributes, [
'fieldContent' => $textarea,
'fieldId' => $textareaId,
'fieldName' => $textareaName,
'fieldTwSelectorsData' => $textareaTwSelectorsData,
'fieldTypeInternal' => FormsHelper::getStateFieldType('textarea'),
'fieldIsRequired' => $textareaIsRequired,
'fieldDisabled' => !empty($textareaIsDisabled),
'fieldTypeCustom' => $textareaTypeCustom ?: 'textarea', // phpcs:ignore WordPress.PHP.DisallowShortTernary.Found
'fieldTracking' => $textareaTracking,
'fieldHideLabel' => $textareaHideLabel,
'fieldConditionalTags' => Helpers::render(
'conditional-tags',
Helpers::props('conditionalTags', $attributes)
),
'fieldAttrs' => $textareaFieldAttrs,
]),
Helpers::props('field', $attributes, $fieldOutput),
[
'additionalFieldClass' => $attributes['additionalFieldClass'] ?? '',
'selectorClass' => $manifest['componentName'] ?? '',
Expand Down
Loading