icon ) ) ? ' hidden' : '';
$highlights = array(
'info' => __( 'Info', 'ayyash' ),
'success' => __( 'Success', 'ayyash' ),
'warning' => __( 'Warning', 'ayyash' ),
'danger' => __( 'Danger', 'ayyash' ),
);
$mega_width = array(
'natural' => __( 'Natural Width', 'ayyash' ),
'custom' => __( 'Custom Width', 'ayyash' ),
);
$column_width = array(
'col-md-1' => '1 Col',
'col-md-2' => '2 Col',
'col-md-3' => '3 Col',
'col-md-4' => '4 Col',
'col-md-5' => '5 Col',
'col-md-6' => '6 Col (half)',
'col-md-7' => '7 Col',
'col-md-8' => '8 Col',
'col-md-9' => '9 Col',
'col-md-10' => '10 Col',
'col-md-11' => '11 Col',
'col-md-12' => '12 Col (full-width)',
);
?>
',
esc_attr( $item->icon ),
sprintf(
/* translators: 1. Icon Name */
esc_attr__( 'Icon ā%sā', 'ayyash' ),
esc_attr( ucfirst( str_replace( 'ti-', '', $item->icon ) ) )
)
);
?>
' . esc_html__( 'Mega Menu', 'ayyash' ) . '';
$out .= '' . esc_html__( 'Column', 'ayyash' ) . '';
echo wp_kses_post( $out );
}
/**
*
* Custom Menu Args
*
* @param array $args menu args.
*
* @return array
*/
public function wp_nav_menu_args( $args ) {
$location = $args['theme_location'];
if ( ( 'primary' == $location || 'right' == $location ) && ! isset( $args['mobile'] ) ) {
$args['container'] = false;
$args['menu_class'] = 'main-navigation sf-menu';
$args['walker'] = new Themeoo_Walker_Nav_Menu_Custom();
} elseif ( isset( $args['mobile'] ) || 'mobile' == $location ) {
$args['after'] = '
';
}
return $args;
}
/**
*
* Custom Nav Menu Edit.
*
* @return string
*/
public function wp_edit_nav_menu_walker() {
return 'Themeoo_Walker_Nav_Menu_Edit_Custom';
}
/**
* Save Custom Fields.
*
* @param object $item item.
*
* @return object
*/
public function wp_setup_nav_menu_item( $item ) {
foreach ( $this->extra_fields as $key ) {
$item->$key = isset( $item->ID ) ? get_post_meta( $item->ID, '_menu_item_' . $key, true ) : '';
}
return $item;
}
/**
* Update Custom Fields.
*
* @param int $menu_id Menu id.
* @param int $db_id Menu item db id.
* @param array $args Menu args.
*
* @return void
*/
public function wp_update_nav_menu_item( $menu_id, $db_id, $args ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed,Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
$req = wp_unslash( $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
foreach ( $this->extra_fields as $key ) {
$_key = 'menu-item-' . $key;
$value = ( isset( $req[ $_key ][ $db_id ] ) ) ? sanitize_text_field( $req[ $_key ][ $db_id ] ) : '';
update_post_meta( $db_id, '_menu_item_' . $key, $value );
}
}
}
new Themeoo_Megamenu_API();