本文整理汇总了Python中lib.drupy.DrupyPHP.unset方法的典型用法代码示例。如果您正苦于以下问题:Python DrupyPHP.unset方法的具体用法?Python DrupyPHP.unset怎么用?Python DrupyPHP.unset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.drupy.DrupyPHP
的用法示例。
在下文中一共展示了DrupyPHP.unset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: header
# 需要导入模块: from lib.drupy import DrupyPHP [as 别名]
# 或者: from lib.drupy.DrupyPHP import unset [as 别名]
def header(cell, header, ts):
"""
Format a column header.
If the cell in question is the column header for the current sort criterion,
it gets special formatting. All possible sort criteria become links.
@param cell
The cell to format.
@param header
An array of column headers in the format described in theme_table().
@param ts
The current table sort context as returned from hook_init().
@return
A properly formatted cell, ready for _theme_table_cell().
"""
# Special formatting for the currently sorted column header.
if php.is_array(cell) and php.isset(cell['field']):
title = t('sort by @s', {'@s': cell['data']})
if cell['data'] == ts['name']:
ts['sort'] = ('desc' if (ts['sort'] == 'asc') else 'asc')
if php.isset(cell['class']):
cell['class'] += ' active'
else:
cell['class'] = 'active'
image = lib_theme.theme('tablesort_indicator', ts['sort'])
else:
# If the user clicks a different header, we want to sort ascending
# initially.
ts['sort'] = 'asc'
image = ''
if not php.empty(ts['query_string']):
ts['query_string'] = '&' + ts['query_string']
cell['data'] = l(
cell['data'] + image, php.GET['q'], {
'attributes':
{
'title': title,
'query':
'sort=' + ts['sort'] + '&order=' + rawurlencode(cell['data']) +
ts['query_string'],
'html': TRUE
}
}
)
php.unset(cell['field'], cell['sort'])
return cell