Created
March 18, 2016 17:36
-
-
Save bangpound/edc76d0358371ee6e1da to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Form alter that just disables the preview button. | |
*/ | |
function caxy_form_contact_message_feedback_form_alter(&$form, FormStateInterface $form_state) { | |
$form['actions']['preview']['#access'] = FALSE; | |
} | |
/** | |
* Form alter that disables the preview button and replaces a value of a form element. | |
*/ | |
function caxy_form_contact_message_job_posting_form_form_alter(&$form, FormStateInterface $form_state) { | |
if (Drupal::request()->attributes->has('node')) { | |
/** @var \Drupal\node\Entity\Node $node */ | |
$node = Drupal::request()->attributes->get('node'); | |
$form['subject'] = array( | |
'#type' => 'value', | |
'#value' => $node->getTitle(), | |
); | |
} | |
$form['actions']['preview']['#access'] = FALSE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment