Created
January 25, 2017 11:05
-
-
Save martsie/9b0ad580db32ec4915c6d0031600ecea to your computer and use it in GitHub Desktop.
Trigger page callback for AJAX commands article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function MY_CUSTOM_MODULE_trigger_page() { | |
// Load in Drupal core AJAX library. | |
drupal_add_library('system', 'drupal.ajax'); | |
// Load in our custom JavaScript. | |
drupal_add_js(drupal_get_path('module', 'MY_CUSTOM_MODULE') . '/MY_CUSTOM_MODULE.js'); | |
// Present the user with a link with the id 'my-special-link'. | |
return l('Run my AJAX commands', 'my-custom-path/nojs', array( | |
'attributes' => array( | |
'id' => 'my-special-link' | |
) | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment