Contexts / Menu Item Context

Read More: Fieldmanager_Context_MenuItem

Adds fields to menu items, and saves data to post meta.

  1. Example 1: Basic Example

    /**
     * Menu items.
     */
    add_action(
    	'fm_menu_item',
    	function() {
    		$fm = new Fieldmanager_Group(
    			[
    				'name'     => 'example_menu_fields',
    				'children' => [
    					'title' => new Fieldmanager_TextField(
    						[
    							'label'       => __( 'Dropdown Title', 'example-project' ),
    							'description' => __( "Defaults to the Menu Item's Navigation Label", 'example-project' ),
    						]
    					),
    					'description' => new Fieldmanager_TextArea(
    						[
    							'label' => __( 'Dropdown Description', 'example-project' ),
    						]
    					),
    				],
    			]
    		);
    		return new \Fieldmanager_Context_Menu_Item( $fm );
    	}
    );