su-sws/stanford_sites_content_importer

此软件包已被废弃,不再维护。未建议替代软件包。

Drupal功能。

安装: 27

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 31

分支: 0

开放问题: 1

类型:drupal-library

7.2.2 2019-03-05 20:37 UTC

This package is auto-updated.

Last update: 2023-07-29 01:50:08 UTC


README

斯坦福网站内容导入器

版本:7.x-2.2

斯坦福网络服务内容导入器

维护者:sherakama

这是做什么的?

这个类集合与斯坦福网络服务的服务器内容协同工作。

需求

配置了服务和UUID的内容服务器。

示例服务器

https://sites.stanford.edu/jsa-content

文件

  • ImporterFieldProcessor.php
    • 需要描述。
  • ImporterFieldProcessorDatetime.php
    • 需要描述。
  • ImporterFieldProcessorEmail.php
    • 需要描述。
  • ImporterFieldProcessorFieldCollection.php
    • 需要描述。
  • ImporterFieldProcessorFile.php
    • 需要描述。
  • ImporterFieldProcessorImage.php
    • 需要描述。
  • ImporterFieldProcessorInterface.php
    • 需要描述。
  • ImporterFieldProcessorLinkField.php
    • 需要描述。
  • ImporterFieldProcessorListText.php
    • 需要描述。
  • ImporterFieldProcessorNumberInteger.php
    • 需要描述。
  • ImporterFieldProcessorTaxonomyTermReference.php
    • 需要描述。
  • ImporterFieldProcessorText.php
    • 需要描述。
  • ImporterFieldProcessorTextLong.php
    • 需要描述。
  • ImporterFieldProcessorTextWithSummary.php
    • 需要描述。
  • SitesContentImporter.php
    • 需要描述。

示例用法

节点

// Import types
$content_types = array(
  'stanford_page',
  'stanford_event',
);

// Restrictions
// These entities we do not want even if they appear in the feed.
$restrict = array(
  '2efac412-06d7-42b4-bf75-74067879836c',   // Recent News Page
  'fcbec50-0449-4e2d-8a79-3f957bf101e9',    // News item
  'ea1a02a9-0564-4448-82f3-09fb1d0ae8c1',   // news item
);

$endpoint = 'https://mysite.com/endpointname';

$importer = new SitesContentImporter();
$importer->setEndpoint($endpoint);
$importer->addImportContentType($content_types);
$importer->addUuidRestrictions($restrict);
$importer->importerContentNodesRecentByType();

词汇表

$endpoint = 'https://mysite.com/endpointname';
$importer = new SitesContentImporter();
$importer->setEndpoint($endpoint);
$importer->importVocabularyTrees();

豆类

$uuids = array(
  '67045bcc-06fc-4db8-9ef4-dd0ebb4e6d72',
  '61b6f7f7-5b94-4112-b69c-07240da330f8',
  '05f729cf-a05c-446a-96ce-324237e2a5db',
  '5ee82af2-bfac-4584-a006-a0fb0661af34',
);

$endpoint = 'https://mysite.com/endpointname';

$importer = new SitesContentImporter();
$importer->setEndpoint($endpoint);
$importer->setBeanUuids($uuids);
$importer->importContentBeans();

通过视图和过滤器获取的节点

$filters = array('tid_raw' => array('37'));
$view_importer = new SitesContentImporterViews();
$view_importer->setEndpoint($endpoint);
$view_importer->setResource('content');
$view_importer->setFilters($filters);
$view_importer->importContentByViewsAndFilters();

扩展

您可以通过扩展ImporterFieldProcessor类来添加自己的字段处理器,例如:通过名称约定,处理器查找的名称是:ImporterFieldProcessorYourFieldNameInCamelCase,例如:ImporterFieldProcessorFieldDateSelect。

您也可以通过以下方式注册一个字段或属性处理器以运行:

$importer->addPropertyProcessor(array('property_name' => 'PHPClass'));
$importer->addFieldProcessor(array('field_name' => 'PHPClass'));

PHPClass需要是一个扩展了ImporterFieldProcessor并具有process()方法的字段或属性处理器。

require_once "ImporterPropertyProcessorTrimAlias.php";
$view_importer->addPropertyProcessor(array('url_alias' => 'ImporterPropertyProcessorTrimAlias'));