Commit 38d84b44 authored by TravisCarden's avatar TravisCarden

Issue #1711562 by TravisCarden: Remove link context (w/ alternative).

parent cd876297
......@@ -61,14 +61,6 @@
* - #path: The link path.
* - #options: (optional) An associative array of additional options
* used by the l() function.
* - #context: (optional) The context in which the link may appear. May
* be one of the following:
* - CHECKLISTAPI_LINK_CONTEXT_ANY: (default) The link will always
* appear.
* - CHECKLISTAPI_LINK_CONTEXT_ITEM_CHECKED: The link will appear if
* the item it belongs to has been previously checked.
* - CHECKLISTAPI_LINK_CONTEXT_ITEM_UNCHECKED: The link will appear if
* the item it belongs to has not been previously checked.
* - #weight: (optional) A floating point number used to sort the list
* of items before being output. Lower numbers appear before higher
* numbers.
......
......@@ -8,23 +8,6 @@
* completion times and users.
*/
/**
* Link should always be shown.
*/
define('CHECKLISTAPI_LINK_CONTEXT_ANY', 1);
/**
* Link should only be shown if the item it belongs to has been previously
* checked.
*/
define('CHECKLISTAPI_LINK_CONTEXT_ITEM_CHECKED', 2);
/**
* Link should only be shown if the item it belongs to has not been previously
* checked.
*/
define('CHECKLISTAPI_LINK_CONTEXT_ITEM_UNCHECKED', 3);
/**
* Access callback: Checks the current user's access to a checklist.
*
......
......@@ -112,21 +112,8 @@ function checklistapi_checklist_form($form, &$form_state, $id) {
$links = array();
foreach (element_children($item) as $link_key) {
$link = &$item[$link_key];
$context = (!empty($link['#context'])) ? $link['#context'] : CHECKLISTAPI_LINK_CONTEXT_ANY;
$show_link = FALSE;
if ($context == CHECKLISTAPI_LINK_CONTEXT_ANY) {
$show_link = TRUE;
}
elseif ($saved_item && $context == CHECKLISTAPI_LINK_CONTEXT_ITEM_CHECKED) {
$show_link = TRUE;
}
elseif (!$saved_item && $context == CHECKLISTAPI_LINK_CONTEXT_ITEM_UNCHECKED) {
$show_link = TRUE;
}
if ($show_link) {
$options = (!empty($link['#options']) && is_array($link['#options'])) ? $link['#options'] : array();
$links[] = l($link['#text'], $link['#path'], $options);
}
$options = (!empty($link['#options']) && is_array($link['#options'])) ? $link['#options'] : array();
$links[] = l($link['#text'], $link['#path'], $options);
}
if (count($links)) {
$description .= '<div class="links">' . implode(' | ', $links) . '</div>';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment