protected function EmbeddedEntityImporter::parseFormattedTextAndImport in Entity Share 8.3
Parse text to import embedded entities.
Parameters
\Drupal\entity_share_client\RuntimeImportContext $runtime_import_context: The runtime import context.
string $text: The formatted text to parse.
1 call to EmbeddedEntityImporter::parseFormattedTextAndImport()
- EmbeddedEntityImporter::prepareImportableEntityData in modules/
entity_share_client/ src/ Plugin/ EntityShareClient/ Processor/ EmbeddedEntityImporter.php - Method called on STAGE_PREPARE_IMPORTABLE_ENTITY_DATA.
File
- modules/
entity_share_client/ src/ Plugin/ EntityShareClient/ Processor/ EmbeddedEntityImporter.php, line 63
Class
- EmbeddedEntityImporter
- Import embedded entities from text formatted fields.
Namespace
Drupal\entity_share_client\Plugin\EntityShareClient\ProcessorCode
protected function parseFormattedTextAndImport(RuntimeImportContext $runtime_import_context, $text) {
$matches = [];
preg_match_all('# data-entity-jsonapi-url="(.*)"#U', $text, $matches);
foreach ($matches[1] as $url) {
// Check that the URL is valid.
if (UrlHelper::isValid($url)) {
$this
->importUrl($runtime_import_context, $url);
}
}
}