当前位置: 首页>>代码示例>>Python>>正文


Python DrupyPHP.unset方法代码示例

本文整理汇总了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
开发者ID:brendoncrawford,项目名称:drupy,代码行数:49,代码来源:tablesort.py


注:本文中的lib.drupy.DrupyPHP.unset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。