+// "Translates" 'visible' and 'locked' to a CSS class
+function translateMenuVisibleLocked ($content, $prefix = '') {
+ // Translate 'visible' and keep an eye on the prefix
+ switch ($content['visible']) {
+ // Should be visible
+ case 'Y': $content['visible_css'] = $prefix . 'menu_visible' ; break;
+ case 'N': $content['visible_css'] = $prefix . 'menu_invisible'; break;
+ default:
+ // Please report this
+ debug_report_bug(__FUNCTION__, __LINE__, 'Unsupported visible value detected. content=<pre>' . print_r($content, true) . '</pre>');
+ break;
+ } // END - switch
+
+ // Translate 'locked' and keep an eye on the prefix
+ switch ($content['locked']) {
+ // Should be locked
+ case 'Y': $content['locked_css'] = $prefix . 'menu_locked' ; break;
+ case 'N': $content['locked_css'] = $prefix . 'menu_unlocked'; break;
+ default:
+ // Please report this
+ debug_report_bug(__FUNCTION__, __LINE__, 'Unsupported locked value detected. content=<pre>' . print_r($content, true) . '</pre>');
+ break;
+ } // END - switch
+
+ // Return the resulting array
+ return $content;
+}
+
+// "Getter" for menu CSS classes, mainly used in templates
+function getMenuCssClasses ($data) {
+ // $data needs to be converted into an array
+ $content = explode('|', $data);
+
+ // Non-existent index 2 will happen in menu blocks
+ if (!isset($content[2])) $content[2] = '';
+
+ // Re-construct the array: 0=visible,1=locked,2=prefix
+ $content['visible'] = $content[0];
+ $content['locked'] = $content[1];
+
+ // Call our "translator" function
+ $content = translateMenuVisibleLocked($content, $content[2]);
+
+ // Return CSS classes
+ return ($content['visible_css'] . ' ' . $content['locked_css']);
+}
+