Drupal 7: Programatically Creating CTools Buttons [ctools_ajax_text_button()]

The CTools plugin will not open with normal buttons and links. To open a page or form via CTools we need to use ctools buttons(ctools_ajax_text_button()). This ctools_ajax_text_button will create a link that contains the base class that help to pop up the pages.

Syntax:

ctools_ajax_text_button(TEXT, DESTINATION, ALT_TEXT, CLASSES, TYPE);

TEXT : Text of the CTools button.
DESTINATION : Destination path of the Link button
ALT_TEXT : Alternative text for the button link.
CLASSES : Additional classes for the Link
TYPE : Mentioning Link action (Close current Modal or Open new modal).

Example:

ctools_ajax_text_button('Modal Example Form', 'admin/test/sample/nojs/form', 'Sample Form'); // Modal popup link.
ctools_ajax_text_button('Close', '', 'Close the Window', '', 'ctools-close-modal'); // Modal popup Close link.

Similar Post:
Drupal 7: Programatically Creating CTools Buttons [ctools_ajax_text_button()]
Drupal 7: CTools close button with example
Drupal 7: CTools Image button with Example [ctools_modal_image_button()]

Category: