function feed_import_generate_func_item in Feed Import 7.3
Generates function fields.
1 call to feed_import_generate_func_item()
- feed_import_dynamic_func_form in ./
feed_import.module - Dynamic functions form.
File
- ./
feed_import.module, line 2695 - User interface, cron functions for feed_import module
Code
function feed_import_generate_func_item($pos, array $values, $collapsed = FALSE) {
if (!preg_match('/^_[a-z0-9_]+$/i', $values['name'])) {
return array();
}
$container = 'container_' . $pos;
$item[$container] = array(
'#type' => 'fieldset',
'#title' => t('Function @name', array(
'@name' => $values['name'],
)),
'#collapsible' => TRUE,
'#collapsed' => $collapsed,
'#attributes' => array(
'id' => 'item_container_' . $pos,
),
);
$container =& $item[$container];
$container['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#description' => t('Name must start with underscore and can contain only alphanumeric chars or underscores.'),
'#default_value' => $values['name'],
'#attributes' => array(
'id' => 'func_name_' . $pos,
),
);
$container['args'] = array(
'#type' => 'textfield',
'#title' => t('Parameters'),
'#description' => t('Use variable names separated by comma, like: $a, $b'),
'#default_value' => $values['args'],
);
$container['body'] = array(
'#type' => 'textarea',
'#rows' => 5,
'#title' => t('Body'),
'#description' => t('Write here only function body. Do not forget to return a value.'),
'#default_value' => $values['body'],
);
$container['remove_container_' . $pos] = array(
'#type' => 'button',
'#name' => 'remove_container_' . $pos,
'#value' => t('Remove function'),
'#ajax' => array(
'event' => 'click',
'wrapper' => 'item_container_' . $pos,
'method' => 'replace',
'callback' => 'feed_import_ajax_remove_item',
),
);
return $item;
}