/** * Renders share buttons bar template based on user settings. * * @param \Twig_Environment $twigEnvironment * @param array $options * @param string[] $providers * * @return string */ public function showShareButtons(Twig_Environment $twigEnvironment, array $options = array(), array $providers = array()) { $this->shareButtonsRenderer->setTemplateEngine($twigEnvironment); if (isset($providers)) { $options['providers'] = $providers; } if (!isset($options['template'])) { $options['template'] = $this->configResolver->getParameter('template', 'ez_share_buttons'); } return $twigEnvironment->render(sprintf('EzSystemsShareButtonsBundle::%s.html.twig', $options['template']), array('shareButtons' => $this->shareButtonsRenderer->render($options))); }
/** * Renders share buttons bar template based on user settings. * * @param \Twig_Environment $twigEnvironment * @param array $options * @param string[] $providers * @return string * * @throws \InvalidArgumentException if template was not found */ public function showShareButtons(Twig_Environment $twigEnvironment, array $options = array(), array $providers = array()) { $this->shareButtonsRenderer->setTemplateEngine($twigEnvironment); if (isset($providers)) { $options['providers'] = $providers; } if (!isset($options['template'])) { $options['template'] = $this->configResolver->getParameter('template', 'ez_share_buttons'); } if (!file_exists(sprintf('%s/../../Resources/views/%s.html.twig', __DIR__, $options['template']))) { throw new InvalidArgumentException(sprintf('Template with name `%s.html.twig` was not found in views directory of EzSystemsShareButtonBundle.', $options['template'])); } return $twigEnvironment->render(sprintf('@EzSystemsShareButtonsBundle/Resources/views/%s.html.twig', $options['template']), array('shareButtons' => $this->shareButtonsRenderer->render($options))); }