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.
72 lines
3.6 KiB
Plaintext
72 lines
3.6 KiB
Plaintext
<?php
|
|
|
|
function fulcrm_collection_permission() {
|
|
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() {
|
|
/*
|
|
$items[ 'admin/config/services/fulcrm' ] = array( 'page callback' => 'system_admin_menu_block_page',
|
|
'file' => 'system.admin.inc',
|
|
'file path' => drupal_get_path('module', 'system'),
|
|
'title' => 'fulcrm',
|
|
'description' => 'Configuration integration with fulcrm.org.',
|
|
'position' => 'right',
|
|
'access callback' => 'user_access',
|
|
'access arguments' => array('access administration pages'),
|
|
);
|
|
*/
|
|
$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'),
|
|
);
|
|
|
|
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;
|
|
}
|