function sms_sendtophone_form_alter in SMS Framework 8
Same name and namespace in other branches
- 5 modules/sms_sendtophone/sms_sendtophone.module \sms_sendtophone_form_alter()
- 6.2 modules/sms_sendtophone/sms_sendtophone.module \sms_sendtophone_form_alter()
- 6 modules/sms_sendtophone/sms_sendtophone.module \sms_sendtophone_form_alter()
- 7 modules/sms_sendtophone/sms_sendtophone.module \sms_sendtophone_form_alter()
- 2.x modules/sms_sendtophone/sms_sendtophone.module \sms_sendtophone_form_alter()
- 2.1.x modules/sms_sendtophone/sms_sendtophone.module \sms_sendtophone_form_alter()
Implements hook_form_alter().
File
- modules/
sms_sendtophone/ sms_sendtophone.module, line 81 - Provides hooks for Send To Phone.
Code
function sms_sendtophone_form_alter(&$form, FormStateInterface &$form_state, $form_id) {
if ($form_id == 'sms_sendtophone_inline_form' || $form_id == 'sms_sendtophone_node_form' || $form_id == 'sms_sendtophone_cck_form') {
if (!\Drupal::currentUser()
->hasPermission('send to any number')) {
// Makes number field plain text.
$form['sms']['number']['#type'] = 'item';
$form['sms']['number']['#value'] = $form['sms']['number']['#default_value'];
}
}
}