本文整理汇总了PHP中Walker_Nav_Menu::display_element方法的典型用法代码示例。如果您正苦于以下问题:PHP Walker_Nav_Menu::display_element方法的具体用法?PHP Walker_Nav_Menu::display_element怎么用?PHP Walker_Nav_Menu::display_element使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Walker_Nav_Menu
的用法示例。
在下文中一共展示了Walker_Nav_Menu::display_element方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
// check whether this item has children, and set $item->hasChildren accordingly
$element->hasChildren = isset($children_elements[$element->ID]) && !empty($children_elements[$element->ID]);
// continue with normal behavior
return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例2:
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
$element->has_children = !empty($children_elements[$element->ID]);
$element->classes[] = $element->current || $element->current_item_ancestor ? 'active' : '';
$element->classes[] = $element->has_children && 1 !== $max_depth ? 'has-submenu' : '';
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例3: count
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
$id_field = $this->db_fields['id'];
if (is_object($args[0])) {
$args[0]->has_children = !empty($children_elements[$element->{$id_field}]);
$args[0]->is_bordered = $element->_dfd_mega_menu_bordered == 1;
}
if ($depth == 0 && $element->_dfd_mega_menu_enabled == 1 && !empty($children_elements[$element->{$id_field}])) {
$columns = $element->_dfd_mega_menu_columns;
$cnt = count($children_elements[$element->{$id_field}]);
if ($columns > 1 && $cnt > 1) {
$delim_step = ceil($cnt / $columns);
for ($i = 0; $i < $cnt; $i++) {
if ($i == $cnt - 1 && $cnt % $delim_step !== 0) {
$children_elements[$element->{$id_field}][$i]->is_mega_unlast = true;
}
if ($i == 0 || $i % $delim_step !== 0) {
continue;
}
$children_elements[$element->{$id_field}][$i]->is_mega_delim = true;
}
}
}
return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例4:
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
//we add a property here
//will be used in override start_el() and class filter
$element->is_dropdown = !empty($children_elements[$element->ID]);
//let the parent do the rest of the job !
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例5: display_element
public function display_element($el, &$children, $max_depth, $depth = 0, $args, &$output)
{
$id = $this->db_fields['id'];
if (isset($children[$el->{$id}])) {
$el->classes[] = 'has_children';
}
parent::display_element($el, $children, $max_depth, $depth, $args, $output);
}
示例6: isset
/**
* Traverse elements to create list from elements.
*
* Display one element if the element doesn't have any children otherwise,
* display the element and its children. Will only traverse up to the max
* depth and no ignore elements under that depth. It is possible to set the
* max depth to include all depths, see walk() method.
*
* This method shouldn't be called directly, use the walk() method instead.
*
* @since 2.5.0
*
* @param object $element Data object
* @param array $children_elements List of elements to continue traversing.
* @param int $max_depth Max depth to traverse.
* @param int $depth Depth of current element.
* @param array $args
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
if (!$element) {
return;
}
$element->hasChildren = isset($children_elements[$element->ID]) && !empty($children_elements[$element->ID]);
return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例7: display_element
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
$id_field = $this->db_fields['id'];
if (!empty($children_elements[$element->{$id_field}])) {
$element->classes[] = 'menu-has-children';
}
Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例8:
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
$element->is_dropdown = !empty($children_elements[$element->ID]) && ($depth + 1 < $max_depth || $max_depth === 0);
if ($element->is_dropdown) {
$element->classes[] = 'dropdown';
}
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例9: array
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
//we add a property here
//will be used in override start_el() and class filter
$element->is_dropdown = !empty($children_elements[$element->ID]);
$element->classes = apply_filters('tc_nav_menu_css_class', array_filter(empty($element->classes) ? array() : (array) $element->classes), $element, $args, $depth);
//let the parent do the rest of the job !
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例10: display_element
/**
* Traverse elements to create list from elements.
*
* Display one element if the element doesn't have any children otherwise,
* display the element and its children. Will only traverse up to the max
* depth and no ignore elements under that depth.
*
* This method shouldn't be called directly, use the walk() method instead.
*
* @see Walker::start_el()
* @since 2.5.0
*
* @param object $element Data object
* @param array $children_elements List of elements to continue traversing.
* @param int $max_depth Max depth to traverse.
* @param int $depth Depth of current element.
* @param array $args
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output)
{
if (!$element) {
return;
}
$id_field = $this->db_fields['id'];
$this->has_children = !empty($children_elements[$element->{$id_field}]);
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例11: display_element
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
$id_field = $this->db_fields['id'];
if (!empty($children_elements[$element->{$id_field}])) {
$element->classes[] = 'haschild';
$element->arrow = '<span class="menu-arrow"></span>';
}
Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例12:
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
$element->has_children = !empty($children_elements[$element->ID]);
if (!empty($element->classes)) {
$element->classes[] = $element->current || $element->current_item_ancestor ? 'active' : '';
$element->classes[] = $element->has_children ? 'has-dropdown' : '';
}
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例13: display_element
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
$id_field = $this->db_fields['id'];
if (!empty($children_elements[$element->{$id_field}])) {
$element->classes[] = 'has_children has-children';
wp_enqueue_style('cpotheme-fontawesome');
}
Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例14: display_element
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
$id_field = $this->db_fields['id'];
// check whether there are children for the given ID
$element->hasChildren = isset($children_elements[$element->{$id_field}]) && !empty($children_elements[$element->{$id_field}]);
if (!empty($children_elements[$element->{$id_field}])) {
$element->classes[] = 'menu-item-parent';
}
Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
示例15:
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output)
{
if (!$element) {
return;
}
$id_field = $this->db_fields['id'];
if (!empty($children_elements[$element->{$id_field}])) {
array_push($element->classes, 'has_sublevel');
}
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}