Commit 92bb66b5 authored by izus's avatar izus
Browse files

Issue #2470553 by izus, Fix documentation DrupalCS way.

parent 183627aa
......@@ -143,11 +143,13 @@ SIMPLE USAGE EXAMPLE (media fields content (media entities of type File))
1) Install drupal, media, search_api search_api_db and search_api_attachments.
2) Go to admin/structure/types/manage/article/fields/add-field and add a
file field 'My medias' (field_my_medias). (choose File in the Media type settings)
file field 'My medias' (field_my_medias).
(choose File in the Media type settings)
3 ) Go to media/add/file and add a media with a pdf file
4) Go to node/add/article and add an article node that references the media entity created at step 3
4) Go to node/add/article and add an article node that references the media
entity created at step 3
5) Configure the extractor at admin/config/search/search_api_attachments and Go
to admin/config/search/search-api/add-server and add server 'My server'
......
......@@ -23,7 +23,9 @@ class TextExtractorFormSettings extends ConfigFormBase {
const CONFIGNAME = 'search_api_attachments.admin_config';
/**
* Drupal\search_api_attachments\TextExtractorPluginManager service.
* Text extractor plugin Manager.
*
* @var Drupal\search_api_attachments\TextExtractorPluginManagerservice
*/
private $textExtractorPluginManager;
......@@ -332,7 +334,7 @@ class TextExtractorFormSettings extends ConfigFormBase {
* The text extractor plugin manager.
*/
protected function getTextExtractorPluginManager() {
return $this->textExtractorPluginManager ? : \Drupal::service('plugin.manager.search_api_attachments.text_extractor');
return $this->textExtractorPluginManager ?: \Drupal::service('plugin.manager.search_api_attachments.text_extractor');
}
}
......@@ -83,16 +83,29 @@ class ExtractedText extends FileFormatterBase implements ContainerFactoryPluginI
* ExtractedText constructor.
*
* @param string $pluginId
* The plugin id.
* @param mixed $pluginDefinition
* The plugin definition.
* @param \Drupal\Core\Field\FieldDefinitionInterface $fieldDefinition
* The field definitions.
* @param array $settings
* The settings.
* @param string $label
* The label.
* @param string $viewMode
* The view mode.
* @param array $thirdPartySettings
* The third party settings.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
* The module handler.
* @param \Drupal\search_api\Processor\ProcessorPluginManager $processorPluginManager
* The processor plugin manager.
* @param \Drupal\search_api_attachments\TextExtractorPluginManager $textExtractorPluginManager
* The text extractor plugin manager.
* @param \Drupal\Core\Config\Config $config
* The configuration.
* @param \Drupal\search_api_attachments\ExtractFileValidator $extractFileValidator
* The extract file validator.
*/
public function __construct($pluginId, $pluginDefinition, FieldDefinitionInterface $fieldDefinition, array $settings, $label, $viewMode, array $thirdPartySettings, ModuleHandlerInterface $moduleHandler, ProcessorPluginManager $processorPluginManager, TextExtractorPluginManager $textExtractorPluginManager, Config $config, ExtractFileValidator $extractFileValidator) {
parent::__construct($pluginId, $pluginDefinition, $fieldDefinition, $settings, $label, $viewMode, $thirdPartySettings);
......@@ -192,7 +205,8 @@ class ExtractedText extends FileFormatterBase implements ContainerFactoryPluginI
// This method is a copy of
// Drupal\search_api_attachments\Plugin\search_api\processor\FilesExtractor::isFileIndexable()
// and differs mostly in the signature. Unfortunately it can't be used here
// as it requires second argument of type \Drupal\search_api\Item\ItemInterface.
// as it requires second argument of type
// \Drupal\search_api\Item\ItemInterface.
// File should exist in disc.
$indexable = file_exists($file->getFileUri());
if (!$indexable) {
......@@ -274,9 +288,10 @@ class ExtractedText extends FileFormatterBase implements ContainerFactoryPluginI
*/
public function settingsSummary() {
$summary = [];
$summary[] = t('Excluded file extensions: ' . $this->getSetting('excluded_extensions'));
$summary[] = t('Maximum upload size: ' . $this->getSetting('max_filesize'));
$summary[] = t('Exclude private files: ' . ($this->getSetting('excluded_private') ? 'true' : 'false'));
$summary[] = t('Excluded file extensions: @extensions', ['@extensions' => $this->getSetting('excluded_extensions')]);
$summary[] = t('Maximum upload size: @maxsize', ['@maxsize' => $this->getSetting('max_filesize')]);
$isexcluded = $this->getSetting('excluded_private') ? 'true' : 'false';
$summary[] = t('Exclude private files: @isexcluded', ['@isexcluded' => $isexcluded]);
return $summary;
}
......
......@@ -514,9 +514,10 @@ class FilesExtractor extends ProcessorPluginBase implements PluginFormInterface
* Helper method to validate the size of files' format.
*
* @param string $bytes
* Number of bytes.
*
* @return bool
* TRUE if the $bites is of form "N KB", "N MB" or "N GB" where N is integer.
* TRUE if $bites is of form "N KB", "N MB" or "N GB" where N is integer.
*/
public function validateSize($bytes) {
$error = FALSE;
......
......@@ -14,7 +14,7 @@ use Drupal\views\Plugin\views\filter\BooleanOperator;
class SearchApiAttachmentsFilterPlugin extends BooleanOperator {
/**
*
* {@inheritdoc}
*/
public function query() {
if (!$this->value) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment