コード例 #1
0
 /**
  * Get a array with all addthis_share values.
  *
  * Allow alter through 'addthis_configuration_share'.
  *
  * @todo Add static cache.
  *
  * @todo Make the adding of configuration dynamic.
  *   SRP is lost here.
  */
 public function getAddThisShareConfig()
 {
     $configuration = $this->getAddThisConfig();
     if (isset($configuration['templates'])) {
         $addthis_share = ['templates' => $configuration['templates']];
     }
     $addthis_share['templates']['twitter'] = $this->config_factory->get('addthis.settings')->get('third_party.addthis_twitter_template');
     //drupal_alter('addthis_configuration_share', $configuration);
     return $addthis_share;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function getCssIncludePath()
 {
     if ($include_path = $this->configFactory->get('printable.settings')->get('css_include')) {
         if ($token = $this->extractCssIncludeToken($include_path)) {
             list(, $theme) = explode(':', trim($token, '[]'));
             $include_path = str_replace($token, $this->getThemePath($theme), $include_path);
         }
         return $include_path;
     }
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function getPrintableEntities()
 {
     $compatible_entities = $this->getCompatibleEntities();
     $entities = array();
     foreach ($this->configFactory->get('printable.settings')->get('printable_entities') as $entity_type) {
         if (isset($compatible_entities[$entity_type])) {
             $entities[$entity_type] = $compatible_entities[$entity_type];
         }
     }
     return $entities;
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function buildLinks(EntityInterface $entity = NULL)
 {
     $links = array();
     $printable_settings = $this->configFactory->get('printable.settings');
     // Build the array of links to be added to the entity.
     foreach ($this->printableFormatManager->getDefinitions() as $key => $definition) {
         $links[$key] = array('title' => $definition['title'], 'url' => Url::fromRoute('printable.show_format.' . $entity->getEntityTypeId(), array('printable_format' => $key, 'entity' => $entity->id())));
         // Add target "blank" if the configuration option is set.
         if ($printable_settings->get('open_target_blank') && ($key == 'print' or !$printable_settings->get('save_pdf'))) {
             $links[$key]['attributes']['target'] = '_blank';
         }
     }
     return $links;
 }
コード例 #5
0
 /**
  * Adds routes to enabled REST resources.
  *
  * @param \Drupal\Core\Routing\RouteBuildEvent $event
  *   The route building event.
  */
 public function dynamicRoutes(RouteBuildEvent $event)
 {
     $collection = $event->getRouteCollection();
     $enabled_resources = $this->config->get('rest.settings')->load()->get('resources');
     // Iterate over all enabled resource plugins.
     foreach ($enabled_resources as $id => $enabled_methods) {
         $plugin = $this->manager->getInstance(array('id' => $id));
         foreach ($plugin->routes() as $route) {
             $operation = $route->getRequirement('_operation');
             if ($operation) {
                 $collection->add("services.{$operation}", $route);
             }
         }
     }
 }
コード例 #6
0
 /**
  * Overrides Mollom::__construct().
  *
  * This class accounts for multiple scenarios:
  * - Straight low-level requests against the testing API from a custom script,
  *   caring for API keys on its own.
  * - Whenever the testing mode is enabled (either through the module's
  *   settings page or by changing the testing_mode system variable),
  *   the client requires valid testing API keys to perform any calls. Testing
  *   API keys are different to production API keys, need to be created first,
  *   and may vanish at any time (whenever the testing API server is
  *   redeployed). Since they are different, the class stores them in different
  *   system variables. Since they can vanish at any time, the class verifies
  *   the keys upon every instantiation, and automatically creates new testing
  *   API keys if necessary.
  * - Some automated unit tests attempt to verify that authentication errors
  *   are handled correctly by the class' error handling. The automatic
  *   creation and recovery of testing API keys would break those assertions,
  *   so said tests can disable the behavior by preemptively setting
  *   $createKeys or the 'mollom.testing_create_keys' state variable to FALSE,
  *   and manually create testing API keys (once).
  *
  * Constructor.
  * @param ConfigFactory $config_factory
  * @param ClientInterface $http_client
  *
  * @see Mollom::__construct().
  */
 public function __construct(ConfigFactory $config_factory, ClientInterface $http_client)
 {
     $this->config = $config_factory->get('mollom.settings');
     // Some tests are verifying the production behavior of e.g. setting up API
     // keys, in which testing mode is NOT enabled and the test creates fake
     // "production" API keys on the local fake server on its own. This special
     // override must only be possible when executing tests.
     // @todo Add global test_info as condition?
     $testing_mode = $this->config->get('test_mode.enabled');
     $module_exists = \Drupal::moduleHandler()->moduleExists('mollom_test_server');
     if ($module_exists && !$testing_mode) {
         // Disable authentication error auto-recovery.
         $this->createKeys = FALSE;
     } else {
         // Do not destroy production variables when testing mode is enabled.
         $this->configuration_map['publicKey'] = 'test_mode.keys.public';
         $this->configuration_map['privateKey'] = 'test_mode.keys.private';
         $this->configuration_map['server'] = 'test_mode.api_endpoint';
     }
     // Load and set publicKey and privateKey configuration values.
     parent::__construct($config_factory, $http_client);
     // Unless pre-set, determine whether API keys should be auto-created.
     if (!isset($this->createKeys)) {
         $this->createKeys = \Drupal::state()->get('mollom.testing_create_keys') ?: TRUE;
     }
     // Testing can require additional time.
     $this->requestTimeout = $this->config->get('connection_timeout_seconds', 3) + 10;
 }
コード例 #7
0
 /**
  * Extracts the links present in HTML string.
  *
  * @param string $content
  *   The HTML of the page to be added.
  *
  * @return string
  *   The HTML string with presence of links dependending on configuration.
  */
 protected function extractLinks($content)
 {
     if ($this->configFactory->get('printable.settings')->get('extract_links')) {
         $rendered_page = $this->linkExtractor->extract($content);
     } else {
         $rendered_page = $this->linkExtractor->removeAttribute($content, 'href');
     }
     return $rendered_page;
 }
コード例 #8
0
 protected function getThemeStatus($theme)
 {
     $defaultTheme = $this->configFactory->get('system.theme')->get('default');
     $status = $theme->status ? $this->trans('commands.theme.debug.messages.installed') : $this->trans('commands.theme.debug.messages.uninstalled');
     if ($defaultTheme == $theme) {
         $status = $this->trans('commands.theme.debug.messages.default-theme');
     }
     return $status;
 }
コード例 #9
0
 /**
  * Creates a render array for the search page.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The request object.
  * @param \Drupal\search\SearchPageInterface $entity
  *   The search page entity.
  *
  * @return array
  *   The search form and search results build array.
  */
 public function view(Request $request, SearchPageInterface $entity)
 {
     $build = array();
     $plugin = $entity->getPlugin();
     // Build the form first, because it may redirect during the submit,
     // and we don't want to build the results based on last time's request.
     if ($request->query->has('keys')) {
         $keys = trim($request->get('keys'));
         $plugin->setSearch($keys, $request->query->all(), $request->attributes->all());
     }
     $build['search_form'] = $this->entityFormBuilder()->getForm($entity, 'search');
     // Build search results, if keywords or other search parameters are in the
     // GET parameters. Note that we need to try the search if 'keys' is in
     // there at all, vs. being empty, due to advanced search.
     $results = array();
     if ($request->query->has('keys')) {
         if ($plugin->isSearchExecutable()) {
             // Log the search.
             if ($this->configFactory->get('search.settings')->get('logging')) {
                 watchdog('search', 'Searched %type for %keys.', array('%keys' => $keys, '%type' => $entity->label()), WATCHDOG_NOTICE);
             }
             // Collect the search results.
             $results = $plugin->buildResults();
         } else {
             // The search not being executable means that no keywords or other
             // conditions were entered.
             drupal_set_message($this->t('Please enter some keywords.'), 'error');
         }
     }
     if (count($results)) {
         $build['search_results_title'] = array('#markup' => '<h2>' . $this->t('Search results') . '</h2>');
     }
     $no_results = t('<ul>
 <li>Check if your spelling is correct.</li>
 <li>Remove quotes around phrases to search for each word individually. <em>bike shed</em> will often show more results than <em>&quot;bike shed&quot;</em>.</li>
 <li>Consider loosening your query with <em>OR</em>. <em>bike OR shed</em> will often show more results than <em>bike shed</em>.</li>
 </ul>');
     $build['search_results'] = array('#theme' => array('item_list__search_results__' . $plugin->getPluginId(), 'item_list__search_results'), '#items' => $results, '#empty' => array('#markup' => '<h3>' . $this->t('Your search yielded no results.') . '</h3>' . $no_results), '#list_type' => 'ol', '#attributes' => array('class' => array('search-results', $plugin->getPluginId() . '-results')), '#cache' => array('tags' => $entity->getCacheTag()));
     $build['pager'] = array('#theme' => 'pager');
     $build['#attached']['library'][] = 'search/drupal.search.results';
     return $build;
 }
コード例 #10
0
 /**
  * Factory method to select the correct Mollom client service.
  *
  * @param ConfigFactory $config_factory
  *   The configuration factory in order to retrieve Mollom settings data.
  * @param ClientInterface $http_client
  *   An http client
  * @return DrupalClientInterface
  */
 public static function createDrupalClient(ConfigFactory $config_factory, ClientInterface $http_client)
 {
     $mollom_settings = $config_factory->get('mollom.settings');
     if (\Drupal::state()->get('mollom.testing_use_local') ?: FALSE) {
         return new DrupalTestLocalClient($config_factory, $http_client);
     } else {
         if ($mollom_settings->get('test_mode.enabled')) {
             return new DrupalTestClient($config_factory, $http_client);
         } else {
             return new DrupalClient($config_factory, $http_client);
         }
     }
 }
コード例 #11
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $configName = $input->getArgument('config-name');
     $editor = $input->getArgument('editor');
     $config = $this->configFactory->getEditable($configName);
     $configSystem = $this->configFactory->get('system.file');
     $temporaryDirectory = $configSystem->get('path.temporary') ?: '/tmp';
     $configFile = $temporaryDirectory . '/config-edit/' . $configName . '.yml';
     $ymlFile = new Parser();
     $fileSystem = new Filesystem();
     if (!$configName) {
         $io->error($this->trans('commands.config.edit.messages.no-config'));
         return;
     }
     try {
         $fileSystem->mkdir($temporaryDirectory);
         $fileSystem->dumpFile($configFile, $this->getYamlConfig($configName));
     } catch (IOExceptionInterface $e) {
         $io->error($this->trans('commands.config.edit.messages.no-directory') . ' ' . $e->getPath());
         return;
     }
     if (!$editor) {
         $editor = $this->getEditor();
     }
     $processBuilder = new ProcessBuilder(array($editor, $configFile));
     $process = $processBuilder->getProcess();
     $process->setTty('true');
     $process->run();
     if ($process->isSuccessful()) {
         $value = $ymlFile->parse(file_get_contents($configFile));
         $config->setData($value);
         $config->save();
         $fileSystem->remove($configFile);
     }
     if (!$process->isSuccessful()) {
         $io->error($process->getErrorOutput());
     }
 }
コード例 #12
0
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $theme = $this->configFactory->get('system.theme')->get('default');
     $themeRegions = \system_region_list($theme, REGIONS_VISIBLE);
     // --module option
     $module = $input->getOption('module');
     if (!$module) {
         // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion
         $module = $this->moduleQuestion($io);
         $input->setOption('module', $module);
     }
     // --class option
     $class = $input->getOption('class');
     if (!$class) {
         $class = $io->ask($this->trans('commands.generate.plugin.block.options.class'), 'DefaultBlock', function ($class) {
             return $this->validator->validateClassName($class);
             return $this->validator->validateClassName($class);
         });
         $input->setOption('class', $class);
     }
     // --label option
     $label = $input->getOption('label');
     if (!$label) {
         $label = $io->ask($this->trans('commands.generate.plugin.block.options.label'), $this->stringConverter->camelCaseToHuman($class));
         $input->setOption('label', $label);
     }
     // --plugin-id option
     $pluginId = $input->getOption('plugin-id');
     if (!$pluginId) {
         $pluginId = $io->ask($this->trans('commands.generate.plugin.block.options.plugin-id'), $this->stringConverter->camelCaseToUnderscore($class));
         $input->setOption('plugin-id', $pluginId);
     }
     // --theme-region option
     $themeRegion = $input->getOption('theme-region');
     if (!$themeRegion) {
         $themeRegion = $io->choiceNoList($this->trans('commands.generate.plugin.block.options.theme-region'), array_values($themeRegions), null, true);
         $themeRegion = array_search($themeRegion, $themeRegions);
         $input->setOption('theme-region', $themeRegion);
     }
     // --services option
     // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion
     $services = $this->servicesQuestion($io);
     $input->setOption('services', $services);
     $output->writeln($this->trans('commands.generate.plugin.block.messages.inputs'));
     // @see Drupal\Console\Command\Shared\FormTrait::formQuestion
     $inputs = $this->formQuestion($io);
     $input->setOption('inputs', $inputs);
 }
コード例 #13
0
 protected function getDirectoryData()
 {
     $systemTheme = $this->configFactory->get('system.theme');
     $themeDefaultDirectory = '';
     $themeAdminDirectory = '';
     try {
         $themeDefault = $this->themeHandler->getTheme($systemTheme->get('default'));
         $themeDefaultDirectory = sprintf('/%s', $themeDefault->getpath());
         $themeAdmin = $this->themeHandler->getTheme($systemTheme->get('admin'));
         $themeAdminDirectory = sprintf('/%s', $themeAdmin->getpath());
     } catch (\Exception $e) {
     }
     $systemFile = $this->configFactory->get('system.file');
     return ['directory' => [$this->trans('commands.site.status.messages.directory_root') => $this->appRoot, $this->trans('commands.site.status.messages.directory_temporary') => $systemFile->get('path.temporary'), $this->trans('commands.site.status.messages.directory_theme_default') => $themeDefaultDirectory, $this->trans('commands.site.status.messages.directory_theme_admin') => $themeAdminDirectory]];
 }
コード例 #14
0
 /**
  * Attach the widget js to the element.
  *
  * @todo Change the scope of the addthis.js.
  *   See if we can get the scope of the addthis.js into the header
  *   just below the settings so that the settings can be used in the loaded
  *   addthis.js of our module.
  *
  * @param array $element
  *   The element to attach the JavaScript to.
  */
 public function attachJsToElement(&$element)
 {
     $config = $this->config_factory->get('addthis.settings');
     $adv_config = $this->config_factory->get('addthis.settings.advanced');
     //Generate AddThisWidgetURL
     $fragment = [];
     $pubid = $config->get('analytics.addthis_profile_id');
     if (isset($pubid) && !empty($pubid) && is_string($pubid)) {
         $fragment[] = 'pubid=' . $pubid;
     }
     if ($adv_config->get('addthis_widget_load_async')) {
         $fragment[] = 'async=1';
     }
     //Always load the script with domready flag.
     $fragment[] = 'domready=1';
     $element['#attached']['library'][] = 'addthis/addthis.widget';
     $addThisConfig = $this->getAddThisConfig();
     $addThisShareConfig = $this->getAddThisShareConfig();
     $options = ['fragment' => implode('&', $fragment), 'external' => TRUE];
     $widget_url = $adv_config->get('addthis_widget_js_url');
     $widgetURL = URL::fromUri($widget_url, $options)->toString();
     $element['#attached']['drupalSettings']['addThisWidget'] = ['widgetScript' => $widgetURL, 'config' => $addThisConfig, 'share' => $addThisShareConfig];
 }
コード例 #15
0
 /**
  * Fetch the paths that should be used when determining when to force
  * anonymous users to login.
  * 
  * @return
  *   An array of paths, keyed by "include", paths that should force a 
  *   login, and "exclude", paths that should be ignored.
  */ 
 public function paths() {  
   // Initialize the paths array.
   $paths = ['include' => [], 'exclude' => []];
   
   // Fetch the stored paths set in the admin settings.
   if ($setting = $this->config_factory->get('anonymous_login.settings')->get('paths')) {
     // Split by each newline.
     $setting = explode("\n", $setting);
 
     // Iterate each path and determine if the path should be included
     // or excluded.
     foreach ($setting as $path) {
       if (substr($path, 0, 1) == '~') {
         $paths['exclude'][] = substr($path, 1);
       }
       else {
         $paths['include'][] = $path;
       }
     }
   }
   
   return $paths;
 }
コード例 #16
0
ファイル: WatchCartoons.php プロジェクト: jmolivas/nettv
 public function getBasicInformation()
 {
     $config = $this->config_factory->get('nettv.basic_information');
     return sprintf('Playlists are sorted by %s and hold %d movies. Movie night is %s. Check out %s for more.', $config->get('playlist.sort'), $config->get('playlist.maxlength'), $config->get('movienight'), \Drupal::l('this website', Url::fromUri($config->get('url'))));
 }
コード例 #17
0
 /**
  * Constructs a new CatalogBreadcrumbBuilder.
  *
  * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
  *   The entity manager.
  * @param \Drupal\Core\Config\ConfigFactory $configFactory
  *   The configuration factory.
  */
 public function __construct(EntityManagerInterface $entity_manager, ConfigFactory $configFactory)
 {
     $this->entityManager = $entity_manager;
     $this->config = $configFactory->get('uc_catalog.settings');
 }
コード例 #18
0
 /**
  * {@inheritdoc}
  */
 public function get($name)
 {
     $result = parent::get($name);
     $this->dataCollector->addConfigName($name);
     return $result;
 }
コード例 #19
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $config = $this->config('addthis.settings');
     //Add our library to the settings form to add in custom CSS.
     $form['#attached']['library'][] = 'addthis/addthis.admin';
     // Visual settings.
     $form['compact_menu'] = array('#type' => 'details', '#title' => t('Compact menu'), '#open' => TRUE, '#description' => '<p>' . t('Configure the global behavior and style of the compact menu and some additional settings related to the interface.') . '</p>', '#description_display' => 'before');
     $form['compact_menu']['menu_style'] = array('#type' => 'details', '#title' => t('Style'), '#open' => FALSE);
     $form['compact_menu']['menu_style']['addthis_co_brand'] = array('#type' => 'textfield', '#title' => t('Branding text'), '#description' => t('Additional branding message to be rendered in the upper-right-hand corner of the compact menus.<br />Should be less than 15 characters in most cases to render properly.'), '#default_value' => $config->get('compact_menu.menu_style.addthis_co_brand'), '#required' => FALSE, '#maxlength' => 15);
     $form['compact_menu']['menu_style']['addthis_ui_header_color'] = array('#type' => 'textfield', '#title' => t('Header text color'), '#default_value' => $config->get('compact_menu.menu_style.addthis_ui_header_color'), '#description' => t('Something like \'#FFFFFF\'.'), '#size' => 8, '#maxlength' => 7, '#required' => FALSE);
     $form['compact_menu']['menu_style']['addthis_ui_header_background_color'] = array('#type' => 'textfield', '#title' => t('Header background color'), '#default_value' => $config->get('compact_menu.menu_style.addthis_ui_header_background_color'), '#description' => t('Something like \'#000000\'.'), '#size' => 8, '#maxlength' => 7, '#required' => FALSE);
     $form['compact_menu']['menu_style']['addthis_click_to_open_compact_menu_enabled'] = array('#type' => 'checkbox', '#title' => t('Open compact menu on click'), '#description' => t('Default behavior is to open compact menu on hover.'), '#default_value' => $config->get('compact_menu.menu_style.addthis_click_to_open_compact_menu_enabled'), '#required' => FALSE);
     $form['compact_menu']['menu_style']['addthis_open_windows_enabled'] = array('#type' => 'checkbox', '#title' => t('Use pop-up windows'), '#description' => t('If checked, all shares will open in a new pop-up window instead of a new tab or regular browser window.'), '#default_value' => $config->get('compact_menu.menu_style.addthis_open_windows_enabled'), '#required' => FALSE);
     $form['compact_menu']['menu_style']['addthis_ui_delay'] = array('#type' => 'textfield', '#title' => t('Menu open delay'), '#description' => t('Delay, in milliseconds, before compact menu appears when mousing over a regular button. Capped at 500 ms.'), '#default_value' => $config->get('compact_menu.menu_style.addthis_ui_delay'), '#required' => FALSE, '#size' => 3, '#maxlength' => 3);
     // Enabled services settings.
     $form['compact_menu']['enabled_services'] = array('#type' => 'details', '#title' => t('Compact menu enabled services'), '#description' => t('The sharing services you select here will be displayed in the compact menu. If you select no services, AddThis will provide a list of frequently used services. This list is updated regularly. <b>Notice that this setting does not define what services should be display in a toolbox.</b>'), '#description_display' => 'before', '#open' => FALSE);
     $add_this_service = \Drupal::service('addthis.addthis');
     $form['compact_menu']['enabled_services']['addthis_enabled_services'] = array('#type' => 'checkboxes', '#title' => t('Enabled services'), '#options' => $add_this_service->getServices(), '#default_value' => $config->get('compact_menu.enabled_services.addthis_enabled_services'), '#required' => FALSE, '#columns' => 3);
     // Additional visual settings.
     $form['compact_menu']['additionals'] = array('#type' => 'details', '#title' => t('Additional configuration'), '#open' => FALSE);
     $form['compact_menu']['additionals']['addthis_standard_css_enabled'] = array('#type' => 'checkbox', '#title' => t('Use standard AddThis stylesheet'), '#description' => t('If not checked, AddThis will not load standard CSS file, allowing you to style everything yourself without incurring the cost of an additional load.'), '#default_value' => $config->get('compact_menu.additionals.addthis_standard_css_enabled'), '#required' => FALSE);
     $form['compact_menu']['additionals']['addthis_508_compliant'] = array('#type' => 'checkbox', '#title' => t('508 compliant'), '#description' => 'If checked, clicking the AddThis button will open a new window to a page that is keyboard navigable.', '#default_value' => $config->get('compact_menu.additionals.addthis_508_compliant'), '#required' => FALSE);
     $form['compact_menu']['additionals']['addthis_addressbook_enabled'] = array('#type' => 'checkbox', '#title' => t('Use addressbook'), '#description' => 'If checked, the user will be able import their contacts from popular webmail services when using AddThis\'s email sharing.', '#default_value' => $config->get('compact_menu.additionals.addthis_addressbook_enabled'), '#required' => FALSE);
     // Excluded Services.
     $form['excluded_services'] = array('#type' => 'details', '#title' => t('Excluded services'), '#description' => t('The sharing services you select here will be excluded from all AddThis menus. This applies globally.'), '#description_display' => 'before', '#open' => FALSE);
     $form['excluded_services']['addthis_excluded_services'] = array('#type' => 'checkboxes', '#title' => t('Excluded services'), '#options' => $add_this_service->getServices(), '#default_value' => $config->get('excluded_services.addthis_excluded_services'), '#required' => FALSE, '#columns' => 3);
     //Analytics settings.
     $profile_id = $config->get('analytics.addthis_profile_id');
     $can_track_clicks = empty($profile_id) ? FALSE : TRUE;
     $form['analytics'] = array('#type' => 'details', '#title' => t('Analytics and Tracking'), '#open' => $can_track_clicks ? TRUE : FALSE);
     if (!$can_track_clicks) {
         $form['analytics']['can_track_notice'] = array('#theme' => 'html_tag', '#tag' => 'div', '#value' => t('For click analytics and statistics you have to provide a ProfileID from <a href="http://www.addthis.com">AddThis.com</a>. Register <a href="https://www.addthis.com/register" targt="_blank">here</a>.'), '#attributes' => array('class' => array('messages', 'warning')));
     }
     $form['analytics']['addthis_profile_id'] = array('#type' => 'textfield', '#title' => t('AddThis ProfileID'), '#default_value' => $config->get('analytics.addthis_profile_id'), '#required' => FALSE, '#size' => 25, '#description' => t('ProfileID at <a href="http://addthis.com/" target="_blank">AddThis.com</a>. Required for statistics.'));
     $form['analytics']['addthis_clickback_tracking_enabled'] = array('#type' => 'checkbox', '#title' => t('Track clickback'), '#description' => 'Check to allow AddThis to append a variable to your URLs upon sharing. AddThis will use this to track how many people come back to your content via links shared with AddThis. Highly recommended. Always global.', '#default_value' => $config->get('analytics.addthis_clickback_tracking_enabled'), '#required' => FALSE);
     // Facebook Like tracking requires a namespace to be added.
     $rdf_enabled = \Drupal::moduleHandler()->moduleExists('rdf');
     if (!$rdf_enabled) {
         $rdf_description = '<span class="admin-disabled">' . t('The RDF module needs to be enabled to support Facebook Like tracking support.<br />Enable the module on <a href="!modules">modules</a> page.', array('!modules' => base_path() . 'admin/modules')) . '</span>';
     } else {
         $rdf_description = t('Check to enable Facebook Like tracking support. Always global.');
     }
     $form['analytics']['title_facebook'] = array('#theme' => 'html_tag', '#tag' => 'div', '#value' => '<b>' . t('Facebook') . '</b>');
     $form['analytics']['facebook_notice'] = array('#theme' => 'html_tag', '#tag' => 'p', '#value' => $rdf_description, '#access' => !$rdf_enabled);
     $form['analytics']['addthis_facebook_like_count_support_enabled'] = array('#type' => 'checkbox', '#title' => t('Enable Facebook Like tracking'), '#description' => Xss::filter($rdf_description, array('span')), '#default_value' => $config->get('analytics.addthis_facebook_like_count_support_enabled'), '#required' => FALSE, '#disabled' => !$rdf_enabled);
     // Google Analytics and Google Social Tracking support.
     $can_do_google_social_tracking = \Drupal::moduleHandler()->moduleExists('google_analytics');
     //@TODO Get back to this.
     $google_analytics_config = $this->config_factory->get('google_analytics.settings');
     $google_analytics_account = $google_analytics_config->get('google_analytics_account');
     $is_google_analytics_setup = $can_do_google_social_tracking && isset($google_analytics_account);
     $form['analytics']['google_analytics'] = array('#type' => 'markup', '#prefix' => '<div>', '#suffix' => '</div>', '#markup' => '<b>' . t('Google Analytics') . '</b>');
     if (!$can_do_google_social_tracking) {
         $form['analytics']['can_do_google_analytics'] = array('#type' => 'markup', '#prefix' => '<p>', '#suffix' => '</p>', '#markup' => '<span class="admin-disabled">' . t('Install/enable the <a href="http://drupal.org/project/google_analytics" target="_blank">Google Analytics</a> module for Social Tracking support.') . '</span>');
     } elseif ($can_do_google_social_tracking && !$is_google_analytics_setup) {
         $form['analytics']['can_do_google_analytics'] = array('#type' => 'markup', '#prefix' => '<p>', '#suffix' => '</p>', '#value' => '<span class="admin-disabled">' . t('Configure the Google Analytics module correctly with the account code to use this feature.') . '</span>');
     }
     $form['analytics']['addthis_google_analytics_tracking_enabled'] = array('#type' => 'checkbox', '#title' => t('Track with Google Analytics'), '#description' => t('Check to track shares in your Google Analytics account reports (<a href="http://www.addthis.com/help/google-analytics-integration">more info</a>). Always global.'), '#default_value' => $config->get('analytics.addthis_google_analytics_tracking_enabled'), '#required' => FALSE, '#disabled' => !$is_google_analytics_setup);
     $form['analytics']['addthis_google_analytics_social_tracking_enabled'] = array('#type' => 'checkbox', '#title' => t('Track with Google Analytics social'), '#description' => t('Check to track shares in the new Google Analytics social interaction reports (<a href="http://www.addthis.com/help/google-analytics-integration#social">more info</a>). Always global.'), '#default_value' => $config->get('analytics.addthis_google_analytics_social_tracking_enabled'), '#required' => FALSE, '#disabled' => !$is_google_analytics_setup);
     // Third party settings.
     $form['third_party'] = array('#type' => 'details', '#title' => t('Third party settings'), '#open' => FALSE);
     $form['third_party']['twitter_service'] = array('#type' => 'fieldset', '#title' => t('Twitter'), '#collapsible' => TRUE, '#collapsed' => TRUE);
     $form['third_party']['twitter_service']['addthis_twitter_via'] = array('#type' => 'textfield', '#title' => t('Send via'), '#description' => t('When sending a tweet this is the screen name of the user to attribute the Tweet to. (Relates to Tweet Button)'), '#default_value' => $config->get('third_party.addthis_twitter_via'), '#size' => 15);
     $form['third_party']['twitter_service']['addthis_twitter_template'] = array('#type' => 'textfield', '#title' => t('Template text'), '#description' => t('The {{title}} and {{url}} are replaced from the Twitter Button.'), '#default_value' => $config->get('third_party.addthis_twitter_template'));
     return parent::buildForm($form, $form_state);
 }
コード例 #20
0
 /**
  * {@inheritdoc}
  */
 public function createInstance($plugin_id, array $configuration = array())
 {
     $configuration += (array) $this->config->get('printable.format')->get($plugin_id);
     return parent::createInstance($plugin_id, $configuration);
 }
コード例 #21
0
ファイル: SysLog.php プロジェクト: nstielau/drops-8
 /**
  * Constructs a SysLog object.
  *
  * @param \Drupal\Core\Config\ConfigFactory $config_factory
  *   The configuration factory object.
  * @param \Drupal\Core\Logger\LogMessageParserInterface $parser
  *   The parser to use when extracting message variables.
  */
 public function __construct(ConfigFactory $config_factory, LogMessageParserInterface $parser)
 {
     $this->config = $config_factory->get('syslog.settings');
     $this->parser = $parser;
 }
コード例 #22
0
ファイル: AddThis.php プロジェクト: ChuChuNaKu/addthis
 public function setConfig()
 {
     $this->config = $this->config_factory->get('addthis.settings');
 }