public function YoastSeoFieldManager::isAttached in Real-time SEO for Drupal 8
Check if a field has been already attached to a bundle.
Parameters
string $entity_type: Entity type.
string $bundle: Bundle.
string $field_name: Field name.
Return value
bool Whether it is attached or not.
File
- src/
YoastSeoFieldManager.php, line 197
Class
- YoastSeoFieldManager
- Class YoastSeoFieldManager.
Namespace
Drupal\yoast_seoCode
public function isAttached($entity_type, $bundle, $field_name) {
$fields_config = \Drupal::service('entity_field.manager')
->getFieldDefinitions($entity_type, $bundle);
return isset($fields_config[$field_name]);
}