Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm having a problem trying to add some class to the node so i can change it's content.
For example i have the main menu, the i click into the page with the list of different nodes, but when i click on the node, the only parent class is node + number. I would like to assign a class to the node. Tried alter but i got blank page, tried postprocess but i cannot make it work.
This is my complete code:
/**
* Implements hook_menu().
*/
function auditorias_menu() {
var items = {};
items['auditorias_en_video'] = {
title: 'Auditorías en video',
page_callback: 'auditorias_auditorias_en_video_page'
};
return items;
}
/**
* The page callback to display the view.
*/
function auditorias_auditorias_en_video_page() {
try {
var content = {};
content['auditorias_en_video'] = {
theme: 'view',
pager_pos: 'bottom',
format: 'ul',
path: 'drupalgap/auditorias-en-video', /* the path to the view in Drupal */
row_callback: 'auditorias_auditorias_en_video_row',
empty_callback: 'auditorias_auditorias_en_video_empty',
attributes: {
id: 'auditorias_en_video_view'
}
};
return content;
}
catch (error) { console.log('auditorias_auditorias_en_video_page - ' + error); }
}
function auditorias_auditorias_en_video_row(view, row) {
try {
return l(row.title, 'node/' + row.nid);
}
catch (error) { console.log('auditorias_auditorias_en_video_row - ' + error); }
}
/**
*
*/
function auditorias_auditorias_en_video_empty(view) {
try {
return 'No se encontraron Artículos de auditorias_en_video.';
}
catch (error) { console.log('auditorias_auditorias_en_video_empty - ' + error); }
}
function auditorias_services_postprocess(options, result) {
try {
$("p").has("iframe").prependTo(".body");
}
catch (error) { console.log('auditorias_services_postprocess - ' + error); }
}
Thanks in advance!
Comments
Comment #2
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedWrapping issue description in code tags...
Comment #3
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedThis might be helpful: http://docs.drupalgap.org/7/Pages/Page_Attributes - it allows you to add classes to the page container
I personally would not use the built in DrupalGap node add/edit/view pages anymore, instead use these docs to build your own custom add/edit/view pages, which gives you complete control:
http://docs.drupalgap.org/7/Entities/Editing_Entities
http://docs.drupalgap.org/7/Forms/Creating_a_Custom_Form
http://docs.drupalgap.org/7/Entities/Rendering_Entities
In hindsight it was silly for DrupalGap to try and replicate the Drupal UI inside of mobile applications, when every mobile app should be unique. Although the above approach requires custom coding, it's well worth the effort and you'll find you have much finer control over what you're trying to accomplish. Good luck and happy coding.