本文整理汇总了PHP中Q_Response::shouldRetainTool方法的典型用法代码示例。如果您正苦于以下问题:PHP Q_Response::shouldRetainTool方法的具体用法?PHP Q_Response::shouldRetainTool怎么用?PHP Q_Response::shouldRetainTool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q_Response
的用法示例。
在下文中一共展示了Q_Response::shouldRetainTool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Q_after_Q_tool_render
function Q_after_Q_tool_render($params, &$result)
{
$info = $params['info'];
$extra = $params['extra'];
if (!is_array($extra)) {
$extra = array();
}
$id_prefix = Q_Html::getIdPrefix();
$tool_ids = Q_Html::getToolIds();
$tag = Q::ifset($extra, 'tag', 'div');
if (empty($tag)) {
Q_Html::popIdPrefix();
return;
}
$classes = '';
$data_options = '';
$count = count($info);
foreach ($info as $name => $opt) {
$classes = ($classes ? "{$classes} " : $classes) . implode('_', explode('/', $name)) . '_tool';
$options = Q_Response::getToolOptions($name);
if (isset($options)) {
$friendly_options = str_replace(array('"', '\\/'), array('"', '/'), Q_Html::text(Q::json_encode($options)));
} else {
$friendly_options = '';
}
$normalized = Q_Utils::normalize($name, '-');
if (isset($options) or $count > 1) {
$id = $tool_ids[$name];
$id_string = $count > 1 ? "{$id} " : '';
$data_options .= " data-{$normalized}='{$id_string}{$friendly_options}'";
}
$names[] = $name;
}
if (isset($extra['classes'])) {
$classes .= ' ' . $extra['classes'];
}
$attributes = isset($extra['attributes']) ? ' ' . Q_Html::attributes($extra['attributes']) : '';
$data_retain = !empty($extra['retain']) || Q_Response::shouldRetainTool($id_prefix) ? " data-Q-retain=''" : '';
$data_replace = !empty($extra['replace']) || Q_Response::shouldReplaceWithTool($id_prefix) ? " data-Q-replace=''" : '';
$names = $count === 1 ? ' ' . key($info) : 's ' . implode(" ", $names);
$ajax = Q_Request::isAjax();
$result = "<{$tag} id='{$id_prefix}tool' " . "class='Q_tool {$classes}'{$data_options}{$data_retain}{$data_replace}{$attributes}>" . "{$result}</{$tag}>";
if (!Q_Request::isAjax()) {
$result = "<!--\nbegin tool{$names}\n-->{$result}<!--\nend tool{$names} \n-->";
}
Q_Html::popIdPrefix();
}