Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7445561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:51:56+00:00 2026-05-29T11:51:56+00:00

I am trying to change the template for the registration form in my application

  • 0

I am trying to change the template for the registration form in my application so that I can add some other HTML to it. Here is the /My/UserBundle/Resources/views/Registration/register.html.twig file:

{% extends "MyUserBundle::layout.html.twig" %}

{% block fos_user_content %}
<section class="register site-content">
    <header>
        <h1>{{ 'layout.register'|trans({}, 'FOSUserBundle') }}</h1>
    </header>
    <div class="block">
        {% include "FOSUserBundle:Registration:register_content.html.twig" %}
    </div>
</section>
{% endblock fos_user_content %}

And I have successfully overridden the layout.html.twig:

{% extends 'MyMainBundle::layout.html.twig' %}

{% block title %}{{ site_name }}{% endblock %}

{% block content %}
    {% for key, message in app.session.getFlashes() %}
    <div class="{{ key }}">
        {{ message|trans({}, 'FOSUserBundle') }}
    </div>
    {% endfor %}
    {% block fos_user_content %}{% endblock %}
{% endblock %}

as well as form.html.twig:

{% extends 'FOSUserBundle::form.html.twig' %}

{% block field_row %}
    <li class="form_row">
        {{ form_label(form) }}
        {{ form_errors(form) }}
        {{ form_widget(form) }}
    </li>
{% endblock field_row %}

{% block form_widget %}
    <ul {{ block('container_attributes') }}>
        {{ block('field_rows') }}
        {{ form_rest(form) }}
    </ul>
{% endblock form_widget %}

config parts:

# FOS User Configuration
fos_user:
    db_driver: orm
    firewall_name: main
    user_class: My\UserBundle\Entity\User
    from_email:
      address: %admin_email%
      sender_name: %site_name%
    template:
      engine: twig
      theme: MyUserBundle::form.html.twig

I have cleared my cache.

Whenever I go to

http://localhost/register/

apache just hangs until it times out.

The best I can figure out, is the PHP maximum execution message says it crashes on a twig template in the cache on line 16. That line is function doGetParent(...) The file is:

<?php

/* FOSUserBundle::form.html.twig */
class __TwigTemplate_9cf68a2af1db50466c556a735bcdeba0 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->blocks = array(
            'field_row' => array($this, 'block_field_row'),
            'form_widget' => array($this, 'block_form_widget'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "FOSUserBundle::form.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->getParent($context)->display($context, array_merge($this->blocks, $blocks));
    }

    // line 3
    public function block_field_row($context, array $blocks = array())
    {
        // line 4
        echo "    <li class=\"form_row\">
        ";
        // line 5
        echo $this->env->getExtension('form')->renderLabel($this->getContext($context, "form"));
        echo "
        ";
        // line 6
        echo $this->env->getExtension('form')->renderErrors($this->getContext($context, "form"));
        echo "
        ";
        // line 7
        echo $this->env->getExtension('form')->renderWidget($this->getContext($context, "form"));
        echo "
    </li>
";
    }

    // line 11
    public function block_form_widget($context, array $blocks = array())
    {
        // line 12
        echo "    <ul ";
        $this->displayBlock("container_attributes", $context, $blocks);
        echo ">
        ";
        // line 13
        $this->displayBlock("field_rows", $context, $blocks);
        echo "
        ";
        // line 14
        echo $this->env->getExtension('form')->renderRest($this->getContext($context, "form"));
        echo "
    </ul>
";
    }

    public function getTemplateName()
    {
        return "FOSUserBundle::form.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }
}

It has also timed out on \vendor\twig\lib\Twig\Template.php on line 65 Which is public function getParent(array $context)

So clearly there is some problem with getParent but I don’t know what that means or how to fix it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:51:57+00:00Added an answer on May 29, 2026 at 11:51 am

    According to the FOSUserBundle documentation:

    The easiest way to override a bundle’s template is to simply place a
    new one in your app/Resources folder. To override the layout template
    located at Resources/views/layout.html.twig in the FOSUserBundle
    directory, you would place you new layout template at
    app/Resources/FOSUserBundle/views/layout.html.twig.

    As you can see the pattern for overriding templates in this way is to
    create a folder with the name of the bundle class in the app/Resources
    directory. Then add your new template to this folder, preserving the
    directory structure from the original bundle.

    In my project I override FOSUserBundle’s layout as they said and it’s work like a charm.

    So doing it at the same way you will need to create app/Resources/FOSUserBundle/views/Registration/register.html.twig. (or the form you want to override)

    EDIT

    Ok, I just realize that you’ve chosen to extend the FOSUserBundle. In that case instead of app/Resources/ you need to do it inside your bundle. But you don’t need to put

    {% extends 'FOSUserBundle::form.html.twig' %}
    

    The FOSUserBundle will detect that you are overriding the bundle and will be extended automatically.

    And you also need to tell your bundle that FOSUserBundle is its parent.

    class YourBundle extends Bundle
    {
        public function getParent()
        {
            return 'FOSUserBundle';
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to include some CSS and JS files into the change form of
I'm trying to change the back end post listing template for a custom post
im trying to change font globally for whole application, the problem is, i am
I'm trying to change some text in a .CSV file. StreamReader sReader = new
I was trying to change some parts of a joomla plugin, when I faced
I'm trying to change the color of a DataGridTextColumn. Here's what I'm doing: <DataGridTextColumn
I'm trying to change the borders in the style sheet of the template on
I am trying to change page on a form submit in Jquery, however, it
In the master-detail application template (using ARC, storyboards) in XCode 4.3.2, I am trying
I am trying to change the template folder location is there anyway off doing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.