Tripal
|
Contains API functions to set titles and paths for all chado nodes
There are three steps to implement the ability to set custom titles for the node type: 1) Add the 'chado_node_api' elements to the hook_node_info function(). These values define the name of the base table and how to refer to nodes in singular and plural. There are additional paramaters that can be added to the 'chado_node_api' for syncing nodes (see documentation for the chado_node_sync_form() function for additional options.
2) Add the "Set Page Titles" Form to the admin settings form
3) Use chado_get_node_title($node) where ever you want the title for your node. This should be done in hook_load(), hook_node_insert(), hook_node_update(). The reason you set the title in the node_action hooks, which act on all nodes, is because at that point you have the generic loaded node.
Optionally define a default for a specific content type by implementing a function of the name [content type]_chado_node_default_title_format() that returns a string describing the default format.
If you don't implement this then a default format based on the unique constraint for the base table of the content type will be generated.
There are three steps to implement the ability to set custom URLs for the node type: 1) Add the 'chado_node_api' elements to the hook_node_info function(). These values define the name of the base table and how to refer to nodes in singular and plural. There are additional paramaters that can be added to the 'chado_node_api' for syncing nodes (see documentation for the chado_node_sync_form() function for additional options.
2) Add the "Set Page URLs" Form to the admin settings form
3) Use chado_set_node_url($node) where ever you want to reset the URL of the node. This should be done in hook_node_insert(), hook_node_update(). The reason you set the title in the node_action hooks, which act on all nodes, is because at that point you have the generic loaded node.
Optionally define a default for a specific content type by implementing a function of the name [content type]_chado_node_default_url_format() that returns a string describing the default format.
If you don't implement this then a default format based on the unique constraint for the base table of the content type will be generated.
chado_add_admin_form_set_title_form_submit | ( | $form, | |
$form_state | |||
) |
Implements hook_form_submit(). SUBMIT: Actually add the format specified by chado_add_admin_form_set_title()
chado_add_admin_form_set_title_form_validate | ( | $form, | |
$form_state | |||
) |
Implements hook_form_validate(). VALIDATE: validate the format.
chado_add_admin_form_set_url_form_submit | ( | $form, | |
$form_state | |||
) |
Implements hook_form_submit(). SUBMIT: Actually add the format specified by chado_add_admin_form_set_title()
chado_add_admin_form_set_url_form_validate | ( | $form, | |
$form_state | |||
) |
Implements hook_form_validate(). VALIDATE: validate the format.
chado_node_format_tokens | ( | $tokens | ) |
Format a set of tokens for consistent display
$tokens | An array of tokens from chado_node_generate_tokens() |
chado_node_get_location_from_token | ( | $token | ) |
Returns the "location" as specified in the token information based on the token.
chado_node_get_readable_format | ( | $token | ) |
Generate a Readable but not necessarily unique format based on a given primary key token.
For example, given the token [feature.type_id>cvterm.cvterm_id] you don't want the actual id indexed but instead would want the term name, [feature.type_id>cvterm.name]
chado_sort_tokens_by_location | ( | $tokenA, | |
$tokenB | |||
) |
This sorts tokens first by depth (ie: stock.* is before stock.*>subtable.*) and then alphabetically within a level (ie: stock.name comes before stock.type_id)
This is a usort callback and shouldn't be called directly. To use: usort($tokens, 'chado_sort_tokens_by_location');
tripal_sort_key_length_asc | ( | $a, | |
$b | |||
) |
Sorts an associative array by key length where sorter keys will be first
This is a uksort callback and shouldn't be called directly. To use; uksort($arr, 'tripal_sort_key_length_asc');