Skip to content

Conversation

JuliaBayer
Copy link

I use your library for Drupal with the HTML Diff module (https://www.drupal.org/project/html_diff).
Here it is possible to compare the content of several fields. Without a possibility to clear the content, the diff for the second field also shows the content of the first one, the third field also shows content of no. 1 and 2, and so on (see picture). Therefor I wanted to ask, if it's possible to add a clearing function?

html_diff-double-content


public function clearContent()
{
$this->content = '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $content property was actually moved from the HtmlDiff class to the new abstract class AbstractDiff (as of version 0.0.6).

So this should probably be added to the AbstractDiff instead.

Also, for code styling we follow the PSR-1 and PSR-2 standards (although a lot of the original code is not up to the standard yet). So if you could indent by 4 spaces instead of 2, that would be very helpful!

@jschroed91
Copy link
Member

@JuliaBayer If you're able to, can you please make the updates suggested in the comment - then I'll merge this in!

If you don't have the time and would prefer I make the changes, let me know and I can do that as well - totally fine either way!

Thank you very much for contributing and I'm happy to hear this is being used in the Drupal module! If you'd like me to add a link to the module in the README let me know.

@JuliaBayer
Copy link
Author

@jschroed91 Probably I was too rash with my request... First we need to tidy up a class we interposed between the Drupal module and your library. After this I will possibly get in touch with you again :) Nevertheless: thank you!

@jschroed91
Copy link
Member

@JuliaBayer I added the function clearContent to the AbstractDiff class in this PR: #44

HtmlDiff extends AbstractDiff, so the end result should be the same as what you were looking for. Only difference was that I set $this->content = null instead of $this->content = ''.

Let me know if you need anything else! And always feel free to open a pull request for any updates, we welcome any contributions and are always looking to improve this library.

@JuliaBayer
Copy link
Author

@jschroed91 Alright, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants