0

I have installed jQuery UI Filter and jQuery plugins to get text with accordion effect. It works perfectly when the content is inserted in a node, with a special tags language. However, when I try to get the text rendered in a block with hook_block_view_VIEW_NAME_alter, as I am just the $data["content"]["#markup"] property, it is not working and it is displaying the special tags without rendering them: [accordion], etc.

Must I get the effect by using clean jQuery instead of the modules? Is there a way of saying that I want to apply the "Full HTML" properties to the content-markup text of the block?

0

I was able to make it work with the modules installed ( jQuery plugins , jQuery UI filter and jQuery UI filter accordion). The trick was to include the following Javascript in the template yourtheme_preprocess_page() and in the HTML use the div with id="accordion" of the official example ( https://jqueryui.com/accordion/ ).

drupal_add_js(' jQuery(function() {
var icons = {
  header: "ui-icon-circle-arrow-e",
  activeHeader: "ui-icon-circle-arrow-s"
};
jQuery( "#accordion" ).accordion({
  icons: icons
});
jQuery( "#toggle" ).button().click(function() {
  if ( jQuery( "#accordion" ).accordion( "option", "icons" ) ) {
    jQuery( "#accordion" ).accordion( "option", "icons", null );
  } else {
    jQuery( "#accordion" ).accordion( "option", "icons", icons );
  }
});
  });', array('type' => 'inline'));
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.