public static function updateExtra($id, $key, $value)
{
// recast key
$key = (string) $key;
// define allowed keys
$allowedKeys = array('label', 'action', 'data', 'hidden', 'sequence');
// key is not allowed
if (!in_array((string) $key, $allowedKeys)) {
throw new Exception('The key ' . $key . ' can\'t be updated.');
}
// key is 'data' and value is not serialized
if ($key === 'data' && is_array($value)) {
// serialize value
$value = serialize($value);
}
$item = array();
$item[(string) $key] = (string) $value;
self::getContainer()->get('database')->update('modules_extras', $item, 'id = ?', array((int) $id));
}