voice_title-1.0.0/voice_title.module

voice_title.module
<?php

/**
 * @file
 */

use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_form_FORM_ID_alter() for node_form.
 */
function voice_title_form_node_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
  // Add a custom button to trigger voice input.
  $form['actions']['voice_title_button'] = [
    '#type' => 'button',
    '#value' => t('Title by Voice'),
    '#id' => 'voice-title-btn',
    '#attributes' => [
      'class' => ['voice-title-btn'],
    ],
  ];

  $form['#attached']['library'][] = 'voice_title/voice_title_js';
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc