You are here

README.txt in Ajaxify Drupal with JQuery Ajax 8

Same filename and directory in other branches
  1. 6 README.txt
  2. 7 README.txt
-- How to use Ajax links API --

- METHOD 1 -

In module config page, specify the Classes/Ids to trigger Ajax. 

Target DIV will be default CSS selector defined, you can change default CSS 
Selector from module config page.

Example : 
<div class="tabs"><a href="node/add/page">Add page</a></div> . You can ajaxify 
this link by adding .tabs a in module config page.


- METHOD 2 -

in your module ,

<?php
$service = \Drupal::service('ajax_links_api.ajax_link');
$link = $service->lAjax($title, $path, $target, $link_options);
?>

* $title: Title.
* $path : Drupal path.
* $target (optional): ID/CLASS of DIV to be replaced. This will override 
  Default CSS Selector defined in module config page.
* $link_options (optional): Provide attributes to the link in an array format.


Example :
<?php
$service = \Drupal::service('ajax_links_api.ajax_link');
$link = $service->lAjax("add page", "/node/add/page", "#content", array('#attributes' => 'class' => array('ajax-links-api')));
?>


- METHOD 3 -

Add class="ajax-link" to any link. Target div will be default CSS 
selector defined. You can change default CSS Selector from module config page 
or override target by specifying rel="".

Example : 
<a class="ajax-link" href="/node/add/page" rel="#content">Add page</a>


-- Developer Notes --

Override tpl : 
Developer can add/remove any variables by copying html--ajax.html.twig and 
page--ajax.html.twig to their theme. All variables available to
html--ajax.html.twig or page--ajax.html.twig can be used. 
In case you want to override page--ajax.html.twig, for eg: for path /user/, you 
can create page--user--ajax.html.twig.
Same applicable for html--user--ajax.html.twig.

Upgrade : 
You can upgrade/degrade module anytime by simply overwriting whole folder.

-- DEMO --

Goto YOUR_SITE/ajax-links-api/test

File

README.txt
View source
  1. -- How to use Ajax links API --
  2. - METHOD 1 -
  3. In module config page, specify the Classes/Ids to trigger Ajax.
  4. Target DIV will be default CSS selector defined, you can change default CSS
  5. Selector from module config page.
  6. Example :
  7. . You can ajaxify
  8. this link by adding .tabs a in module config page.
  9. - METHOD 2 -
  10. in your module ,
  11. $service = \Drupal::service('ajax_links_api.ajax_link');
  12. $link = $service->lAjax($title, $path, $target, $link_options);
  13. ?>
  14. * $title: Title.
  15. * $path : Drupal path.
  16. * $target (optional): ID/CLASS of DIV to be replaced. This will override
  17. Default CSS Selector defined in module config page.
  18. * $link_options (optional): Provide attributes to the link in an array format.
  19. Example :
  20. $service = \Drupal::service('ajax_links_api.ajax_link');
  21. $link = $service->lAjax("add page", "/node/add/page", "#content", array('#attributes' => 'class' => array('ajax-links-api')));
  22. ?>
  23. - METHOD 3 -
  24. Add class="ajax-link" to any link. Target div will be default CSS
  25. selector defined. You can change default CSS Selector from module config page
  26. or override target by specifying rel="".
  27. Example :
  28. Add page
  29. -- Developer Notes --
  30. Override tpl :
  31. Developer can add/remove any variables by copying html--ajax.html.twig and
  32. page--ajax.html.twig to their theme. All variables available to
  33. html--ajax.html.twig or page--ajax.html.twig can be used.
  34. In case you want to override page--ajax.html.twig, for eg: for path /user/, you
  35. can create page--user--ajax.html.twig.
  36. Same applicable for html--user--ajax.html.twig.
  37. Upgrade :
  38. You can upgrade/degrade module anytime by simply overwriting whole folder.
  39. -- DEMO --
  40. Goto YOUR_SITE/ajax-links-api/test