provide the title of the page in the resulting JSON

This commit is contained in:
Michael Becker 2024-12-21 00:22:35 -05:00
parent 8cdc7730cf
commit 1cdfb21bdd

View File

@ -75,6 +75,15 @@ public class ElementCommand : InstanceCommand
obj2.Add("widget", JsonValue.Create("root")); obj2.Add("widget", JsonValue.Create("root"));
obj2.Add("body", widget.ToJSONObject(ctx)); obj2.Add("body", widget.ToJSONObject(ctx));
JsonObject objTitle = new JsonObject();
string label = oms.GetAttributeValue<string>(widget.ParentInstance, oms.GetInstance(KnownAttributeGuids.Text.Label));
if (label == null)
{
label = oms.GetInstanceText(widget.ParentInstance);
}
objTitle.Add("label", label);
obj2.Add("title", objTitle);
JsonObject obj = new JsonObject(); JsonObject obj = new JsonObject();
obj.Add("result", "success"); obj.Add("result", "success");
obj.Add("value", obj2); obj.Add("value", obj2);