Swat/SwatButton.php
public function setFromStock($stock_id, $overwrite_properties = true)
    {
        switch ($stock_id) {
            case 'submit':
                $title = Swat::_('Submit');
                $class = 'swat-button-submit';
                break;

            case 'create':
                $title = Swat::_('Create');
                $class = 'swat-button-create';
                break;

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

            case 'apply':
                $title = Swat::_('Apply');
                $class = 'swat-button-apply';
                break;

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

            case 'cancel':
                $title = Swat::_('Cancel');
                $class = 'swat-button-cancel';
                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 'submit':
                $title = Swat::_('Submit');
                $class = 'swat-button-submit';
                break;

            case 'create':
                $title = Swat::_('Create');
                $class = 'swat-button-create';
                break;

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

            case 'apply':
                $title = Swat::_('Apply');
                $class = 'swat-button-apply';
                break;

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

            case 'cancel':
                $title = Swat::_('Cancel');
                $class = 'swat-button-cancel';
                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 'submit' : $ title = Swat :: _ ( 'Submit' ) ; $ class = 'swat-button-submit' ; break ; case 'create' : $ title = Swat :: _ ( 'Create' ) ; $ class = 'swat-button-create' ; break ; case 'add' : $ title = Swat :: _ ( 'Add' ) ; $ class = 'swat-button-add' ; break ; case 'apply' : $ title = Swat :: _ ( 'Apply' ) ; $ class = 'swat-button-apply' ; break ; case 'delete' : $ title = Swat :: _ ( 'Delete' ) ; $ class = 'swat-button-delete' ; break ; case 'cancel' : $ title = Swat :: _ ( 'Cancel' ) ; $ class = 'swat-button-cancel' ; 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 button to a stock type

Valid stock type ids are:

- submit
- create
- add
- apply
- delete
- cancel

@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 button to a stock type