Course Navigation Items

Jump to solution
a1222679
Community Contributor

With CD1 I used to be able to get a list of all the items in the navigation bar for a course.

In the CD2 documentation it says that I should be able to find this information in the Courses table...

  • tab_configuration (Annotated[bounded_str, JsonStringToJsonObject(), SpecialConversion()] | None) – A JSON serialized list detailing the order and visibility status of tabs in the left-hand navigation for the course.

However, I can't see tab_configuration in there.  Does anyone know how I can get this information?

Labels (2)
0 Likes
1 Solution
sgergely
Instructure
Instructure

Hello everyone,

I have seen the struggle and questions around this and I went after this a bit. I see and understand that the documentation was not clear enough on the tab_configuration column, I will update the relevant documentation with the info that I'm sharing here as well.

So when you see this JSON from CD2 courses table tab_configuration column: 

[
  {
    "id": 0
  },
  {
    "id": "context_external_tool_8923"
  },
  {
    "id": 14,
    "hidden": true
  },
  {
    "id": 5,
    "hidden": true
  },
  {
    "id": 6,
    "hidden": true
  },
  {
    "id": 1,
    "hidden": true
  },
  {
    "id": 3,
    "hidden": true
  },
  {
    "id": 8,
    "hidden": true
  },
  {
    "id": 2,
    "hidden": true
  },
  {
    "id": 11,
    "hidden": true
  },
  {
    "id": 15,
    "hidden": true
  },
  {
    "id": 18,
    "hidden": true
  },
  {
    "id": 4,
    "hidden": true
  },
  {
    "id": 10,
    "hidden": true
  },
  {
    "id": 12,
    "hidden": true
  },
  {
    "id": 17,
    "hidden": true
  }
]

And you might ask what are these numbers. (This is from my test account so this is why it is weird) 
The answer is here: https://github.com/instructure/canvas-lms/blob/master/app/models/course.rb#L3147
So "id":3 is Assignments from this list.
"id":"context_external_tool_8923" is Studio LTI app. You can look up the id in the context_external_tools table "id" column and get the friendly name from the "name" column.
I hope "hidden": true/false speaks for itself 🙂

I hope this helps understanding tab_configuration field!

Please note that there is significant logic around these constant values (as you can see from the code) to decide if tabs are actually visible to the current user.

cc @stimme@Jeff_F 

View solution in original post