Jump to content

Admin template override not found


Recommended Posts

Hello guys,

 

I am trying to create a custom Grid ColumnType. But I have an error explaining symfony can't find my new template inside my module's code. (An exception has been thrown during the rendering of a template ("Content template for column type "likes" was not found")).

 

But the thing is, it works fine locally, but not on my remote test server. I tried to clear cache but can't manage to make it work over there. When I manually return :

"return '@Modules/mymodule/views/Prestashop/Admin/Common/Grid/Columns/Content/likes.html.twig';" in GridExtension::getTemplatePath() it works...

I don't understand what's going on, why twig can't find my override ?

 

namespace XXXX\YYY\Grid\Column\Type\Common;

use PrestaShop\PrestaShop\Core\Grid\Column\AbstractColumn;
use Symfony\Component\OptionsResolver\OptionsResolver;

final class LikesColumn extends AbstractColumn
{
    /**
     * {@inheritdoc}
     */
    public function getType()
    {
        return 'likes';
    }

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver
            ->setRequired([
                'field',
            ])
            ->setDefaults([
                'clickable' => true,
            ])
            ->setAllowedTypes('field', 'string')
        ;
    }
}

 

in: /modules/mymodule/views/Prestashop/Admin/Common/Grid/Columns/Content/likes.html.twig

<div class="col-md-6">
  <i class="material-icons">favorite</i> {{ record[column.options.field] }}
</div>

 

 

 

 

Edited by Archalia (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More