To make it easy for modules to integrate with Key, the version of the module for Drupal 7 adds a new form API element called key. It extends the select element, but fills #options with the list of available keys. It also provides additional instructions for using and defining keys in the #description. Here's an example of what that looks like in code:
$form['secret_key'] = array(
'#type' => 'key',
'#title' => t('Secret key'),
);
This functionality should be in the Drupal 8 version also. Key for D7 has additional functionality, such as filtering, that can be added later for D8.
To make it easy for modules to integrate with Key, the version of the module for Drupal 7 adds a new form API element called
key. It extends theselectelement, but fills#optionswith the list of available keys. It also provides additional instructions for using and defining keys in the#description. Here's an example of what that looks like in code:This functionality should be in the Drupal 8 version also. Key for D7 has additional functionality, such as filtering, that can be added later for D8.