Skip to content

Conversation

@CySSoO
Copy link
Contributor

@CySSoO CySSoO commented Sep 13, 2025

Summary

  • avoid nested repeaters in guided selector configuration
  • generate URL-friendly keys without link_rewrite modifier
  • remove unused guided selector action hook
  • show contact form fallback when no answer links to a URL
  • add progress indicator, back and restart navigation for guided selector
  • display contact form fallback when the questionnaire has no steps or answers
  • hide progress bar and skip division by zero when no steps exist

Testing

  • composer validate --quiet
  • php -l everblock.php
  • php -l models/EverblockPrettyBlocks.php
  • vendor/bin/phpstan analyse --no-progress --level 0 (fails: No such file or directory)

https://chatgpt.com/codex/tasks/task_e_68c4454c24c48322bb039dd95860b5bc

@CySSoO CySSoO merged commit 5116907 into master Sep 13, 2025
0 of 6 checks passed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines +4208 to +4233
public function hookBeforeRenderingEverblockGuidedSelector($params)
{
$states = $params['block']['states'] ?? [];

foreach ($states as &$state) {
$question = isset($state['question']) ? trim($state['question']) : '';
$state['question'] = $question;
$state['key'] = Tools::link_rewrite($question);

$answers = [];
$lines = preg_split("/(\r\n|\r|\n)/", $state['answers'] ?? '');
foreach ($lines as $line) {
$parts = explode('|', $line);
$text = trim($parts[0] ?? '');
if ($text === '') {
continue;
}
$link = trim($parts[1] ?? '');
$answers[] = [
'text' => $text,
'link' => $link,
'value' => Tools::link_rewrite($text),
];
}
$state['answers'] = $answers;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P0] Handle legacy guided selector answer arrays

The new pre-render hook parses answers as a newline-delimited string, but existing guided selector blocks saved before this refactor still store answers as repeater arrays. When such a block is rendered, $state['answers'] is an array and the call to preg_split() raises a fatal TypeError (“Argument #2 must be of type string, array given”), bringing down the page. Consider supporting both array and string formats or migrating stored data during upgrade so upgraded shops do not crash.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants