We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
以默认主题为例
$testBlock = new \Typecho\Widget\Helper\Form\Element\Checkbox( 'testBlock', [ 'test' => _t('测试'), ], ['test'], _t('测试复选框') ); $form->addInput($testBlock->multiMode());
期望结果测试被勾上,实际勾选无效
测试
typecho/var/Widget/Themes/Config.php
Line 74 in 206880b
上面这行代码中,从 options 中拿值,但是因为测试复选框新加入的,options 中并没有对应的值,导致给了一个空的值给测试复选框 $this->getInput('testBlock') 。
options
测试复选框
测试复选框 $this->getInput('testBlock')
当主题选项保存的时候,is_array 中的数据是从 $this->getInput('testBlock') 拿 value,但前面程序已经设置为空值,所以在收集提交选项数据时候,以下代码判断不通过,返回 null ,最终导致保存勾选无效
$this->getInput('testBlock')
typecho/var/Typecho/Widget/Helper/Form.php
Line 205 in 206880b
上面是我排查的原因,我认为 Config.php#L74 应该增加判断是有内容,稍后我将提个 PR 。
Config.php#L74
The text was updated successfully, but these errors were encountered:
@joyqi
Sorry, something went wrong.
$testBlock = new \Typecho\Widget\Helper\Form\Element\Checkbox( 'testBlock', [ 'test' => _t('测试'), ], ['test'], _t('测试复选框') );
$form->addInput($testBlock->multiMode());
No branches or pull requests
1. 该问题的重现步骤是什么?
以默认主题为例
2. 你期待的结果是什么?实际看到的又是什么?
期望结果
测试
被勾上,实际勾选无效3. 问题出现的环境
4. 问题出现原因
typecho/var/Widget/Themes/Config.php
Line 74 in 206880b
上面这行代码中,从
options
中拿值,但是因为测试复选框
新加入的,options
中并没有对应的值,导致给了一个空的值给测试复选框 $this->getInput('testBlock')
。当主题选项保存的时候,is_array 中的数据是从
$this->getInput('testBlock')
拿 value,但前面程序已经设置为空值,所以在收集提交选项数据时候,以下代码判断不通过,返回 null ,最终导致保存勾选无效typecho/var/Typecho/Widget/Helper/Form.php
Line 205 in 206880b
上面是我排查的原因,我认为
Config.php#L74
应该增加判断是有内容,稍后我将提个 PR 。The text was updated successfully, but these errors were encountered: