I have a location field with addresses.
The Output of this field looks like this:

DESCRIPTION:Datum: \n\nMo\, 12.10.2015 \n11:00 bis 16:00\n\nOrt: \n\n\n\n  
 \n\n              \n\n        Bundesplatz 3\n              \n             
  3005\n              \n      Bern      \n                        \nSchweiz
 \n                                          \n  \n\n\n

So where can I modify the output?

Thx in advance

maen

Comments

maen created an issue. See original summary.

coredumperror’s picture

Status: Active » Needs review

That mess of whitespace and newlines is caused by the HTML of your field being overly complicated. The text conversion done by date_ical to match the iCal spec (HTML isn't allowed) converts <p>, <h*>, and <div> tags to newlines, and leaves the whitespace between html tags intact. You've got three options:

1) Simplify the HTML that's output by whatever view mode your feed is rendering the event nodes as. You want as little as possible HTML to be in there, so the plaintext converter has less to do.
2) Use the "iCal Fields" row plugin for Views, rather than the iCal Entities plugin. This can be changed on the "Show" line of the "FORMAT" section of your view's settings. This should result in much less convoluted HTML, and therefore less unwanted whitespace.
3) Use a custom module that implements hook_date_ical_export_html_alter(&$text_fields, $view, $context) (see date_ical.api.php for details). Within your implementation of that hook, you'll be able to manipulate the HTML to make it less ugly after text conversion.

Eketol’s picture

Sorry for my noob question, but why not access directly to the data instead of use an HTML rendered output as source?
With "iCal Feeds", is it possible to select several fields for the description or location sections?

coredumperror’s picture

Status: Needs review » Closed (fixed)

Date iCal can only work within the limitations of Views, and that restricts you to one of two options:

1) Render each event node returned by the view to HTML, then convert to text.
2) Use a view that's configured to supply the necessary fields individually, then hook the contents of those fields up to the correct attributes of the events in the iCal feed.

The advantages of 1 are that the user doesn't need to manually configure anything except the iCal view mode, which can be configured just like every other view mode (which most users should presumably be familiar with). The disadvantages are that you're beholden to the whims of Drupal's render system, which is notorious for its massive overuse of non-semantic markup. That overuse is usually not an issue, but it becomes one when converting from HTML to plaintext.

The advantages of 2 are that the user has more direct control over the contents of the feed. The disadvantages of that control, though, are that it takes a bit more work to set up. In my opinion, these disadvantages are massively outweighed by the additional control.

As to your second question, I know of no way to use multiple fields to populate a single event attribute. It might be possible through the use of a third party plugin for Views, but Date iCal doesn't support it directly.

Eketol’s picture

Thanks for your help. I've found a way to include multiple fields, following your suggestions:

1) I Used "iCal Fields".
2) In the Fields section, I added any extra fields I wanted to include (eg. Content:Body and several location fields).
3) Added a "Global: custom text" field (it needs to be at the bottom of the list of fields).
4) Configured the Global field to include all the fields I needed using the Replacement Patterns ([name], [street], etc).
5) In the "iCal Fields" settings, I set the "Description" to use the newly created Global field.

Then I used the same method with another Global field to get a clean Address section (by adding the Location fields needed first).
I hope it helps someone.

Thanks for this cool module!

coredumperror’s picture

Oh cool, I didn't know about the "Global: custom text" field. That's really useful!