本文整理汇总了Python中lib.drupy.DrupyPHP.array_keys方法的典型用法代码示例。如果您正苦于以下问题:Python DrupyPHP.array_keys方法的具体用法?Python DrupyPHP.array_keys怎么用?Python DrupyPHP.array_keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.drupy.DrupyPHP
的用法示例。
在下文中一共展示了DrupyPHP.array_keys方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_querystring
# 需要导入模块: from lib.drupy import DrupyPHP [as 别名]
# 或者: from lib.drupy.DrupyPHP import array_keys [as 别名]
def get_querystring():
"""
Compose a query string to append to table sorting requests.
@return
A query string that consists of all components of the current page request
except for those pertaining to table sorting.
"""
return lib_common.drupal_query_string_encode(
_REQUEST, php.array_merge(['q', 'sort', 'order'], php.array_keys(_COOKIE)))
示例2: template_preprocess_maintenance_page
# 需要导入模块: from lib.drupy import DrupyPHP [as 别名]
# 或者: from lib.drupy.DrupyPHP import array_keys [as 别名]
def template_preprocess_maintenance_page(variables):
"""
The variables generated here is a mirror of template_preprocess_page().
This preprocessor will run it's course when theme_maintenance_page() is
invoked. It is also used in theme_install_page() and theme_update_page() to
keep all the variables consistent.
An alternate template file of "maintenance-page-offline.tpl.php" can be
used when the database is offline to hide errors and completely replace the
content.
The variables array contains the following arguments:
- content
- show_blocks
@see maintenance-page.tpl.php
"""
php.Reference.check(variables)
# Add favicon
if (theme_get_setting('toggle_favicon')):
drupal_set_html_head('<link rel="shortcut icon" href="' + \
check_url(theme_get_setting('favicon')) + '" type="image/x-icon" />');
# Retrieve the theme data to list all available regions.
theme_data = _system_theme_data()
regions = theme_data[lib_appglobals.theme].info['regions']
# Get all region content set with drupal_set_content().
for region in php.array_keys(regions):
# Assign region to a region variable.
region_content = drupal_get_content(region)
if php.isset(variables, region):
variables[region] += region_content
else:
variables[region] = region_content
# Setup layout variable.
variables['layout'] = 'none'
if (not php.empty(variables['left'])):
variables['layout'] = 'left'
if (not php.empty(variables['right'])):
variables['layout'] = ('both' if \
(variables['layout'] == 'left') else 'right')
# Construct page title
if (drupal_get_title()):
head_title = [strip_tags(drupal_get_title()), \
variable_get('site_name', 'Drupal')];
else:
head_title = [variable_get('site_name', 'Drupal')]
if (variable_get('site_slogan', '')):
head_title.append( variable_get('site_slogan', '') )
variables['head_title'] = php.implode(' | ', head_title)
variables['base_path'] = base_path()
variables['front_page'] = url()
variables['breadcrumb'] = ''
variables['feed_icons'] = ''
variables['footer_message'] = \
filter_xss_admin(variable_get('site_footer', FALSE))
variables['head'] = drupal_get_html_head()
variables['help'] = ''
variables['language'] = lib_appglobals.language
variables['language'].dir = \
('rtl' if lib_appglobals.language.direction else 'ltr')
variables['logo'] = theme_get_setting('logo');
variables['messages'] = (theme('status_messages') if \
variables['show_messages'] else '')
variables['mission'] = '';
variables['main_menu'] = [];
variables['secondary_menu'] = [];
variables['search_box'] = '';
variables['site_name'] = \
(variable_get('site_name', 'Drupal') if \
theme_get_setting('toggle_name') else '')
variables['site_slogan'] = (variable_get('site_slogan', '') if \
theme_get_setting('toggle_slogan') else '')
variables['css'] = drupal_add_css()
variables['styles'] = drupal_get_css()
variables['scripts'] = drupal_get_js()
variables['tabs'] = ''
variables['title'] = drupal_get_title();
variables['closure'] = ''
# Compile a list of classes that are going to be applied to the body element.
body_classes = []
body_classes.append( 'in-maintenance' )
if (php.isset(variables, 'db_is_active') and \
not variables['db_is_active']):
body_classes.append( 'db-offline' )
if (variables['layout'] == 'both'):
body_classes.append( 'two-sidebars' )
elif (variables['layout'] == 'none'):
body_classes.append( 'no-sidebars' )
else:
body_classes.append( 'one-sidebar sidebar-' + variables['layout'] )
variables['body_classes'] = php.implode(' ', body_classes)
# Dead databases will show error messages so supplying this template will
# allow themers to override the page and the content completely.
if (php.isset(variables, 'db_is_active') and \
not variables['db_is_active']):
variables['template_file'] = 'maintenance-page-offline';