You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fulcrm_webhook/fulcrm_webhook.admin.inc

53 lines
2.6 KiB
PHP

<?php
function fulcrm_webhook_admin_form_submit( $form, &$form_state ) {
}
function fulcrm_webhook_admin_form( $form, &$form_state ) {
global $is_https;
$form[ 'title' ] = array( '#type' => 'item',
'#title' => 'fulcrm webhook Settings',
'#description' => '',
);
if ( $is_https ) {
$form[ 'webhook_url' ] = array( '#type' => 'textfield',
'#disabled' => TRUE,
'#title' => 'Webhook URL (to be registered with fulcrm)',
'#default_value' => url( 'services/fulcrm/webhook/' . variable_get( 'fulcrm_webhook_url' ), array( 'absolute' => TRUE, 'https' => TRUE ) ),
'#size' => 150,
'#max_length' => 200,
'#required' => FALSE,
);
$form[ 'actions' ] = array( '#type' => 'actions' );
$form[ 'actions' ][ 'save' ] = array( '#type' => 'submit',
'#value' => t('Save'),
'#submit' => array( 'fulcrm_webhook_admin_form_submit' ),
);
} else {
$form[ 'no_https' ] = array( '#type' => 'fieldset',
'#title' => 'HTTPS Missing!',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'detail' => array( '#type' => 'item',
'#title' => '',
'#markup' => ( '<p>You need to enable SSL on this Drupal site to continue.</p>' .
'<p>fulcrm will only send data to HTTPS webhooks.</p>' ),
),
);
$form[ 'actions' ] = array( '#type' => 'actions' );
$form[ 'actions' ][ 'save' ] = array( '#type' => 'link',
'#title' => t('Reload with SSL'),
'#href' => str_replace( 'http://', 'https://', url( 'admin/config/services/fulcrm/webhook', array( 'absolute' => TRUE ) ) ),
);
}
return $form;
}
function fulcrm_webhook_admin() {
return drupal_get_form( 'fulcrm_webhook_admin_form' );
}