Example #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'];
         }
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public static function targets(array &$targets, ImporterInterface $importer, array $definition)
 {
     if ($importer->getProcessor() instanceof EntityProcessor) {
         if (static::$properties === NULL) {
             static::buildProperties($importer->getProcessor());
         }
         foreach (static::$properties as $id => $property) {
             if (!empty($property['type']) && in_array($property['type'], $definition['field_types'])) {
                 static::prepareTarget($property);
                 $targets[$id] = $property;
                 $targets[$id]['id'] = $definition['id'];
             }
         }
     }
 }
Example #3
0
 /**
  * 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');
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, array &$form_state)
 {
     $this->processFormState($form, $form_state);
     $this->importer->save();
 }