src/AddToCampaignHandler.php
protected function getFormAlert($inChangeSets, $candidateChangeSets, $canCreate)
    {
        // In a subset of changesets
        if ($inChangeSets->count() > 0 && $candidateChangeSets->count() > 0) {
            return sprintf(
                '<div class="alert alert-info"><strong>%s</strong><br/>%s</div>',
                _t(
                    __CLASS__ . '.AddToCampaignInChangsetLabel',
                    'Heads up, this item is already in campaign(s):'
                ),
                Convert::raw2xml(implode(', ', $inChangeSets->column('Name')))
            );
        }

        // In all changesets
        if ($inChangeSets->count() > 0) {
            return sprintf(
                '<div class="alert alert-info"><strong>%s</strong><br/>%s</div>',
                _t(
                    __CLASS__ . '.AddToCampaignInChangsetLabelAll',
                    'Heads up, this item is already in ALL campaign(s):'
                ),
                Convert::raw2xml(implode(', ', $inChangeSets->column('Name')))
            );
        }

        // Create only
        if ($candidateChangeSets->count() === 0 && $canCreate) {
            return sprintf(
                '<div class="alert alert-info">%s</div>',
                _t(
                    __CLASS__ . '.NO_CAMPAIGNS',
                    "You currently don't have any campaigns. "
                    . "You can edit campaign details later in the Campaigns section."
                )
            );
        }

        // Can't select or create
        if ($candidateChangeSets->count() === 0 && !$canCreate) {
            return sprintf(
                '<div class="alert alert-warning">%s</div>',
                _t(
                    __CLASS__ . '.NO_CREATE',
                    "Oh no! You currently don't have any campaigns created. "
                    . "Your current login does not have privileges to create campaigns. "
                    . "Campaigns can only be created by users with Campaigns section rights."
                )
            );
        }
        return null;
    }
protected function getFormAlert($inChangeSets, $candidateChangeSets, $canCreate)
    {
        // In a subset of changesets
        if ($inChangeSets->count() > 0 && $candidateChangeSets->count() > 0) {
            return sprintf(
                '<div class="alert alert-info"><strong>%s</strong><br/>%s</div>',
                _t(
                    __CLASS__ . '.AddToCampaignInChangsetLabel',
                    'Heads up, this item is already in campaign(s):'
                ),
                Convert::raw2xml(implode(', ', $inChangeSets->column('Name')))
            );
        }

        // In all changesets
        if ($inChangeSets->count() > 0) {
            return sprintf(
                '<div class="alert alert-info"><strong>%s</strong><br/>%s</div>',
                _t(
                    __CLASS__ . '.AddToCampaignInChangsetLabelAll',
                    'Heads up, this item is already in ALL campaign(s):'
                ),
                Convert::raw2xml(implode(', ', $inChangeSets->column('Name')))
            );
        }

        // Create only
        if ($candidateChangeSets->count() === 0 && $canCreate) {
            return sprintf(
                '<div class="alert alert-info">%s</div>',
                _t(
                    __CLASS__ . '.NO_CAMPAIGNS',
                    "You currently don't have any campaigns. "
                    . "You can edit campaign details later in the Campaigns section."
                )
            );
        }

        // Can't select or create
        if ($candidateChangeSets->count() === 0 && !$canCreate) {
            return sprintf(
                '<div class="alert alert-warning">%s</div>',
                _t(
                    __CLASS__ . '.NO_CREATE',
                    "Oh no! You currently don't have any campaigns created. "
                    . "Your current login does not have privileges to create campaigns. "
                    . "Campaigns can only be created by users with Campaigns section rights."
                )
            );
        }
        return null;
    }
protected function getFormAlert ( $ inChangeSets , $ candidateChangeSets , $ canCreate ) { // In a subset of changesets if ( $ inChangeSets -> count ( ) > 0 && $ candidateChangeSets -> count ( ) > 0 ) { return sprintf ( '<div class="alert alert-info"><strong>%s</strong><br/>%s</div>' , _t ( __CLASS__ . '.AddToCampaignInChangsetLabel' , 'Heads up, this item is already in campaign(s):' ) , Convert :: raw2xml ( implode ( ', ' , $ inChangeSets -> column ( 'Name' ) ) ) ) ; } // In all changesets if ( $ inChangeSets -> count ( ) > 0 ) { return sprintf ( '<div class="alert alert-info"><strong>%s</strong><br/>%s</div>' , _t ( __CLASS__ . '.AddToCampaignInChangsetLabelAll' , 'Heads up, this item is already in ALL campaign(s):' ) , Convert :: raw2xml ( implode ( ', ' , $ inChangeSets -> column ( 'Name' ) ) ) ) ; } // Create only if ( $ candidateChangeSets -> count ( ) === 0 && $ canCreate ) { return sprintf ( '<div class="alert alert-info">%s</div>' , _t ( __CLASS__ . '.NO_CAMPAIGNS' , "You currently don't have any campaigns. " . "You can edit campaign details later in the Campaigns section." ) ) ; } // Can't select or create if ( $ candidateChangeSets -> count ( ) === 0 && ! $ canCreate ) { return sprintf ( '<div class="alert alert-warning">%s</div>' , _t ( __CLASS__ . '.NO_CREATE' , "Oh no! You currently don't have any campaigns created. " . "Your current login does not have privileges to create campaigns. " . "Campaigns can only be created by users with Campaigns section rights." ) ) ; } return null ; }
Get descriptive alert to display at the top of the form

@param ArrayList $inChangeSets List of changesets this item exists in
@param ArrayList $candidateChangeSets List of changesets this item could be added to
@param bool $canCreate
@return string
Get descriptive alert to display at the top of the form