Form Theme Block Naming & Creating our Theme!
…Instead, open form_div_layout.html.twig and find the block there. Copy
that and, in register.html.twig, paste this anywhere.
Hmm - let's remove the wrapping
and see if this works! Deep breath - refresh!
I saw something move! Inspect the form and..…
Tags, Compiler Passes & Other Nerdery
…it can! But we need to set this up in our bundle. Open the extension
class, go anywhere in the load() method, and add
$container->registerForAutoconfiguration(WordProviderInterface::class). The feature
that automatically adds tags is called autoconfiguration, and this method returns
a "template" Definition object…
New Component to Hold our Form
…Now that we have a proper class, we don't need to put
handleFormSubmit() inside of render() anymore. Nope, we can access the props
from anywhere as this.props.
So, copy that function & the const, paste it in the class, turn it into a property,…
Handling 404's + other Errors
…It's so nice when things work.
What we just did is huge. If a 404 exception is thrown anywhere in the system,
it'll map to the nice Api Problem format we want. In fact, if any exception is
thrown it ends up with…
Global RESTful Exception Handling
…name. And we don't need to have
a return statement anymore: just call the function and it'll throw the exception
for us:
Re-test everything:
Now we're green and we can send back exciting error responses from anywhere in our
code. But…
HttpKernel::handle() The Heart of Everything
…thing to take-away here is that there is a try-catch block. This means that
if you throw an exception from anywhere inside your application - like a
controller or a service - it’s going to get caught by this block. And when
that happens…
Customizing Error Pages and How Errors are Handled
…an exception happens.
We haven’t talked about events yet, but this basically means that if you
want, you can be nofitied whenever an exception is thrown anywhere in your
code. Why would you do this? You might want to do some extra logging or…
Twig
…s added automatically to any page
that has a valid HTML structure. That's why we didn't see it until we extended
the layout file.
Click anywhere on it to multiply the amount of information it gives you by
100! This is the profiler…
Introduction
…First, download Selenium Server,
which is just a jar file that can live anywhere on your computer. Start
Selenium at the command line by running java -jar followed by the filename.
$ java -jar selenium-server-standalone-2.28.0.jar
Now for the magic…
Block Plugins
…the page...
absolutely nothing happens! We added those options... but we're not using them
anywhere yet. We need to override a template to do that.
Let's think: we want this top and bottom margin to apply to every block in the
system. And…
Frontend Item View
…or, in a little while, we could choose to manually
select the exact recipes to show. We can also now embed lists and grids of
recipes anywhere we want on the site.
To celebrate, remove the entire latest_recipes Twig block:
And, up in MainController…
Creating & Mapping Layouts
…Until we actually
included {% block layout %} in base.html.twig, the layout was loading...
we just weren't rendering it anywhere.
The takeaway is this: if you're on a page that does not map to a layout, everything
is exactly the same as always…
Enhanced Docker Integration & Testing Emails
…Refresh, add a fake email address, register, and... it worked! Of course, it didn't
send the email anywhere... but we can still see, more or less, what the email would
look like.
How? Click any link to go into the Profiler, click "Last 10"…
The Entry Point: Inviting Users to Log In
…words:
it's making us choose.
Copy the entry_point key... then, anywhere under the firewall, say
entry_point: and then point to the LoginFormAuthenticator service:
Technically we can point to any service that implements
AuthenticationEntryPointInterface... but usually I put that in my authenticator.
Now..…
Customize Error Messages & Adding Logout
…intercept that request, log out the user,
and redirect them somewhere else.
To activate that magic, open up config/packages/security.yaml. Anywhere under our
firewall, add logout: true:
Internally, this activates a "listener" that looks for any requests to /logout.
And actually, instead of…
Autowiring Dependencies into a Service
…is something that we're gonna to do over and over again. The benefit is
that we now have a beautiful service - a tool - that we can use from anywhere in
our app. We pass it the markdown string and it takes care of the…
Passing Props vs Fetching Directly
…talk about that in
our Vue 3 tutorial.
Anyways, in this situation, because categories is boring and static, it
doesn't really need to live as data anywhere. And that means, we do not need
to pass it down as props. If we want to…
x
517