You are here

public function SearchApiAttachmentsEntityreferenceAlterSettings::propertyInfo in Search API attachments 7

Adds attachments property.

Return value

array containing the property.

Overrides SearchApiAttachmentsAlterSettings::propertyInfo

File

contrib/search_api_attachments_entityreference/includes/callback_attachments_entityreference_settings.inc, line 83
Search API data alteration callback.

Class

SearchApiAttachmentsEntityreferenceAlterSettings

Code

public function propertyInfo() {
  $ret = array();
  if ($this->index
    ->getEntityType() == 'file') {
    $ret['attachments_content'] = array(
      'label' => 'File content',
      'description' => 'File content',
      'type' => 'text',
    );
  }
  else {
    $fields = $this
      ->getFileFields() + $this
      ->getEntityReferenceFields();
    foreach ($fields as $name => $field) {
      $ret['attachments_' . $name] = array(
        'label' => 'Attachment content: ' . $name,
        'description' => $name,
        'type' => 'text',
      );
    }
  }
  return $ret;
}