/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $search_choices = ['' => 'No']; foreach ($this->chain->getPlugins() as $plugin) { $search_choices[$plugin->getName()] = $plugin->getTitle(); } $builder->add('locale', 'locale', ['label' => 'Language'])->add('task_scheduler', 'checkbox', ['required' => false, 'label' => 'Task scheduler', 'help' => 'A separate process to perform various tasks in the background, such as checks for system ' . 'updates'])->add('default_search', 'choice', ['required' => false, 'choices' => $search_choices, 'label' => 'Default search plugin', 'help' => 'When detects a new item, the application will try to add it using the selected plugin in ' . 'the first place. If you leave the field blank then the selection of plugins will be carried out ' . 'in alphabetical order.']); }
/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $search_choices = ['' => 'No']; foreach ($this->chain->getPlugins() as $plugin) { $search_choices[$plugin->getName()] = $plugin->getTitle(); } $builder->add('locale', 'locale', ['label' => 'Language', 'data' => $this->request ? $this->request->getLocale() : ''])->add('default_search', 'choice', ['required' => false, 'choices' => $search_choices, 'label' => 'Default search plugin']); }
/** * @param DetectedNewFiles $event * * @return bool */ public function onDetectedNewFilesTryAdd(DetectedNewFiles $event) { // search from default plugin $default_plugin = null; if (($default_plugin = $this->search->getDafeultPlugin()) && $this->tryAddItem($default_plugin, $event)) { return true; } // search from all plugins foreach ($this->search->getPlugins() as $plugin) { /* @var $plugin SearchInterface */ if ($plugin !== $default_plugin && $this->tryAddItem($plugin, $event)) { return true; } } return false; }