Drupal 8 WYSIWYG data programatically insertion make display plain html - drupal

I am working with some migration of content from one website to another. I am doing this using a cron.
When I try to insert data to the WYSIWYG fields the data is inserted and showing in the WYSIWYG editor, but when I check this data in the front-end, the data seems to be pure HTML. Does anybody know what type of formatting I have to apply for proper insertion of data?

Finally I found the solution for this,
I added the below code
$node->set('field_textarea_data', ['format'=>'full_html','value'=>html_entity_decode($data->data,ENT_QUOTES, 'UTF-8')]);
And this solved my issue.
Thanks all for your response.

Related

What's the best way to add schema FAQ markup to a WordPress site without using a plugin?

If it requires a lot of technical WP knowledge, I'd consider a light plugin, but prefer to not add yet another one to the list...
You can add raw html including structured data (microdata or json-ld) via the Custom HTML block.
There are several websites out there that can help you build that structured data.
Turns out all I had to do was add the JSON-LD FAQ Schema Code to the top of the page in my Wordpress editor and it works according to the Structured Data Testing Tool.
Once you understand the logic for the FAQ schema code, its easy to add the raw HTML and also to reuse for multiple applications. In my experience, that's a fair advantage over the weight/possible conflicts of a plugin.
Search Appearance Clicks Impressions
FAQ rich results 3,503 547,689

Drupal know from where things are showed

I have a strange question but I don't find any hint about that (if it's possible), for a drupal 7 website I have to modify some content of a page in the backoffice, but I really don't know from where some content of this page is created (a table, similar to a view table but not a view table).
I just want to know if there is any way to show which php function the page use to finally be showed. I know there is something like that for the theme (drupal theme debug) but I don't find something for my case.
Any idea ?
You need PHP profiler to check all functions called on page, there's a module for Drupal7 for XHProf integration. But I would suggest you to use your browsers inspector as mentioned by 2pha before. For example if there's a form on the page just use the form ID to find it. Custom classes are very useful in these cases, parts of the html codes etc. In your case search for table headers...
The code you are looking for is most probably in custom modules and the
general suggestion is to keep you custom modules in separated folder from contributed ones.

Gutenberg additional block attributes

I’m building an application in React and for the first time I want to use WP REST. I am using gutenberg, and I’m successfully getting the blocks in rest. I have a problem with building my own blocks though, I need to append additional data to them, and I already spent few hours searching and trying to read source code for other blocks. How do I add these “attrs” fields?
you check below link for more information.
https://wordpress.org/gutenberg/handbook/block-api/attributes/

Backwards engineering MySQL table (Wordpress)

I found a Wordpress plugin called Extra Comment Fields that should work, but I'm having trouble with the database! Extra fields are not stored anywhere!
Table plugin uses (and should create) is called wp_comments_extra, but this table is nowhere to be found. Is there any way to manually crate correct table by backwards- engineering plugin's .php file?
You should never have to do that. In fact it would be a really bad idea to. Usually modifying plugins can cause a lot of problems if you don't know what you are doing. What are you trying to do? The table should be created automatically when you activate the plugin.
What makes you think that is the table that would be created, anyways? It could use Wordpress built in meta tables, rather than it's own. Not every plugin creates a table named after itself.
And besides, that plugin hasn't been worked on since 2008. It could be incredibly out of date. If I were you I would look for a different plugin.

Saving multiple inline edits with CKEditor

I'm using asp.net and I would like to edit a newsletter using CKEditor’s inline editing capabilities and then save the newsletter to the database and send via an email.
I've seen various posts about getting the data from a single instance of the inline editor on a page.
Such as the answer by oleq to Dan Temple question on inline editing.
How do I save inline editor contents on the server?
However I would like to have a newsletter similar to the inline demo on the ckeditor site with multiple areas in different style that can be edited.
http://ckeditor.com/demo#inline
Then I guess using ajax to collate the data from each of the individual instances of the editor and save to the database.
Any help would be greatly appreciated.
Many thanks. Luke
I believe this does exactly what you are looking for:
ckeditor inline save/submit
You might need to change a few things to make it work for you. If you are writing valid HTML then I would suggest using something like Nokogiri to search and replace the contents of the page element id's instead of using regular expressions like this answer does.

Resources