|
|
|
@ -1,10 +1,10 @@
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
function fulcrm_collection_permission() {
|
|
|
|
|
return array( 'administer fulcrm collection' => array( 'title' => t('Administer fulcrm collection'),
|
|
|
|
|
return array( 'administer fulcrm collection' => array( 'title' => t('Administer fulcrm collection'),
|
|
|
|
|
'description' => t('Perform main installation/administration tasks for fulcrm collection.'),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fulcrm_collection_menu() {
|
|
|
|
@ -20,12 +20,52 @@ function fulcrm_collection_menu() {
|
|
|
|
|
);
|
|
|
|
|
*/
|
|
|
|
|
$items[ 'admin/config/services/fulcrm/collection' ] = array( 'page callback' => 'fulcrm_collection_admin',
|
|
|
|
|
'file' => 'fulcrm_collection.admin.inc',
|
|
|
|
|
'title' => 'fulcrm Shopping Cart',
|
|
|
|
|
'description' => 'Configure collection for fulcrm.org.',
|
|
|
|
|
'access callback' => 'user_access',
|
|
|
|
|
'access arguments' => array('administer fulcrm collection'),
|
|
|
|
|
);
|
|
|
|
|
'file' => 'fulcrm_collection.admin.inc',
|
|
|
|
|
'title' => 'fulcrm Shopping Cart',
|
|
|
|
|
'description' => 'Configure collection for fulcrm.org.',
|
|
|
|
|
'access callback' => 'user_access',
|
|
|
|
|
'access arguments' => array('administer fulcrm collection'),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return $items;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fulcrm_collection_to_form( $collection_data, $d = array() ) {
|
|
|
|
|
$form = array();
|
|
|
|
|
|
|
|
|
|
foreach ( $collection_data[ '_structure' ] as $set_data ) {
|
|
|
|
|
switch ( $set_data[ 'type' ] ) {
|
|
|
|
|
case 'ddataset':
|
|
|
|
|
$fieldset = array( '#type' => 'fieldset',
|
|
|
|
|
'#title' => $set_data[ 'name' ],
|
|
|
|
|
'#description' => $set_data[ 'description' ],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
foreach ( $set_data[ 'fields' ] as $field_data ) {
|
|
|
|
|
switch ( $field_data[ 'type' ] ) {
|
|
|
|
|
case 'text':
|
|
|
|
|
case 'email':
|
|
|
|
|
case 'tel':
|
|
|
|
|
$fieldset[ $field_data[ 'key' ] ] = array( '#type' => 'textfield',
|
|
|
|
|
'#title' => $field_data[ 'name' ],
|
|
|
|
|
'#description' => $field_data[ 'description' ],
|
|
|
|
|
'#required' => $field_data[ 'required' ],
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
drupal_set_message( t('Cannot handle ":type" collection structure.', array( ':type' => $field_data[ 'type' ] )), 'error' );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$form[] = $fieldset;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
drupal_set_message( t('Cannot handle ":type" collection structure.', array( 'type' => $set_data[ 'type' ] )), 'error' );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $form;
|
|
|
|
|
}
|
|
|
|
|