// Sort the route parameters so that the query string will be the same.
asort($fields['route_parameters'
]);
// Since this will be urlencoded, it's safe to store and match against a
// text field.
$fields['route_param_key'
] =
$fields['route_parameters'
] ? UrlHelper::
buildQuery($fields['route_parameters'
]) : '';
foreach ($this->
serializedFields() as $name) { if (isset($fields[$name])) { $fields[$name] =
serialize($fields[$name]);
} } $this->
setParents($fields,
$parent,
$original);
// Need to check both parent and menu_name, since parent can be empty in any
// menu.
if ($original && ($link['parent'
] !=
$original['parent'
] ||
$link['menu_name'
] !=
$original['menu_name'
])) { $this->
moveChildren($fields,
$original);
} // We needed the mlid above, but not in the update query.
unset($fields['mlid'
]);
// Cast Booleans to int, if needed.
$fields['enabled'
] =
(int) $fields['enabled'
];