Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Booleans are nicer to read than strings or integers.
However, this crashes Flag:
function foo_flag_default_flags() {
$flags = array();
$flags['test_flag'] = array (
'entity_type' => 'node',
'title' => 'Test flag',
'global' => FALSE,
// ...
with this error:
> General error: 1366 Incorrect integer value: '' for column 'global' at row 1: INSERT INTO {flag} (entity_type, name, title, global, options) VALUES
It would seem that the FALSE gets cast to an empty string rather than a 0.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2059959.flag_.global-boolean.patch | 729 bytes | joachim |
Comments
Comment #1
joachim CreditAttribution: joachim commentedI had a look at other exportables with boolean properties to see how they handle it, as casting the value to an (int) on save seemed messy.
But no, this is how node types do it:
So I guess that's how we'll do it too.
Comment #2
joachim CreditAttribution: joachim commentedComment #3
joachim CreditAttribution: joachim commentedTests pass. Committing.