public function YoastSeoFieldManager::detachField in Real-time SEO for Drupal 8
Detach a field from a target content type.
Parameters
string $entity_type: Entity type.
string $bundle: Bundle.
string $field_name: Field name.
File
- src/
YoastSeoFieldManager.php, line 175
Class
- YoastSeoFieldManager
- Class YoastSeoFieldManager.
Namespace
Drupal\yoast_seoCode
public function detachField($entity_type, $bundle, $field_name) {
$fields_config = \Drupal::service('entity_field.manager')
->getFieldDefinitions($entity_type, $bundle);
if (isset($fields_config[$field_name])) {
$fields_config[$field_name]
->delete();
}
}