Phoenix 1.7 - use Phoenix.Controller, layouts. Is the the :app layout used by default?

Hi everyone,
I’m currently diving into Elixir and Phoenix, trying to grasp the inner workings of the framework. During my exploration, I came across the generated MyAppWeb module, particularly these two functions:

def controller do
  quote do
    use Phoenix.Controller,
      formats: [:html, :json],
      layouts: [html: MyAppWeb.Layouts]

    import Plug.Conn
    import MyAppWeb.Gettext


def live_view do
  quote do
    use Phoenix.LiveView,
      layout: {MyAppWeb.Layouts, :app}


As far as I understand, these functions define common functionalities for controllers and live views. However, what puzzles me is the difference between use Phoenix.Controller, layouts: [html: MyAppWeb.Layouts] and use Phoenix.LiveView, layout: {MyAppWeb.Layouts, :app}.

In the live_view function, we pass an :app atom to specify which function should be called in the layouts module right? However, in the controller function, there’s no such specification. How do controllers know to call Is it passed by default?

I’d appreciate any insights or explanations on this matter. Thank you!



Thank you!
By looking at the code that you linked, I observed that it appears feasible to pass a {format, {mod, template}} tuple to override the default :app atom. However, I’m uncertain if this behavior is documented anywhere. I attempted to find clarification in the docs, but unfortunately, they seem ambiguous to me.