namespace WPForms\Admin\Builder;
* Form Builder Keyboard Shortcuts modal content.
// Terminate initialization if not in builder.
if ( ! wpforms_is_admin_page( 'builder' ) ) {
private function hooks() {
add_filter( 'wpforms_builder_strings', [ $this, 'builder_strings' ], 10, 2 );
add_action( 'wpforms_admin_page', [ $this, 'output' ], 30 );
private function get_list() {
'ctrl s' => __( 'Save Form', 'wpforms-lite' ),
'ctrl p' => __( 'Preview Form', 'wpforms-lite' ),
'ctrl b' => __( 'Embed Form', 'wpforms-lite' ),
'ctrl f' => __( 'Search Fields', 'wpforms-lite' ),
'ctrl h' => __( 'Open Help', 'wpforms-lite' ),
'ctrl t' => __( 'Toggle Sidebar', 'wpforms-lite' ), // It is 'alt s' on Windows/Linux, dynamically changed in the modal in admin-builder.js openKeyboardShortcutsModal().
'ctrl e' => __( 'View Entries', 'wpforms-lite' ),
'ctrl q' => __( 'Close Builder', 'wpforms-lite' ),
* Add Form builder strings.
* @param array $strings Form Builder strings.
* @param \WP_Post|bool $form Form object.
public function builder_strings( $strings, $form ) {
$strings['shortcuts_modal_title'] = esc_html__( 'Keyboard Shortcuts', 'wpforms-lite' );
$strings['shortcuts_modal_msg'] = esc_html__( 'Handy shortcuts for common actions in the builder.', 'wpforms-lite' );
* Generate and output shortcuts modal content as the wp.template.
public function output() {
<script type="text/html" id="tmpl-wpforms-builder-keyboard-shortcuts">
<div class="wpforms-columns wpforms-columns-2">';
foreach ( $this->get_list() as $list ) {
echo "<ul class='wpforms-column'>";
foreach ( $list as $key => $label ) {
$key = explode( ' ', $key );
<span class="shortcut-key shortcut-key-%2$s-%3$s">