summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandrewbelcher2013-05-15 12:23:01 (GMT)
committer New Wine Devf2013-05-15 12:24:12 (GMT)
commit0c5d9b33d5cc23828d305c39a8c11b56ca2692d3 (patch)
tree08e1d371c38c3e0f60dc5fa9a0adf4c90f7eb29b
parent4250851388e9151684d5b2f8c0dbea090b453874 (diff)
by andrewbelcher: Updated field access hook.
-rw-r--r--commerce_booking.module10
-rw-r--r--commerce_booking.pages.inc15
2 files changed, 13 insertions, 12 deletions
diff --git a/commerce_booking.module b/commerce_booking.module
index a8e0c5e..98c11fc 100644
--- a/commerce_booking.module
+++ b/commerce_booking.module
@@ -1126,7 +1126,13 @@ function commerce_booking_get_ticket_from_booking($booking, $party) {
* Implements hook_field_access().
*/
function commerce_booking_field_access($op, $field, $entity_type, $entity, $account) {
- if ($op == 'edit' && $entity_type == 'commerce_booking_ticket' && $field['field_name'] == 'commerce_booking_ticket_status') {
- return FALSE;
+ if ($op == 'edit' && $entity_type == 'commerce_booking_ticket') {
+ switch ($field['field_name']) {
+ case 'commerce_booking_event':
+ case 'commerce_booking_ticket_price':
+ case 'commerce_booking_ticket_status':
+ case 'commerce_booking_ticket_payments':
+ return FALSE;
+ }
}
}
diff --git a/commerce_booking.pages.inc b/commerce_booking.pages.inc
index 80a95e3..84c162f 100644
--- a/commerce_booking.pages.inc
+++ b/commerce_booking.pages.inc
@@ -78,15 +78,11 @@ function commerce_booking_edit_ticket_form($form, &$form_state, $ticket, $order)
// Attach the ticket form.
field_attach_form('commerce_booking_ticket', $ticket, $form, $form_state);
- // Hide form field we don't want people to edit.
- $form['redirect']['#access'] = FALSE;
- $form['commerce_booking_event']['#access'] = FALSE;
- $form['party']['#access'] = FALSE;
- $form['commerce_booking_ticket_price']['#access'] = FALSE;
- $form['field_ticket_holder_name'][LANGUAGE_NONE][0]['#title_display'] = 'invisible';
-
// Add our submit handlers.
- $form['actions'] = array('#type' => 'actions');
+ $form['actions'] = array(
+ '#type' => 'actions',
+ '#weight' => 99,
+ );
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => !empty($ticket->is_new) ? t('Add Ticket') : t('Update ticket'),
@@ -99,7 +95,6 @@ function commerce_booking_edit_ticket_form($form, &$form_state, $ticket, $order)
'#validate' => array(),
'#submit' => array(),
);
-
return $form;
}
@@ -348,4 +343,4 @@ function commerce_booking_move_ticket_form_move(&$form, &$form_state) {
drupal_set_message('This would normally move the ticket to the booking you specified and done something to work out the finances.', 'status');
// Do some stuff to sort out the payments.
-} \ No newline at end of file
+}