コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public static function sources(array &$sources, ImporterInterface $importer, array $definition)
 {
     $field_definitions = \Drupal::entityManager()->getFieldDefinitions('feeds_feed', $importer->id());
     foreach ($field_definitions as $field => $field_definition) {
         if (in_array($field_definition['type'], $definition['field_types'])) {
             $field_definition['label'] = t('Feed: @label', array('@label' => $field_definition['label']));
             $sources['parent:' . $field] = $field_definition;
             $sources['parent:' . $field]['id'] = $definition['id'];
         }
     }
 }
コード例 #2
0
ファイル: FeedController.php プロジェクト: alnutile/drunatra
 /**
  * Presents the feed creation form.
  *
  * @return array
  *   A form array as expected by drupal_render().
  */
 public function createForm(ImporterInterface $feeds_importer)
 {
     $feed = $this->entityManager()->getStorageController('feeds_feed')->create(array('uid' => $this->currentUser()->id(), 'importer' => $feeds_importer->id(), 'status' => 1, 'created' => REQUEST_TIME));
     return $this->entityManager()->getForm($feed, 'create');
 }