本文整理汇总了PHP中Mautic\CoreBundle\Factory\MauticFactory::getMauticBundles方法的典型用法代码示例。如果您正苦于以下问题:PHP MauticFactory::getMauticBundles方法的具体用法?PHP MauticFactory::getMauticBundles怎么用?PHP MauticFactory::getMauticBundles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mautic\CoreBundle\Factory\MauticFactory
的用法示例。
在下文中一共展示了MauticFactory::getMauticBundles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('site_url', 'text', array('label' => 'mautic.core.config.form.site.url', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.site.url.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('webroot', 'page_list', array('label' => 'mautic.core.config.form.webroot', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.webroot.tooltip', 'data-placeholder' => $this->factory->getTranslator()->trans('mautic.core.config.form.webroot.dashboard')), 'multiple' => false, 'empty_value' => '', 'required' => false));
$builder->add('cache_path', 'text', array('label' => 'mautic.core.config.form.cache.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cache.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('log_path', 'text', array('label' => 'mautic.core.config.form.log.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.log.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('image_path', 'text', array('label' => 'mautic.core.config.form.image.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.image.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('theme', 'theme_list', array('label' => 'mautic.core.config.form.theme', 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.form.template.help')));
// Get the list of available languages
/** @var \Mautic\CoreBundle\Helper\LanguageHelper $languageHelper */
$languageHelper = $this->factory->getHelper('language');
$languages = $languageHelper->fetchLanguages(false, false);
$langChoices = array();
foreach ($languages as $code => $langData) {
$langChoices[$code] = $langData['name'];
}
$langChoices = array_merge($langChoices, $this->factory->getParameter('supported_languages'));
// Alpha sort the languages by name
asort($langChoices);
$builder->add('locale', 'choice', array('choices' => $langChoices, 'label' => 'mautic.core.config.form.locale', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.locale.tooltip'), 'empty_value' => false));
$arrayStringTransformer = new ArrayStringTransformer();
$builder->add($builder->create('trusted_hosts', 'text', array('label' => 'mautic.core.config.form.trusted.hosts', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.trusted.hosts.tooltip'), 'required' => false))->addViewTransformer($arrayStringTransformer));
$builder->add($builder->create('trusted_proxies', 'text', array('label' => 'mautic.core.config.form.trusted.proxies', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.trusted.proxies.tooltip'), 'required' => false))->addViewTransformer($arrayStringTransformer));
$arrayLinebreakTransformer = new ArrayLinebreakTransformer();
$builder->add($builder->create('do_not_track_ips', 'textarea', array('label' => 'mautic.core.config.form.do_not_track_ips', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.do_not_track_ips.tooltip'), 'required' => false))->addViewTransformer($arrayLinebreakTransformer));
$builder->add('rememberme_key', 'text', array('label' => 'mautic.core.config.form.rememberme.key', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.key.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('rememberme_lifetime', 'text', array('label' => 'mautic.core.config.form.rememberme.lifetime', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.lifetime.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('rememberme_path', 'text', array('label' => 'mautic.core.config.form.rememberme.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('rememberme_domain', 'text', array('label' => 'mautic.core.config.form.rememberme.domain', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.domain.tooltip'), 'required' => false));
$builder->add('default_pagelimit', 'choice', array('choices' => array(5 => 'mautic.core.pagination.5', 10 => 'mautic.core.pagination.10', 15 => 'mautic.core.pagination.15', 20 => 'mautic.core.pagination.20', 25 => 'mautic.core.pagination.25', 30 => 'mautic.core.pagination.30', 50 => 'mautic.core.pagination.50', 100 => 'mautic.core.pagination.100'), 'expanded' => false, 'multiple' => false, 'label' => 'mautic.core.config.form.default.pagelimit', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.default.pagelimit.tooltip'), 'required' => false, 'empty_value' => false));
$builder->add('default_timezone', 'timezone', array('label' => 'mautic.core.config.form.default.timezone', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.default.timezone.tooltip'), 'multiple' => false, 'empty_value' => 'mautic.user.user.form.defaulttimezone', 'required' => false));
$builder->add('date_format_full', 'text', array('label' => 'mautic.core.config.form.date.format.full', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.full.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('date_format_short', 'text', array('label' => 'mautic.core.config.form.date.format.short', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.short.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('date_format_dateonly', 'text', array('label' => 'mautic.core.config.form.date.format.dateonly', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.dateonly.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('date_format_timeonly', 'text', array('label' => 'mautic.core.config.form.date.format.timeonly', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.timeonly.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
// Search for IP Services
$bundles = $this->factory->getMauticBundles(true);
$choices = array();
foreach ($bundles as $bundle) {
if (isset($bundle['config']['ip_lookup_services'])) {
foreach ($bundle['config']['ip_lookup_services'] as $service => $details) {
$choices[$service] = $details['display_name'];
}
}
}
natcasesort($choices);
$builder->add('ip_lookup_service', 'choice', array('choices' => $choices, 'label' => 'mautic.core.config.form.ip.lookup.service', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.ip.lookup.service.tooltip')));
$builder->add('ip_lookup_auth', 'text', array('label' => 'mautic.core.config.form.ip.lookup.auth', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.ip.lookup.auth.tooltip'), 'required' => false));
$builder->add('transifex_username', 'text', array('label' => 'mautic.core.config.form.transifex.username', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.transifex.username.tooltip', 'autocomplete' => 'off'), 'required' => false));
$builder->add('transifex_password', 'password', array('label' => 'mautic.core.config.form.transifex.password', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'placeholder' => 'mautic.user.user.form.passwordplaceholder', 'preaddon' => 'fa fa-lock', 'tooltip' => 'mautic.core.config.form.transifex.password.tooltip', 'autocomplete' => 'off'), 'required' => false));
$builder->add('update_stability', 'choice', array('choices' => array('alpha' => 'mautic.core.config.update_stability.alpha', 'beta' => 'mautic.core.config.update_stability.beta', 'rc' => 'mautic.core.config.update_stability.rc', 'stable' => 'mautic.core.config.update_stability.stable'), 'label' => 'mautic.core.config.form.update.stability', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.update.stability.tooltip'), 'empty_value' => false));
$builder->add('cookie_path', 'text', array('label' => 'mautic.core.config.form.cookie.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cookie.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('cookie_domain', 'text', array('label' => 'mautic.core.config.form.cookie.domain', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cookie.domain.tooltip'), 'required' => false));
$builder->add('cookie_secure', 'yesno_button_group', array('label' => 'mautic.core.config.form.cookie.secure', 'empty_value' => 'mautic.core.form.default', 'data' => array_key_exists('cookie_secure', $options['data']) && !empty($options['data']['cookie_secure']) ? true : false, 'attr' => array('tooltip' => 'mautic.core.config.form.cookie.secure.tooltip')));
$builder->add('cookie_httponly', 'yesno_button_group', array('label' => 'mautic.core.config.form.cookie.httponly', 'data' => array_key_exists('cookie_httponly', $options['data']) && !empty($options['data']['cookie_httponly']) ? true : false, 'attr' => array('tooltip' => 'mautic.core.config.form.cookie.httponly.tooltip')));
}
示例2: load
/**
* {@inheritdoc}
*/
public function load($resource, $locale, $domain = 'messages')
{
$bundles = $this->factory->getMauticBundles(true);
$catalogue = new MessageCatalogue($locale);
//Bundle translations
foreach ($bundles as $name => $bundle) {
//load translations
$translations = $bundle['directory'] . '/Translations/' . $locale;
if (file_exists($translations)) {
$iniFiles = new Finder();
$iniFiles->files()->in($translations)->name('*.ini');
foreach ($iniFiles as $file) {
$this->loadTranslations($catalogue, $locale, $file);
}
}
}
//Theme translations
$themeDir = $this->factory->getSystemPath('current_theme', true);
if (file_exists($themeTranslation = $themeDir . '/translations/' . $locale)) {
$iniFiles = new Finder();
$iniFiles->files()->in($themeTranslation)->name('*.ini');
foreach ($iniFiles as $file) {
$this->loadTranslations($catalogue, $locale, $file);
}
}
//3rd Party translations
$translationsDir = $this->factory->getSystemPath('translations', true) . '/' . $locale;
if (file_exists($translationsDir)) {
$iniFiles = new Finder();
$iniFiles->files()->in($translationsDir)->name('*.ini');
foreach ($iniFiles as $file) {
$this->loadTranslations($catalogue, $locale, $file);
}
}
//Overrides
$overridesDir = $this->factory->getSystemPath('translations', true) . '/overrides/' . $locale;
if (file_exists($overridesDir)) {
$iniFiles = new Finder();
$iniFiles->files()->in($overridesDir)->name('*.ini');
foreach ($iniFiles as $file) {
$this->loadTranslations($catalogue, $locale, $file);
}
}
return $catalogue;
}
示例3: buildRoute
/**
* Get routing from bundles and add to Routing event
*
* @param MauticEvents\RouteEvent $event
*
* @return void
*/
protected function buildRoute(MauticEvents\RouteEvent $event)
{
$type = $event->getType();
$bundles = $this->factory->getMauticBundles(true);
$collection = $event->getCollection();
foreach ($bundles as $bundle) {
if (!empty($bundle['config']['routes'][$type])) {
foreach ($bundle['config']['routes'][$type] as $name => $details) {
// Set defaults and controller
$defaults = !empty($details['defaults']) ? $details['defaults'] : array();
if (isset($details['controller'])) {
$defaults['_controller'] = $details['controller'];
}
if (isset($details['format'])) {
$defaults['_format'] = $details['format'];
} elseif ($type == 'api') {
$defaults['_format'] = 'json';
}
$method = '';
if (isset($details['method'])) {
$method = $details['method'];
} elseif ($type === 'api') {
$method = 'GET';
}
// Set requirements
$requirements = !empty($details['requirements']) ? $details['requirements'] : array();
// Set some very commonly used defaults and requirements
if (strpos($details['path'], '{page}') !== false) {
if (!isset($defaults['page'])) {
$defaults['page'] = 1;
}
if (!isset($requirements['page'])) {
$requirements['page'] = '\\d+';
}
}
if (strpos($details['path'], '{objectId}') !== false) {
if (!isset($defaults['objectId'])) {
// Set default to 0 for the "new" actions
$defaults['objectId'] = 0;
}
if (!isset($requirements['objectId'])) {
// Only allow alphanumeric for objectId
$requirements['objectId'] = "[a-zA-Z0-9_]+";
}
}
if ($type == 'api' && strpos($details['path'], '{id}') !== false) {
if (!isset($requirements['page'])) {
$requirements['id'] = '\\d+';
}
}
// Add the route
$collection->add($name, new Route($details['path'], $defaults, $requirements, [], '', [], $method));
}
}
}
}
示例4: buildRoute
/**
* Get routing from bundles and add to Routing event
*
* @param MauticEvents\RouteEvent $event
* @param string $name
*
* @return void
*/
protected function buildRoute(MauticEvents\RouteEvent $event)
{
$type = $event->getType();
$bundles = $this->factory->getMauticBundles(true);
$collection = $event->getCollection();
foreach ($bundles as $bundle) {
if ($bundle['isAddon'] && !$this->addonHelper->isEnabled($bundle['bundle'])) {
continue;
}
if (!empty($bundle['config']['routes'][$type])) {
foreach ($bundle['config']['routes'][$type] as $name => $details) {
// Set defaults and controller
$defaults = !empty($details['defaults']) ? $details['defaults'] : array();
if (isset($details['controller'])) {
$defaults['_controller'] = $details['controller'];
}
if (isset($details['format'])) {
$defaults['_format'] = $details['format'];
} elseif ($type == 'api') {
$defaults['_format'] = 'json';
}
// Set requirements
$requirements = !empty($details['requirements']) ? $details['requirements'] : array();
if (isset($details['method'])) {
$requirements['_method'] = $details['method'];
} elseif ($type == 'api') {
$requirements['_method'] = 'GET';
}
// Set some very commonly used defaults and requirements
if (strpos($details['path'], '{page}') !== false) {
if (!isset($defaults['page'])) {
$defaults['page'] = 1;
}
if (!isset($requirements['page'])) {
$requirements['page'] = '\\d+';
}
}
if (strpos($details['path'], '{objectId}') !== false) {
if (!isset($defaults['objectId'])) {
$defaults['objectId'] = 0;
}
}
if ($type == 'api' && strpos($details['path'], '{id}') !== false) {
if (!isset($requirements['page'])) {
$requirements['id'] = '\\d+';
}
}
// Add the route
$collection->add($name, new Route($details['path'], $defaults, $requirements));
}
}
}
}
示例5: getParametersFromConfig
/**
* @param $bundle
*
* @return array
*/
public function getParametersFromConfig($bundle)
{
static $allBundles;
if (empty($allBundles)) {
$allBundles = $this->factory->getMauticBundles(true);
}
if (isset($allBundles[$bundle]) && $allBundles[$bundle]['config']['parameters']) {
return $allBundles[$bundle]['config']['parameters'];
} else {
return array();
}
}