Swat/SwatToolLink.php
public function setFromStock($stock_id, $overwrite_properties = true)
    {
        switch ($stock_id) {
            case 'create':
                $title = Swat::_('Create');
                $class = 'swat-tool-link-create';
                break;

            case 'add':
                $title = Swat::_('Add');
                $class = 'swat-tool-link-add';
                break;

            case 'edit':
                $title = Swat::_('Edit');
                $class = 'swat-tool-link-edit';
                break;

            case 'download':
                $title = Swat::_('Download');
                $class = 'swat-tool-link-download';
                break;

            case 'delete':
                $title = Swat::_('Delete');
                $class = 'swat-tool-link-delete';
                break;

            case 'cancel':
                $title = Swat::_('Cancel');
                $class = 'swat-tool-link-cancel';
                break;

            case 'preview':
                $title = Swat::_('Preview');
                $class = 'swat-tool-link-preview';
                break;

            case 'change-order':
                $title = Swat::_('Change Order');
                $class = 'swat-tool-link-change-order';
                break;

            case 'help':
                $title = Swat::_('Help');
                $class = 'swat-tool-link-help';
                break;

            case 'print':
                $title = Swat::_('Print');
                $class = 'swat-tool-link-print';
                break;

            case 'email':
                $title = Swat::_('Email');
                $class = 'swat-tool-link-email';
                break;

            default:
                throw new SwatUndefinedStockTypeException(
                    "Stock type with id of '{$stock_id}' not found.",
                    0,
                    $stock_id
                );
        }

        if ($overwrite_properties || $this->title === null) {
            $this->title = $title;
        }

        $this->stock_class = $class;
    }
public function setFromStock($stock_id, $overwrite_properties = true)
    {
        switch ($stock_id) {
            case 'create':
                $title = Swat::_('Create');
                $class = 'swat-tool-link-create';
                break;

            case 'add':
                $title = Swat::_('Add');
                $class = 'swat-tool-link-add';
                break;

            case 'edit':
                $title = Swat::_('Edit');
                $class = 'swat-tool-link-edit';
                break;

            case 'download':
                $title = Swat::_('Download');
                $class = 'swat-tool-link-download';
                break;

            case 'delete':
                $title = Swat::_('Delete');
                $class = 'swat-tool-link-delete';
                break;

            case 'cancel':
                $title = Swat::_('Cancel');
                $class = 'swat-tool-link-cancel';
                break;

            case 'preview':
                $title = Swat::_('Preview');
                $class = 'swat-tool-link-preview';
                break;

            case 'change-order':
                $title = Swat::_('Change Order');
                $class = 'swat-tool-link-change-order';
                break;

            case 'help':
                $title = Swat::_('Help');
                $class = 'swat-tool-link-help';
                break;

            case 'print':
                $title = Swat::_('Print');
                $class = 'swat-tool-link-print';
                break;

            case 'email':
                $title = Swat::_('Email');
                $class = 'swat-tool-link-email';
                break;

            default:
                throw new SwatUndefinedStockTypeException(
                    "Stock type with id of '{$stock_id}' not found.",
                    0,
                    $stock_id
                );
        }

        if ($overwrite_properties || $this->title === null) {
            $this->title = $title;
        }

        $this->stock_class = $class;
    }
public function setFromStock ( $ stock_id , $ overwrite_properties = true ) { switch ( $ stock_id ) { case 'create' : $ title = Swat :: _ ( 'Create' ) ; $ class = 'swat-tool-link-create' ; break ; case 'add' : $ title = Swat :: _ ( 'Add' ) ; $ class = 'swat-tool-link-add' ; break ; case 'edit' : $ title = Swat :: _ ( 'Edit' ) ; $ class = 'swat-tool-link-edit' ; break ; case 'download' : $ title = Swat :: _ ( 'Download' ) ; $ class = 'swat-tool-link-download' ; break ; case 'delete' : $ title = Swat :: _ ( 'Delete' ) ; $ class = 'swat-tool-link-delete' ; break ; case 'cancel' : $ title = Swat :: _ ( 'Cancel' ) ; $ class = 'swat-tool-link-cancel' ; break ; case 'preview' : $ title = Swat :: _ ( 'Preview' ) ; $ class = 'swat-tool-link-preview' ; break ; case 'change-order' : $ title = Swat :: _ ( 'Change Order' ) ; $ class = 'swat-tool-link-change-order' ; break ; case 'help' : $ title = Swat :: _ ( 'Help' ) ; $ class = 'swat-tool-link-help' ; break ; case 'print' : $ title = Swat :: _ ( 'Print' ) ; $ class = 'swat-tool-link-print' ; break ; case 'email' : $ title = Swat :: _ ( 'Email' ) ; $ class = 'swat-tool-link-email' ; break ; default : throw new SwatUndefinedStockTypeException ( "Stock type with id of '{$stock_id}' not found." , 0 , $ stock_id ) ; } if ( $ overwrite_properties || $ this -> title === null ) { $ this -> title = $ title ; } $ this -> stock_class = $ class ; }
Sets the values of this tool link to a stock type

Valid stock type ids are:

- create
- add
- edit
- delete
- cancel
- preview
- change-order
- help
- print
- email

@param string $stock_id the identifier of the stock type to use.
@param boolean $overwrite_properties whether to overwrite properties if
they are already set.

@throws SwatUndefinedStockTypeException
Sets the values of this tool link to a stock type