diff --git a/core/includes/schema.inc b/core/includes/schema.inc index a5aafe9..a386e62 100644 --- a/core/includes/schema.inc +++ b/core/includes/schema.inc @@ -413,7 +413,12 @@ function drupal_write_record($table, &$record, $primary_keys = array()) { } // Build array of fields to update or insert. - $fields[$field] = $object->$field; + if (empty($info['serialize'])) { + $fields[$field] = $object->$field; + } + else { + $fields[$field] = serialize($object->$field); + } // Type cast to proper datatype, except when the value is NULL and the // column allows this. @@ -520,9 +525,6 @@ function drupal_schema_get_field_value(array $info, $value) { elseif (!is_array($value)) { $value = (string) $value; } - elseif (!empty($info['serialize'])) { - $value = serialize($value); - } } return $value; } diff --git a/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php b/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php index 442ac69..c58e3f1 100644 --- a/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php +++ b/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php @@ -180,8 +180,9 @@ public function submitEditForm(array &$form, array &$form_state) { /** * Helper function to get a module name. * - * @todo - this function is horrible, but core has nothing better. Add a - * a method to the ModuleHandler that handles this nicely. + * This function is horrible, but core has nothing better until we add a + * a method to the ModuleHandler that handles this nicely. + * @see - https://drupal.org/node/2281989 */ protected function getModuleName($module) { // Gather module data. diff --git a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php index d41afea..cecfe13 100644 --- a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php +++ b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php @@ -335,6 +335,10 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ->setDescription(t('A flag to indicate if the link points to a full URL starting with a protocol, like http:// (1 = external, 0 = internal).')) ->setSetting('default_value', 0); + // The form widget doesn't work yet for core fields, so we skip the + // for display and manually create form elements for the boolean fields. + // @see https://drupal.org/node/2226493 + // @see https://drupal.org/node/2150511 $fields['expanded'] = FieldDefinition::create('boolean') ->setLabel(t('Expanded')) ->setDescription(t('Flag for whether this link should be rendered as expanded in menus - expanded links always have their child links displayed, instead of only when the link is in the active trail (1 = expanded, 0 = not expanded).')) @@ -343,13 +347,9 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { 'label' => 'hidden', 'type' => 'boolean', 'weight' => 0, - )) - ->setDisplayOptions('form', array( - 'type' => 'options_onoff', - 'weight' => 0, )); - // We manual create a form element for this, since the form logic is + // We manually create a form element for this, since the form logic is // is inverted to show enabled. $fields['hidden'] = FieldDefinition::create('boolean') ->setLabel(t('Hidden'))