Giter Club home page Giter Club logo

silverstripe-fail-whale's Issues

Slightly simplify ErrorDocument::render() call to renderWith()

Is there a reason why ErrorDocument::render() calls renderWith() with two slightly different signatures? In the PageController block the call includes $this as the second argument, the other call doesn't. If that's not intentional maybe renderWith() could just be called once for both cases? In that case we also just have to add the fallback template once.

        if (class_exists(\PageController::class)) {
            ...
        }

        $templatesFound[] = [ Controller::class ];

        return $controller->renderWith(array_merge(...$templatesFound), $this);

Error on dev/build if templates don’t exist

None of the following templates could be found: Array ( [0] => Bigfork\SilverStripeFailWhale\Model\ErrorDocument_404...

Ideal outcome: display a warning on the dev/build output instead... if feasible

Templates-not-found warning if no (custom) themes defined

Screenshot 2022-06-25 at 15 44 29

I'd propose to append the framework Controller template to the array in order to fallback to that if nothing else found (like the framework does).

ErrorDocument::render():

            ...
            $templatesFound[] = $page->getViewerTemplates();

            // Fallback to framework template in case no themes defined (prevent template-not-found warning)
            $templatesFound[] = [ Controller::class ];

It would seem we'd need to include that twice, once for if PageController exists and once if not;

        if (class_exists(\PageController::class)) {
            ...
            $templatesFound[] = [ Controller::class ];

            return $controller->renderWith(array_merge(...$templatesFound), $this);
        }

        $templatesFound[] = [ Controller::class ];

        return $this->renderWith(array_merge(...$templatesFound));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.