Thank you for a great module and all the work you do.

Is it possible to add the rrule property to the Feeds template?

Issue fork smart_date-3137273

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jon.lund created an issue. See original summary.

mandclu’s picture

Definitely seems possible, but without a feed to test against not something I'm in a good position to test against. Maybe you could see if @komlenic or @inst would be interested in helping, who helped in #3122092: smart date and feeds?

jon.lund’s picture

Like I said earlier, I appreciate all of the work you are doing. This is what I have been waiting for to switch from Drupal 7 for a long time.

I am willing to assist with testing. Everything else is working perfectly for me including Importing ics feeds. I had modified my Drupal 7 version as well in order to make ics feeds work with rrule, however this code base looks a little different. I think I have the feed parcer end working. I am simply not getting the data into the Smart Date rule.

mandclu’s picture

For some added context, Smart Date Recur stores the rule as a separate entity. So you need code that would create the rule entity, then use that to generate the instances that would populate field instances in your Smart Date value.

Here's the code within the SmartDateWidgetBase that Smart Date uses internally for a similar end:

    // Skip any additional processing if the field doesn't allow recurring.
    $field_def = $this->fieldDefinition;
    if ($field_def instanceof FieldConfigInterface) {
      $allow_recurring = $field_def->getThirdPartySetting('smart_date_recur', 'allow_recurring');
    }
    elseif ($field_def instanceof BaseFieldDefinition) {
      // TODO: Document that for custom entities, you must enable recurring
      // functionality by adding ->setSetting('allow_recurring', TRUE)
      // to your field definition.
      $allow_recurring = $field_def->getSetting('allow_recurring');
    }
    else {
      // Not sure what other method we can provide to define this.
      $allow_recurring = FALSE;
    }

    if ($allow_recurring && function_exists('smart_date_recur_widget_extra_fields')) {
      // Provide extra parameters to be stored with the recurrence rule.
      $month_limit = $field_def
        ->getThirdPartySetting('smart_date_recur', 'month_limit');
      if ($form_state->getFormObject() instanceof EntityFormInterface) {
        $entity = $form_state->getformObject()->getEntity();
        $entity_type = $entity->getEntityTypeId();
        $bundle = $entity->bundle();
      }
      $field_name = $field_def->getName();
      smart_date_recur_generate_rows($values, $entity_type, $bundle, $field_name, $month_limit);
    }
mandclu’s picture

smart_date_recur_generate_rows() is defined in smart_date_recur.module, if you want to look through what it does.

someshver made their first commit to this issue’s fork.