Skip to content

Commit

Permalink
Merge pull request #635 from jockri/override-pagepartwidget-template
Browse files Browse the repository at this point in the history
[PagePartBundle] Make it possible to override the twig template for a custom PagePartWidget
  • Loading branch information
Roderik van der Veer committed Aug 18, 2015
2 parents e40b4e4 + d5ef39e commit 728f09e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(array $types = array(), array $data = array())
$this->types = $types;
$this->data = $data;

$this->template = 'KunstmaanAdminBundle:FormWidgets\FormWidget:widget.html.twig';
$this->setTemplate('KunstmaanAdminBundle:FormWidgets\FormWidget:widget.html.twig');
}

/**
Expand Down
17 changes: 2 additions & 15 deletions src/Kunstmaan/PagePartBundle/Helper/FormWidgets/PagePartWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Kunstmaan\PagePartBundle\Helper\FormWidgets;

use Doctrine\ORM\EntityManager;

use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormBuilderInterface;
Expand All @@ -15,12 +14,8 @@
use Kunstmaan\PagePartBundle\PagePartAdmin\AbstractPagePartAdminConfigurator;
use Kunstmaan\PagePartBundle\Helper\HasPagePartsInterface;

/**
* PagePartWidget
*/
class PagePartWidget extends FormWidget
{

/**
* @var AbstractPagePartAdminConfigurator
*/
Expand Down Expand Up @@ -57,7 +52,7 @@ class PagePartWidget extends FormWidget
protected $request;

/**
* @param HasNodeInterface $page The page
* @param HasPagePartsInterface $page The page
* @param Request $request The request
* @param EntityManager $em The entity manager
* @param AbstractPagePartAdminConfigurator $pagePartAdminConfigurator The page part admin configurator
Expand All @@ -76,6 +71,7 @@ public function __construct(HasPagePartsInterface $page, Request $request, Entit
$this->request = $request;

$this->pagePartAdmin = $pagePartAdminFactory->createList($pagePartAdminConfigurator, $em, $page, null);
$this->setTemplate('KunstmaanPagePartBundle:FormWidgets\PagePartWidget:widget.html.twig');
}

/**
Expand Down Expand Up @@ -127,14 +123,6 @@ public function getFormErrors(FormView $formView)
return $errors;
}

/**
* @return string
*/
public function getTemplate()
{
return 'KunstmaanPagePartBundle:FormWidgets\PagePartWidget:widget.html.twig';
}

/**
* @return PagePartAdmin
*/
Expand All @@ -158,5 +146,4 @@ public function getExtraParams(Request $request)

return $params;
}

}

0 comments on commit 728f09e

Please sign in to comment.