FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cambridge migrations
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Information Services
DevOps
Drupal team
2023 Platform
Custom Modules
Cambridge migrations
Commits
2e7bef8b
Commit
2e7bef8b
authored
2 months ago
by
Anthony Michaels
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused cleanup script
parent
3a3644ff
No related branches found
No related tags found
1 merge request
!4
Migrate D7 text_block paragraphs to D10 text paragraphs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Plugin/migrate/process/CleanHtml.php
+0
-38
0 additions, 38 deletions
src/Plugin/migrate/process/CleanHtml.php
with
0 additions
and
38 deletions
src/Plugin/migrate/process/CleanHtml.php
deleted
100644 → 0
+
0
−
38
View file @
3a3644ff
<?php
namespace
Drupal\cambridge_migrations\Plugin\migrate\process
;
use
Drupal\migrate\ProcessPluginBase
;
use
Drupal\migrate\MigrateExecutableInterface
;
use
Drupal\migrate\Row
;
/**
* Clean up HTML content by removing unwanted JSON media entries.
*
* @MigrateProcessPlugin(
* id = "clean_html"
* )
*/
class
CleanHtml
extends
ProcessPluginBase
{
/**
* {@inheritdoc}
*/
public
function
transform
(
$value
,
MigrateExecutableInterface
$migrate_executable
,
Row
$row
,
$destination_property
)
{
if
(
empty
(
$value
))
{
return
$value
;
}
// Remove JSON media entries wrapped in <p> tags
$value
=
preg_replace
(
'/<p>\[\[{.*?"type":"media".*?}\]\]<\/p>/s'
,
''
,
$value
);
// Remove any standalone JSON media entries
$value
=
preg_replace
(
'/\[\[{.*?"type":"media".*?}\]\]/s'
,
''
,
$value
);
// Clean up multiple blank lines that might be left after removing content
$value
=
preg_replace
(
'/(\r?\n){2,}/'
,
"
\n\n
"
,
$value
);
$value
=
preg_replace
(
'/<p>\s*<\/p>/'
,
''
,
$value
);
return
trim
(
$value
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment