Swat/SwatActions.php
protected function getInlineJavaScript()
    {
        static $shown = false;

        if (!$shown) {
            $javascript = $this->getInlineJavaScriptTranslations();
            $shown = true;
        } else {
            $javascript = '';
        }

        $values = array();
        if ($this->show_blank) {
            $values[] = "''";
        }

        foreach ($this->action_items as $item) {
            if ($item->visible) {
                $values[] = SwatString::quoteJavaScriptString($item->id);
            }
        }

        $selected_value =
            $this->selected === null
                ? 'null'
                : SwatString::quoteJavaScriptString($this->selected->id);

        $javascript .= sprintf(
            "var %s_obj = new SwatActions(%s, [%s], %s);",
            $this->id,
            SwatString::quoteJavaScriptString($this->id),
            implode(', ', $values),
            $selected_value
        );

        if ($this->view !== null && $this->selector !== null) {
            $javascript .= sprintf(
                "\n%s_obj.setViewSelector(%s, '%s');",
                $this->id,
                $this->view->id,
                $this->selector->getId()
            );
        }

        return $javascript;
    }
protected function getInlineJavaScript()
    {
        static $shown = false;

        if (!$shown) {
            $javascript = $this->getInlineJavaScriptTranslations();
            $shown = true;
        } else {
            $javascript = '';
        }

        $values = array();
        if ($this->show_blank) {
            $values[] = "''";
        }

        foreach ($this->action_items as $item) {
            if ($item->visible) {
                $values[] = SwatString::quoteJavaScriptString($item->id);
            }
        }

        $selected_value =
            $this->selected === null
                ? 'null'
                : SwatString::quoteJavaScriptString($this->selected->id);

        $javascript .= sprintf(
            "var %s_obj = new SwatActions(%s, [%s], %s);",
            $this->id,
            SwatString::quoteJavaScriptString($this->id),
            implode(', ', $values),
            $selected_value
        );

        if ($this->view !== null && $this->selector !== null) {
            $javascript .= sprintf(
                "\n%s_obj.setViewSelector(%s, '%s');",
                $this->id,
                $this->view->id,
                $this->selector->getId()
            );
        }

        return $javascript;
    }
protected function getInlineJavaScript ( ) { static $ shown = false ; if ( ! $ shown ) { $ javascript = $ this -> getInlineJavaScriptTranslations ( ) ; $ shown = true ; } else { $ javascript = '' ; } $ values = array ( ) ; if ( $ this -> show_blank ) { $ values [ ] = "''" ; } foreach ( $ this -> action_items as $ item ) { if ( $ item -> visible ) { $ values [ ] = SwatString :: quoteJavaScriptString ( $ item -> id ) ; } } $ selected_value = $ this -> selected === null ? 'null' : SwatString :: quoteJavaScriptString ( $ this -> selected -> id ) ; $ javascript .= sprintf ( "var %s_obj = new SwatActions(%s, [%s], %s);" , $ this -> id , SwatString :: quoteJavaScriptString ( $ this -> id ) , implode ( ', ' , $ values ) , $ selected_value ) ; if ( $ this -> view !== null && $ this -> selector !== null ) { $ javascript .= sprintf ( "\n%s_obj.setViewSelector(%s, '%s');" , $ this -> id , $ this -> view -> id , $ this -> selector -> getId ( ) ) ; } return $ javascript ; }
Gets inline JavaScript required to show and hide selected action items

@return string inline JavaScript required to show and hide selected
action items.
Gets inline JavaScript required to show and hide selected action items