You see, all the core components implements toolbar with similar button for saving, deleting, editing, and publishing items. You can use these buttons in your component too.
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
class TOOLBAR_hello {
function _NEW() {
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
}
function _DEFAULT() {
JToolBarHelper::title( JText::_( 'Hello World Manager' ), 'generic.png' );
JToolBarHelper::publishList();
JToolBarHelper::unpublishList();
JToolBarHelper::deleteList();
JToolBarHelper::editListX();
JToolBarHelper::addNewX();
}
}
?>
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
require_once( JApplicationHelper::getPath( 'toolbar_html' ) );
switch ( $task )
{
case 'add' :
TOOLBAR_hello::_NEW();
break;
default:
TOOLBAR_hello::_DEFAULT();
break;
}
?>
Refresh the browser in the back end and go to Hello World under Components. You should see the following screen:
To see the other toolbar, add &task=add to the end of the URL in your browser (ex. http://localhost/joomla/administrator/index.php?option=com_hello&task=add), then load it.