Jump to content

Add FrontNavigation on Install...


TheOnlyDroid
 Share

Recommended Posts

Bare with me here, I haven't touched IPS in a long time... So I'm not even sure if I'm doing it right, however some clarification would be greatly appreciated; So I'm assuming that adding the FrontNavigation default's for the application is done with defaultFrontNavigation() but I'm more than likely completely wrong..

 

	public function defaultFrontNavigation()
	{
		return array(
			'rootTabs'		=> array(
				array(
					'key'		=> 'Multimart',
					'children'	=> array(
						array(
							'app'		=> 'core',
							'key'		=> 'Menu',
							'title'		=> 'frontnavigation_multimart_complaints',
							'children'	=> array(
								array( 'key' => 'MyComplaints' ),
								array( 'key' => 'OpenComplaints' ),
								array( 'key' => 'ClosedComplaints' ),
							)
						)
					),
				)
			),
			'browseTabs'	=> array(),
			'browseTabsEnd'	=> array(),
			'activityTabs'	=> array()
		);
	}

VvGy8eEiSo_JyFY2LvrCfw.png.786407fdd705d1a1eed42b8fffe97c40.png

Link to comment
Share on other sites

5 hours ago, Austin Drake said:

Bare with me here, I haven't touched IPS in a long time... So I'm not even sure if I'm doing it right, however some clarification would be greatly appreciated; So I'm assuming that adding the FrontNavigation default's for the application is done with defaultFrontNavigation() but I'm more than likely completely wrong..

 


	public function defaultFrontNavigation()
	{
		return array(
			'rootTabs'		=> array(
				array(
					'key'		=> 'Multimart',
					'children'	=> array(
						array(
							'app'		=> 'core',
							'key'		=> 'Menu',
							'title'		=> 'frontnavigation_multimart_complaints',
							'children'	=> array(
								array( 'key' => 'MyComplaints' ),
								array( 'key' => 'OpenComplaints' ),
								array( 'key' => 'ClosedComplaints' ),
							)
						)
					),
				)
			),
			'browseTabs'	=> array(),
			'browseTabsEnd'	=> array(),
			'activityTabs'	=> array()
		);
	}

VvGy8eEiSo_JyFY2LvrCfw.png.786407fdd705d1a1eed42b8fffe97c40.png

you need to go to the Application.php file in the root folder of the app and in the

class _Application extends \IPS\Application
{
    
}

add

    public function defaultFrontNavigation()
    {
        return array(
            'rootTabs'		=> array(
            array(
                    'key'		=> 'MAINTAB',
                    'children'	=> array(
                        array( 'key' => 'CHILDREN' ),
                        array( 'key' => 'CHILDREN' ),
                        array( 'key' => 'CHILDREN' ),
                        array( 'key' => 'CHILDREN' ),
                        array( 'key' => 'CHILDREN' ),
                        array( 'key' => 'CHILDREN' )
                    ),
                ),
            ),
            'browseTabs'	=> array(),
            'browseTabsEnd'	=> array(),
            'activityTabs'	=> array()
        );
	}

the keys are the keys of the FrontNavigation extensions

MAINTAB is the top navigation tab abd the CHILDREN are the ones what will be below the MAINTAB

it states it all in the Application.php of the forums app

/**
	 * Default front navigation
	 *
	 * @code
	 	
	 	// Each item...
	 	array(
			'key'		=> 'Example',		// The extension key
			'app'		=> 'core',			// [Optional] The extension application. If ommitted, uses this application	
			'config'	=> array(...),		// [Optional] The configuration for the menu item
			'title'		=> 'SomeLangKey',	// [Optional] If provided, the value of this language key will be copied to menu_item_X
			'children'	=> array(...),		// [Optional] Array of child menu items for this item. Each has the same format.
		)
	 	
	 	return array(
		 	'rootTabs' 		=> array(), // These go in the top row
		 	'browseTabs'	=> array(),	// These go under the Browse tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
		 	'browseTabsEnd'	=> array(),	// These go under the Browse tab after all other items on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
		 	'activityTabs'	=> array(),	// These go under the Activity tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Activity tab may not exist)
		)
	 * @endcode
	 * @return array
	 */

 

Edited by TheJackal84
Link to comment
Share on other sites

2 hours ago, TheJackal84 said:

you need to go to the Application.php file in the root folder of the app and in the


class _Application extends \IPS\Application
{
    
}

add


    public function defaultFrontNavigation()
    {
        return array(
            'rootTabs'		=> array(
            array(
                    'key'		=> 'MAINTAB',
                    'children'	=> array(
                        array( 'key' => 'CHILDREN' ),
                        array( 'key' => 'CHILDREN' ),
                        array( 'key' => 'CHILDREN' ),
                        array( 'key' => 'CHILDREN' ),
                        array( 'key' => 'CHILDREN' ),
                        array( 'key' => 'CHILDREN' )
                    ),
                ),
            ),
            'browseTabs'	=> array(),
            'browseTabsEnd'	=> array(),
            'activityTabs'	=> array()
        );
	}

the keys are the keys of the FrontNavigation extensions

MAINTAB is the top navigation tab abd the CHILDREN are the ones what will be below the MAINTAB

it states it all in the Application.php of the forums app


/**
	 * Default front navigation
	 *
	 * @code
	 	
	 	// Each item...
	 	array(
			'key'		=> 'Example',		// The extension key
			'app'		=> 'core',			// [Optional] The extension application. If ommitted, uses this application	
			'config'	=> array(...),		// [Optional] The configuration for the menu item
			'title'		=> 'SomeLangKey',	// [Optional] If provided, the value of this language key will be copied to menu_item_X
			'children'	=> array(...),		// [Optional] Array of child menu items for this item. Each has the same format.
		)
	 	
	 	return array(
		 	'rootTabs' 		=> array(), // These go in the top row
		 	'browseTabs'	=> array(),	// These go under the Browse tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
		 	'browseTabsEnd'	=> array(),	// These go under the Browse tab after all other items on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
		 	'activityTabs'	=> array(),	// These go under the Activity tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Activity tab may not exist)
		)
	 * @endcode
	 * @return array
	 */

 

Hey TheJackal84, I neglected to mention that the code provided is in the Application.php of the App.

class _Application extends \IPS\Application
{
	/**
	 * [Node] Get Icon for tree
	 *
	 * @note	Return the class for the icon (e.g. 'globe')
	 * @return	string|null
	 */
	protected function get__icon()
	{
		return 'info-circle';
	}

	/**
	 * Default front navigation
	 *
	 * @code
	 	
	 	// Each item...
	 	array(
			'key'		=> 'Example',		// The extension key
			'app'		=> 'core',			// [Optional] The extension application. If ommitted, uses this application	
			'config'	=> array(...),		// [Optional] The configuration for the menu item
			'title'		=> 'SomeLangKey',	// [Optional] If provided, the value of this language key will be copied to menu_item_X
			'children'	=> array(...),		// [Optional] Array of child menu items for this item. Each has the same format.
		)
	 	
	 	return array(
		 	'rootTabs' 		=> array(), // These go in the top row
		 	'browseTabs'	=> array(),	// These go under the Browse tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
		 	'browseTabsEnd'	=> array(),	// These go under the Browse tab after all other items on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
		 	'activityTabs'	=> array(),	// These go under the Activity tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Activity tab may not exist)
		)
	 * @endcode
	 * @return array
	 */
	public function defaultFrontNavigation()
	{
		return array(
			'rootTabs'		=> array(
				array(
					'key'		=> 'Multimart',
					'children'	=> array(
						array(
							'app'		=> 'core',
							'key'		=> 'Menu',
							'title'		=> 'frontnavigation_multimart_complaints',
							'children'	=> array(
								array( 'key' => 'MyComplaints' ),
								array( 'key' => 'OpenComplaints' ),
								array( 'key' => 'ClosedComplaints' ),
							)
						)
					),
				)
			),
			'browseTabs'	=> array(),
			'browseTabsEnd'	=> array(),
			'activityTabs'	=> array()
		);
	}
}


 

Edited by Austin Drake
Link to comment
Share on other sites

6 minutes ago, Austin Drake said:

Hey Jack, I neglected to mention that the code provided is in the Application.php of the App.

You also didn't say what you actually wanted either lol

That looks ok, I probably would of done it like

class _Application extends \IPS\Application
{
	/**
	 * [Node] Get Icon for tree
	 *
	 * @note	Return the class for the icon (e.g. 'globe')
	 * @return	string|null
	 */
	protected function get__icon()
	{
		return 'info-circle';
	}

	/**
	 * Default front navigation
	 *
	 * @code
	 	
	 	// Each item...
	 	array(
			'key'		=> 'Example',		// The extension key
			'app'		=> 'core',			// [Optional] The extension application. If ommitted, uses this application	
			'config'	=> array(...),		// [Optional] The configuration for the menu item
			'title'		=> 'SomeLangKey',	// [Optional] If provided, the value of this language key will be copied to menu_item_X
			'children'	=> array(...),		// [Optional] Array of child menu items for this item. Each has the same format.
		)
	 	
	 	return array(
		 	'rootTabs' 		=> array(), // These go in the top row
		 	'browseTabs'	=> array(),	// These go under the Browse tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
		 	'browseTabsEnd'	=> array(),	// These go under the Browse tab after all other items on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
		 	'activityTabs'	=> array(),	// These go under the Activity tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Activity tab may not exist)
		)
	 * @endcode
	 * @return array
	 */
	public function defaultFrontNavigation()
	{
	    return array(
            'rootTabs'		=> array(
            array(
                    'key'		=> 'Multimart',
                    'children'	=> array(
                        array( 'key' => 'MyComplaints' ),
                        array( 'key' => 'OpenComplaints' ),
                        array( 'key' => 'ClosedComplaints' )
                    ),
                ),
            ),
            'browseTabs'	=> array(),
            'browseTabsEnd'	=> array(),
            'activityTabs'	=> array()
        );
    }
}

As that't the only way I have found it done in the files, They will only show once installed though

 

Link to comment
Share on other sites

11 minutes ago, TheJackal84 said:

You also didn't say what you actually wanted either lol

That looks ok, I probably would of done it like


class _Application extends \IPS\Application
{
	/**
	 * [Node] Get Icon for tree
	 *
	 * @note	Return the class for the icon (e.g. 'globe')
	 * @return	string|null
	 */
	protected function get__icon()
	{
		return 'info-circle';
	}

	/**
	 * Default front navigation
	 *
	 * @code
	 	
	 	// Each item...
	 	array(
			'key'		=> 'Example',		// The extension key
			'app'		=> 'core',			// [Optional] The extension application. If ommitted, uses this application	
			'config'	=> array(...),		// [Optional] The configuration for the menu item
			'title'		=> 'SomeLangKey',	// [Optional] If provided, the value of this language key will be copied to menu_item_X
			'children'	=> array(...),		// [Optional] Array of child menu items for this item. Each has the same format.
		)
	 	
	 	return array(
		 	'rootTabs' 		=> array(), // These go in the top row
		 	'browseTabs'	=> array(),	// These go under the Browse tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
		 	'browseTabsEnd'	=> array(),	// These go under the Browse tab after all other items on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
		 	'activityTabs'	=> array(),	// These go under the Activity tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Activity tab may not exist)
		)
	 * @endcode
	 * @return array
	 */
	public function defaultFrontNavigation()
	{
	    return array(
            'rootTabs'		=> array(
            array(
                    'key'		=> 'Multimart',
                    'children'	=> array(
                        array( 'key' => 'MyComplaints' ),
                        array( 'key' => 'OpenComplaints' ),
                        array( 'key' => 'ClosedComplaints' )
                    ),
                ),
            ),
            'browseTabs'	=> array(),
            'browseTabsEnd'	=> array(),
            'activityTabs'	=> array()
        );
    }
}

As that't the only way I have found it done in the files, They will only show once installed though

 

Yeah sorry about that..

Basically, I want to add the Parent Item and the Children to the navigation upon install, without having to go through and create the menu item's manually; As that'll become a massive pain in the ass once I've got the project to the point where I'm happy with it and deploy it on our server for official use.

Link to comment
Share on other sites

6 hours ago, Austin Drake said:

Yeah sorry about that..

Basically, I want to add the Parent Item and the Children to the navigation upon install, without having to go through and create the menu item's manually; As that'll become a massive pain in the ass once I've got the project to the point where I'm happy with it and deploy it on our server for official use.

The way I put here

will work like you want it to, But you need to install it, You will have add them manually while in dev, only on install they go in the navigation bar

Edited by TheJackal84
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...