Clipboard.js
Categories
Component ID
2597660
Component name
Clipboard.js
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Downloads
1863
Component created
Component changed
Component body
Overview
The Clipboard.js module provides integration with the clipboard.js library, which allows non-flash based clipboard copying using the HTML5 Clipboard API.
Requirements
Usage
The Clipboard.js can be added to any text field by visiting the manage display
page for the entity and and choosing Clipboard.js as the field formatter.
Custom text fields can also use clipboard.js using the form api or in a render
array. Just use the theme function to build the render array:
function example_form($form, $form_state) {
$form = array();
// Load clipboard.js library.
libraries_load('clipboard');
// Build the form or render element using the theme function.
$form['copy_this'] = theme('clipboardjs', array(
'text' => t('This is the text to be copied...'),
'alert_style' => 'tooltip',
'alert_text' => 'Copy was successful!',
'button_label' => 'Click to Copy',
));
return $form;
}
