Quantcast
Viewing all articles
Browse latest Browse all 292194

field_sync_field_status() does not enable fields defined without hook_field_info()

So there's no way to return back fields after module enabled again, also this blocks #731724: Convert comment settings into a field to make them work with CMI and non-node entities which was converted to annotations

steps to reproduce
1) enable telephone module
2) add telephone field to article
3) disable and then enable telephone module
4) visit admin/structure/types/manage/article/fields - no telephone field!

Also admin/reports/fields

Notice: Undefined index: field_tel in Drupal\field_ui\FieldListController->buildRow() (line 115 of core/modules/field_ui/lib/Drupal/field_ui/FieldListController.php).
Warning: Invalid argument supplied for foreach() in Drupal\field_ui\FieldListController->buildRow() (line 115 of core/modules/field_ui/lib/Drupal/field_ui/FieldListController.php).

Image may be NSFW.
Clik here to view.
field_list.png

<?php
 
foreach ($modules as $module => $module_info) {
   
// Collect field types and storage backends exposed by the module.
   
$field_types = (array) $module_handler->invoke($module, 'field_info');
   
$storage_types = (array) $module_handler->invoke($module, 'field_storage_info');

    if (
$field_types || $storage_types) {
      foreach (
$fields as $uuid => &$field) {
       
// Associate field types.
       
if (isset($field_types[$field['type']]) && ($field['module'] !== $module || !$field['active'])) {
         
$field['module'] = $module;
         
$field['active'] = TRUE;
         
$changed[$uuid] = $field;
        }
?>
AttachmentSizeStatusTest resultOperations
field_list.png59.62 KBIgnoredNoneNone

Viewing all articles
Browse latest Browse all 292194

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>