@berdir I had accidentally opened an MR as this was the first time I was contributing to open source and got confused about what was required for this issue (Testing the patch). Later, I closed the MR and tested the existing patch. Hope this clarifies the query.
$content_types = [
'cms_hosted_jobs' => $this->t('CMS Hosted Jobs'),
'hcltech_hosted_jobs' => $this->t('HCLTech Hosted Jobs'),
];
$form['content_types'] = [
'#type' => 'fieldset',
'#title' => $this->t('Select Content Type(s)'),
'#open' => TRUE,
];
$form['content_types']['content_type'] = [
'#type' => 'checkboxes',
'#title' => $this->t('Content Type(s)'),
'#options' => $content_types,
'#required' => TRUE,
'#ajax' => [
'callback' => [$this, 'loadAllFields'],
'wrapper' => 'job-quiz-link-wrapper',
'progress' => [
'type' => 'throbber',
'message' => $this->t('Loading fields...'),
],
],
];
$form['all_fields'] = [
'#type' => 'fieldset',
'#title' => $this->t("Enter Fields' Data Here"),
'#description' => $this->t("Please separate entered data using commas, and without any line breaks. Examples - <br><strong>'Project Manager, Developer, Salesforce'</strong><br>This pattern is correct.<br><strong>'Spain<br>Hong Kong<br>India'</strong><br>This pattern is incorrect"),
'#open' => TRUE,
'#attributes' => [
'id' => 'job-quiz-link-wrapper',
],
'#states' => [
'visible' => [
':input[name="content_type[cms_hosted_jobs]"]' => ['checked' => TRUE],
':input[name="content_type[hcltech_hosted_jobs]"]' => ['checked' => TRUE],
],
],
];
Instead of using this (below)
':input[name="content_type"][value="cms_hosted_jobs"]]' => ['checked' => TRUE],
use this instead (below)
':input[name="content_type[cms_hosted_jobs]"]' => ['checked' => TRUE],
Regarding this issue, I found that there was no easy way to "fix" the problem. As this is not an issue in the first place. Meaning, that CKEditor 5 was altering the HTML code because the code itself was wrong (obviously). So, I updated the structure of the DOM via code using an update hook to queue all nodes where I needed my DOM processing to take place and then created a QueueWorker to process the DOM.
Here is a gist of how the work has been done. Please note that I have targetted only those nodes using some specific paragraph components as the DOM alteration was taking place in those nodes containing some specific components.
Update Hook -
/**
* Implements hook_update_N().
*
* CKEditor 5 Components Update.
*/
function ckeditor_5_update_9250() {
$node_data = \Drupal::entityTypeManager()->getStorage('node');
$paragraph_data = \Drupal::entityTypeManager()->getStorage('paragraph');
// Components Array.
$components_array = [
'lorem_ipsum_component_name',
'lorem_ipsum_component_name_1',
'lorem_ipsum_component_name_2',
];
// Get Field Map For Entity Reference Revisions.
$paragraph_bundles = \Drupal::service('entity_field.manager')->getFieldMapByFieldType('entity_reference_revisions');
$nodes = [];
if ($paragraph_bundles) {
foreach ($paragraph_bundles as $index => $paragraph_field) {
// Check If The Bundle Is For Nodes.
if ($index == 'node') {
foreach ($paragraph_field as $field_name => $field_info) {
$paragraph_field_load = FieldStorageConfig::loadByName('node', $field_name);
// Check If The Field's Target type Is Paragraph.
if ($paragraph_field_load->getSettings()['target_type'] == 'paragraph') {
foreach ($components_array as $component_name) {
$paragraph_load = $paragraph_data->loadByProperties(['type' => $component_name]);
foreach ($paragraph_load as $paragraph_id => $paragraph) {
// Check If Nodes Use The Components.
if (count($node_data->loadByProperties([$field_name => $paragraph_id]))) {
$paragraph_bundle = $paragraph->bundle();
$nodes[$paragraph_bundle][] = $node_data->loadByProperties([$field_name => $paragraph_id]);
}
}
}
}
}
}
}
}
// If There Are Nodes Associated With Components.
if ($nodes) {
// Array To Store Nodes' Group With More Than One Element In A Separate
// Index.
$excess_nodes = [];
foreach ($nodes as $component => $nodes_group) {
foreach ($nodes_group as $node_group) {
// Check If The Array Group Has More Than One Element.
if (count($node_group) > 1) {
foreach ($node_group as $node) {
$excess_nodes[$component][] = [$node];
}
}
else {
$excess_nodes[$component][] = $nodes_group;
}
}
$nodes = $excess_nodes;
}
// Remove Duplicate Nodes, And Store Unique Nodes In A Separate Array.
$unique_nodes = [];
foreach ($nodes as $component => $unique_node_group) {
foreach ($unique_node_group as $node) {
$unique_nodes[$component] = array_values(array_map('unserialize', array_unique(array_map('serialize', $node))));
}
}
/** @var \Drupal\Core\Queue\QueueInterface $queue */
$queue = \Drupal::service('queue')->get('ckeditor5_components_update');
foreach ($unique_nodes as $component => $node_group) {
foreach ($node_group as $node) {
$item = new \stdClass();
$item->nodes = $node;
$item->components = $component;
$queue->createItem($item);
}
}
}
}
QueueWorker -
public function processItem($data) {
$nodes = (array) $data->nodes;
$node = reset($nodes);
$node_id = $node->id();
$referenced_entities = $node->referencedEntities();
foreach ($referenced_entities as $field) {
if ($field instanceof Paragraph) {
$fields = [
'field_html_section',
'field_html',
];
$paragraph_id = $field->bundle();
foreach ($fields as $main_html_field) {
if ($field->hasField($main_html_field) && $field->get($main_html_field)->value) {
$html_value = $field->get($main_html_field)->value;
$html_value = mb_convert_encoding($html_value, 'HTML-ENTITIES', 'UTF-8');
$dom = new \DOMDocument();
$dom->loadHTML($html_value, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
}
}
}
}
}
Then, in the QueueWorker, used switch-case to target each paragraph and its corresponding DOM processing.
Hope this helps someone :)
Hi @HongPong, Can you please check your Slack DM?
Kindly please give the above users who worked on & tested this issue credits accordingly.
Right from reading the description of these two modules, it seems that you can use these for your specific requirements -
https://www.drupal.org/project/webformnavigation →
https://www.drupal.org/project/webform_skip →
However, the "Webform Skip" module does not seem to be maintained. Please try the "Webform Navigation" module.
Hi @dcoppel @Jaswinsingh, I have a fresh Drupal site. Could you tell me the steps to reproduce this issue so I can work on the fix? Thanks!
Hi @cleavinjosh, thanks for the clarification. Cheers!
Hi @cleavinjosh, I ran the same command and got no issues.
ghoshishan@ishan-notebook-pro /v/w/d/dummy> ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/*/custom/instagram_feed_by_username/
ghoshishan@ishan-notebook-pro /v/w/d/dummy>
Could this be because when I worked on this issue, I cloned the module onto the 'custom' folder and not the 'contrib' folder?
Here is a screenshot of the instagram_feed_by_username.info.yml file -
Hi @roberttabigue, In my system the only phpcs issues that are still coming up are the ones that I am not sure whether to remove or not as those changes/files are created by @arsh244, one of the maintainers of this module.
I updated the names of a few files because those are classes that had names starting with a small letter, but it should've been a capital letter.
I have not removed a few unused variables as I believe a confirmation from one of the maintainers might be required to do so.
Other than these, I have fixed most of the phpcs issues.
BTW, do let me know if there has been any mistake from my end.
Hi All. Updated MR - https://git.drupalcode.org/project/rest_api_authentication/-/merge_reque...
Please review.
Hi @cleavinjosh. MR Updated. Please check and let us know. Thanks!
Hi @solideogloria. Thanks for pointing that out. I'll add the updated MR link in this MR itself.
Hi, @joseph.olstad thanks for the update and for closing this issue. However, I noticed that there was no credit given to anyone in the issue thread. Hoping for your prompt response regarding this. Thanks! :)
@kumareshbaksi Tested the patch. Looks good.
Before -
After -
+1 RTBC.
Hi @HongPong, could you please give the above users who worked on & tested this issue credits accordingly? This might have been missed accidentally. :)
Tested for these cases -
Input -
<a href="#"> </a>
Output - Entire Thing Got Removed. However, if I enter <a href="#">Lorem Ipsum</a>
, it works.
Another test case -
Input -
<a aria-label="Lorem Ipsum" class="lorem-ipsum-class" href="#" rel="noopener" target="_blank">
<svg fill="none" height="18" viewbox="0 0 16 18" width="16" xmlns="http://www.w3.org/2000/svg">
<path d="M1 2.6554C1 1.48814 2.27454 0.768165 3.27427 1.37068L13.8017 7.71531C14.7693 8.29848 14.7693 9.70157 13.8017 10.2847L3.27427 16.6294C2.27454 17.2319 1 16.5119 1 15.3447V2.6554Z"
stroke="#14142B" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path>
</svg>
Watch
</a>
Output -
<a class="lorem-ipsum-class" href="#" aria-label="Lorem Ipsum" rel="noopener" target="_blank"><svg fill="none" height="18" viewBox="0 0 16 18" width="16" xmlns="http://www.w3.org/2000/svg">
<path d="M1 2.6554C1 1.48814 2.27454 0.768165 3.27427 1.37068L13.8017 7.71531C14.7693 8.29848 14.7693 9.70157 13.8017 10.2847L3.27427 16.6294C2.27454 17.2319 1 16.5119 1 15.3447V2.6554Z" stroke="#14142B" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path>
</svg></a>
<p>
<a class="lorem-ipsum-class" href="#" aria-label="Lorem Ipsum" rel="noopener" target="_blank"> Watch</a>
</p>
Here, the anchor tag that contains the main <svg><path></path></svg>
is being copied after the main anchor tag, and put inside a paragraph (<p></p>
).
@Wim, I removed <em>
from my DOM -
<div class="container">
<span>
<a href="#">Test</a>
</span>
</div>
It is getting changed into -
<div class="container">
<a href="#"><span>Test</span></a><span> </span>
</div>
However, upon further testing, this is not the only instance where the DOM is getting changed. I am checking on a few more instances of HTML structure, where the DOM is getting changed. Will keep everything updated here.
Hi Wim, I am giving another example of the HTML DOM Restructuring which is not how I need it to be -
Input -
<div class="container"> <span class="icon"><a href="#" target="_blank"><em>SOMETHING</em></a></span></div>
Output -
<div class="container"><a href="#" target="_blank"><em><span class="icon">SOMETHING</span></em></a></div>
The main issue with this kind of restructuring is that it affects all the existing nodes the moment they are opened up in "/edit" and re-saved. I am currently backtracking on what happens when I click on the "Source" button. Maybe some .js file gets called which in turn filters out and restructures the DOM(?).
Putting this as DOM -
<div class="social-media">
<span>Share</span>
<span class="icon">
<a href="#" target="_blank" rel="noopener">
<em class="fa-fw fa-twitter fab"> </em>
</a>
</span>
</div>
This gets modified into
<div class="social-media">
<span>Share</span>
<a href="#" target="_blank" rel="noopener">
<em class="fa-fw fa-twitter fab">
<span class="icon"> </span>
</em>
</a>
</div>
Does anyone have any idea how to fix this issue? Thanks in advance.
There are no classes in the entire module. However, there are some phpcs issues found when running this command - ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,css,js,theme,info,txt,yml web/modules/custom/tagadelic/
Results -
FILE: /var/www/drupal/dummy/web/modules/custom/tagadelic/tagadelic.module
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 53 ERRORS AND 3 WARNINGS AFFECTING 46 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
8 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 3
9 | ERROR | [x] Case breaking statement indented incorrectly; expected 5 spaces, found 6
17 | ERROR | [x] Concat operator must be surrounded by a single space
70 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 5
78 | ERROR | [ ] The array declaration extends to column 220 (the limit is 120). The array content should be split up over multiple lines
120 | ERROR | [ ] Missing parameter type
148 | ERROR | [x] Whitespace found at end of line
152 | ERROR | [ ] join() is a function name alias, use implode() instead
208 | ERROR | [x] Concat operator must be surrounded by a single space
218 | ERROR | [ ] Missing parameter type
235 | ERROR | [x] Expected 1 blank line after function; 2 found
241 | ERROR | [ ] Missing parameter type
264 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
266 | ERROR | [ ] Missing parameter type
268 | ERROR | [ ] Missing parameter type
271 | ERROR | [x] Separate the @param and @return sections by a blank line.
271 | ERROR | [ ] Return type missing for @return tag in function comment
280 | ERROR | [x] Expected one space after the comma, 0 found
280 | ERROR | [x] Concat operator must be surrounded by a single space
280 | ERROR | [x] Concat operator must be surrounded by a single space
280 | ERROR | [x] Concat operator must be surrounded by a single space
280 | ERROR | [x] Concat operator must be surrounded by a single space
280 | ERROR | [x] Concat operator must be surrounded by a single space
280 | ERROR | [x] Concat operator must be surrounded by a single space
282 | ERROR | [x] Concat operator must be surrounded by a single space
293 | ERROR | [x] Concat operator must be surrounded by a single space
293 | ERROR | [x] Concat operator must be surrounded by a single space
309 | ERROR | [ ] Missing parameter type
313 | ERROR | [ ] Missing parameter type
317 | ERROR | [ ] Return type missing for @return tag in function comment
347 | WARNING | [ ] '@todo' should match the format '@todo Fix problem X here.'
349 | ERROR | [ ] Wrong function doc comment end; expected "*/", found "**/"
351 | ERROR | [x] list(...) is forbidden, use [...] instead.
355 | ERROR | [x] Case breaking statements must be followed by a single blank line
358 | ERROR | [x] Case breaking statements must be followed by a single blank line
381 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
400 | WARNING | [x] A comma should follow the last multiline array item. Found: )
400 | ERROR | [x] Array closing indentation error, expected 6 spaces but found 8
402 | ERROR | [x] Concat operator must be surrounded by a single space
410 | ERROR | [ ] Missing parameter type
412 | ERROR | [ ] Missing parameter type
432 | ERROR | [ ] Missing parameter type
440 | ERROR | [x] Concat operator must be surrounded by a single space
440 | ERROR | [x] Concat operator must be surrounded by a single space
450 | ERROR | [x] Concat operator must be surrounded by a single space
451 | ERROR | [x] Concat operator must be surrounded by a single space
453 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
455 | ERROR | [x] Concat operator must be surrounded by a single space
456 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
462 | ERROR | [x] Concat operator must be surrounded by a single space
465 | ERROR | [x] Concat operator must be surrounded by a single space
466 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
495 | ERROR | [x] Concat operator must be surrounded by a single space
502 | ERROR | [x] Concat operator must be surrounded by a single space
515 | WARNING | [x] A comma should follow the last multiline array item. Found: )
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 39 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/drupal/dummy/web/modules/custom/tagadelic/README.txt
-----------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
-----------------------------------------------------------------------
3 | WARNING | [ ] Line exceeds 80 characters; contains 110 characters
4 | WARNING | [ ] Line exceeds 80 characters; contains 178 characters
5 | WARNING | [ ] Line exceeds 80 characters; contains 272 characters
9 | ERROR | [x] Expected 1 newline at end of file; 2 found
-----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------
FILE: /var/www/drupal/dummy/web/modules/custom/tagadelic/tagadelic.css
------------------------------------------------------------------------------
FOUND 13 ERRORS AFFECTING 13 LINES
------------------------------------------------------------------------------
4 | ERROR | [x] There must be no space before a colon in a style definition
9 | ERROR | [x] There must be no space before a colon in a style definition
12 | ERROR | [x] There must be no space before a colon in a style definition
15 | ERROR | [x] There must be no space before a colon in a style definition
18 | ERROR | [x] There must be no space before a colon in a style definition
21 | ERROR | [x] There must be no space before a colon in a style definition
24 | ERROR | [x] There must be no space before a colon in a style definition
27 | ERROR | [x] There must be no space before a colon in a style definition
30 | ERROR | [x] There must be no space before a colon in a style definition
33 | ERROR | [x] There must be no space before a colon in a style definition
36 | ERROR | [x] There must be no space before a colon in a style definition
37 | ERROR | [x] Expected 1 newline at end of file; 2 found
38 | ERROR | [x] Additional whitespace found at end of file
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------
FILE: /var/www/drupal/dummy/web/modules/custom/tagadelic/tagadelic.install
----------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------
16 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
20 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------
Time: 190ms; Memory: 14MB
Patch #39 has solved the issue for me. Thanks!
@pvbergen
Fixed all phpcs issues except this one -
FILE: /pagedesigner/tests/src/Kernel/AbstractPagedesignerTest.php
-------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------
21 | ERROR | Do not disable strict config schema checking in tests. Instead ensure your module properly declares its schema for configurations.
-------------------------------------------------------------------------------------------------------------------------------------------------
Please review and let me know in case of any concerns.
Made changes. Please review and let me know in case of any concerns. https://git.drupalcode.org/project/instagram_feed_by_username/-/merge_re...
I will work on this. Figure out whether this is beneficial or not.
Just checked that this is already fixed. Duplicate Issue 📌 Fix the issues reported by phpcs Fixed
Global \Drupal calls must be used and NOT DI (Dependency Injection) in every place where classes can't be used AND in static functions. Some examples of types of files where classes are not used - .install | .module. In all other situations, DI must be used. Do correct me if I made any mistake. Cheers!
If no one is working on this, I'll work on this issue.
@solideogloria Thanks for noticing that. It was not intentional. I'll quickly update the MR. Thanks!
I'm looking into this issue.
I have created the Merge Request for this. Please review and let me know if there are any issues with the changes.
https://git.drupalcode.org/project/rest_api_authentication/-/merge_reque...
Checked the module. There are a lot of files that need its coding standards fixed. I'll work on these.
Hi jonodunnett. Thanks for letting me know.
Hi, If no one is working on it currently, I can start on this.
If no one is working on it actively, I can pick this up. Cheers!
If you enable entityqueue_smartqueue, and in admin/structure/entityqueue/add you select Smart Queue, whatever content you have, all of them will automatically be added. For example, if you have 20 nodes for a particular CT, all 20 items will be added as 20 subqueues. However, if you're using Simple Queue you will need to add every node one by one. Would the approach of being able to select checkboxes for each node for a CT be better? Please confirm.
Applied Patch - 3377195-9.patch by penyaskito → . Working as expected. Reviewed and tested at my end.
Hi @diana.id, I see that you updated your work 7 years ago from now. Are you still working on the porting of this module to D8? If not, I was thinking of porting this to D10 as there are practically no good alternatives to this module in D10. Please reach out to me in case you're working on this or plan to work on porting it to D10. And in case you're no longer interested, please let me know. Thanks! (Contact - ishan.ghosh@innoraft.com)
Cheers!
ishanghosh27 → made their first commit to this issue’s fork.