Created
May 12, 2017 21:40
-
-
Save mortenson/04bc8e84f3fefbd7ac9404d047d50526 to your computer and use it in GitHub Desktop.
Have some 8.2 module/distro config for form or view displays? Use this to add a region to all your fields. Buyer beware!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Run this with drush scr, silly! | |
use Drupal\Core\Serialization\Yaml; | |
foreach (file_scan_directory('.', '/core\.entity_.*display.*\.yml/') as $file) { | |
$filepath = realpath($file->uri); | |
$yml = Yaml::decode(file_get_contents($filepath)); | |
if (isset($yml['content'])) { | |
foreach ($yml['content'] as &$field) { | |
if (!isset($field['region'])) { | |
$field['region'] = 'content'; | |
} | |
} | |
} | |
file_put_contents($filepath, Yaml::encode($yml)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment