Skip to content
New issue

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

Add is_numerical check - See #6995 #7010

Merged
merged 6 commits into from
Sep 19, 2017
Merged

Add is_numerical check - See #6995 #7010

merged 6 commits into from
Sep 19, 2017

Conversation

xiaohutai
Copy link
Contributor

@xiaohutai xiaohutai commented Sep 19, 2017

See #6995 .

The numerical check is still required because you can define taxonomies as:

- foo
- bar
- baz

and

foo: Foo
bar: Bar
baz: Baz

The code before this pull, would actually save it as:

0: foo
1: bar
2: baz

src/Config.php Outdated
@@ -356,6 +356,9 @@ protected function parseTaxonomy()
if (!empty($taxonomy['options']) && is_array($taxonomy['options'])) {
$options = [];
foreach ($taxonomy['options'] as $optionKey => $optionValue) {
if (is_numeric($optionKey)) {
$optionKey = $optionValue;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh wait, that will need to go below the line, um, below this … as the value should be slugged.

Copy link
Contributor

@GwendolenLynch GwendolenLynch Sep 19, 2017

Choose a reason for hiding this comment

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

New tests say you were right 😉

@xiaohutai
Copy link
Contributor Author

In the table, you save a slug and a value. The value should not be slugified, right?
The slug should be either the (slugified) slug or the slugified value (if no key is set explicitly)

@GwendolenLynch
Copy link
Contributor

In the table, you save a slug and a value. The value should not be slugified, right?

Yeah, I was getting lost in the sea of logic in that method … hence the tests 😉

@GwendolenLynch GwendolenLynch merged commit e03a6ef into bolt:3.4 Sep 19, 2017
GwendolenLynch added a commit that referenced this pull request Sep 19, 2017
Add `is_numerical` check for taxonomy options
@GwendolenLynch GwendolenLynch added this to the Bolt 3.4 - Feature release milestone Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants