src/Forms/GridFieldFetchButton.php
public function getHTMLFragments($gridField)
    {
        //Disable button if there is already a job running, and add a class to the progress button to trigger the display
        $jobs = FetchJob::get()->filter(['Status:not' => ['Done', 'Error']]);
        $current = $jobs->First();
        $global = $current && $current->ToFetch === "*" ? "global-fetch" : "";
        $disabled = $jobs->Count() > 0 ? "disabled" : "";
        $running = $jobs->Count() > 0 ? "hail-fetch-running" : "";
        $active = $jobs->Count() > 0 ? "state-active" : "";
        $vd = new ViewableData();
        $rendered = $vd
            ->customise([
                'Disabled' => $disabled,
                'Running' => $running,
                'Active' => $active,
                'Global' => $global,
            ])
            ->renderWith('GridFieldFetchButton')
            ->getValue();

        return [
            $this->targetFragment => $rendered,
        ];
    }
public function getHTMLFragments($gridField)
    {
        //Disable button if there is already a job running, and add a class to the progress button to trigger the display
        $jobs = FetchJob::get()->filter(['Status:not' => ['Done', 'Error']]);
        $current = $jobs->First();
        $global = $current && $current->ToFetch === "*" ? "global-fetch" : "";
        $disabled = $jobs->Count() > 0 ? "disabled" : "";
        $running = $jobs->Count() > 0 ? "hail-fetch-running" : "";
        $active = $jobs->Count() > 0 ? "state-active" : "";
        $vd = new ViewableData();
        $rendered = $vd
            ->customise([
                'Disabled' => $disabled,
                'Running' => $running,
                'Active' => $active,
                'Global' => $global,
            ])
            ->renderWith('GridFieldFetchButton')
            ->getValue();

        return [
            $this->targetFragment => $rendered,
        ];
    }
public function getHTMLFragments ( $ gridField ) { //Disable button if there is already a job running, and add a class to the progress button to trigger the display $ jobs = FetchJob :: get ( ) -> filter ( [ 'Status:not' => [ 'Done' , 'Error' ] ] ) ; $ current = $ jobs -> First ( ) ; $ global = $ current && $ current -> ToFetch === "*" ? "global-fetch" : "" ; $ disabled = $ jobs -> Count ( ) > 0 ? "disabled" : "" ; $ running = $ jobs -> Count ( ) > 0 ? "hail-fetch-running" : "" ; $ active = $ jobs -> Count ( ) > 0 ? "state-active" : "" ; $ vd = new ViewableData ( ) ; $ rendered = $ vd -> customise ( [ 'Disabled' => $ disabled , 'Running' => $ running , 'Active' => $ active , 'Global' => $ global , ] ) -> renderWith ( 'GridFieldFetchButton' ) -> getValue ( ) ; return [ $ this -> targetFragment => $ rendered , ] ; }
Returns the Fetch Button html

@param GridField $gridField
@return array
Returns the Fetch Button html