/** * {@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']; } } }
/** * 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'); }