Skip to main content
Level 4
October 16, 2015
Question

How to load data from Granite.author.page.info from clientlib

  • October 16, 2015
  • 1 reply
  • 1020 views

On my author, I have a js clientlib (loading up in the cq.authoring.editor.hook category) where I'm trying to read data from Granite.author.page.info:

(function(window, document, Granite, $) { "use strict"; info = Granite.author.page.info; ...

Unfortunately, this data seems to load asynchronously, so I get an undefined error in my javascript. I know I can request the data from the pageinfo.json endpoint, but I'm wondering if there's built in functionality to pull that data, or wait for a promise.

I also tried Granite.author.page.fetchPageInfo() and then using the done() method, however, I get the same undefined error.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

BenSt10Author
Level 4
October 16, 2015

Strike that... I was tryting to assign the fetchPageInfo() method to my info variable, but the correct implementation is this:

 

Granite.author.page.fetchPageInfo().done(function (info) { ...