I have managed to install Image Link Formatter (image link to a url) which works well with the default display. However, while configuring the same in Drupalgap Display, both image and url are not rendered. Drupalgap's Link module is in place.

This also happens when creating a Views JSON, i.e. the image 'src' is empty.

Does it mean Drupalgap currently does not support Image Link Formatter? Any clues please.

Comments

billycheuk created an issue. See original summary.

billycheuk’s picture

Issue summary: View changes
billycheuk’s picture

Now that I have worked out the other way in which the image field output is now changed to a link, by configuring Views. Views JSON renders a url, which works fine, suggesting not necessarily deploying the Image Link Formatter module.

Still unable to get the link done on the app, having referenced Drupalgap 7 Docs - Views - Displaying Images with links.

tyler.frankenstein’s picture

Category: Support request » Feature request

When using Views JSON it has nothing to do with any other contrib module, as the row_callback function is in charge of displaying the row as you wish. DrupalGap does not having support for the Image Link Formatter module, but I'm open to patches/pull-requests to help.

billycheuk’s picture

Issue summary: View changes
billycheuk’s picture

Hi there

Could the row_callback function calls and displays a viewspage other than a node (nid or uid), given that a viewspage is not a node (so having no nid)?

Sampling the http://tylerfrankenstein.com/code/build-mobile-app-sell-products-with-dr...

function my_module_beer_list_page_row(view, row) {
  try {
    var image = theme('image', { path: row.photo.src });
    var title = '<h2>' + row.title + '</h2>';
    var html = l(image + title, 'node/' + row.nid);
    return html;
  }
  catch (error) { console.log('my_module_beer_list_page_row - ' + error); }
}

In my case, I wanted the listed fields (an image field) of a views (configured in ViewsJSON) to link (when clicked) to other views corresponding to the fields. In the default display (configured in Views), it works quite well while the field can rewrite and output to a url so that it can be linked (when clicked) to the other Views' url.

In other words, how could the row_callback function calls a custom module (which is actually a viewspage)?

tyler.frankenstein’s picture

Category: Feature request » Support request
Status: Active » Postponed (maintainer needs more info)

If I understand correctly, in your row_callback, I think you could do something like this:

function my_row_callback(view, row) {
  var content = {};
  content.some_other_view = {
    theme: 'view',
    path: 'some-other-view',
    /* ... */
  };
  return drupalgap_render(content);
}
billycheuk’s picture

Hi Tyler

Thank you for your reply but so sorry to bother you again as I still don't know how to merge the codes.

What I wish is:

View A ->

image field 1 -> View B
image field 2 -> View C
image field 3 -> View D
image field 4 -> View E

In Views JSON of View A, I now rewrite and output a variable (exactly names of View B, View C, View D, View E) intended as path name to link (onclick) to the corresponding views.

billycheuk’s picture

I think I now get it done:


function my_page_row(view, row) {
  try {
   var image = theme('image', { path: row.photo.src });
   var path = row.link
   var html = l(image, path);
   return html;
  }

where link is the exact name of the the other view as a path variable.

Thanks Tyler for reminding me of the path variable.

tyler.frankenstein’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

No problem, thank you for reporting back.