Created
August 4, 2016 01:12
-
-
Save segovia94/b067ab2ad8da43e8b08ddbde2379f3f3 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Implements hook_editor_js_settings_alter(). | |
*/ | |
function sitefarm_core_editor_js_settings_alter(array &$settings) { | |
// New Styles | |
$styles = array( | |
[ | |
'name' => 'Align Left', | |
'type' => 'widget', | |
'widget' => 'embed', | |
'attributes' => ['class' => 'u-align--left u-width--half'], | |
], | |
[ | |
'name' => 'Align Center', | |
'type' => 'widget', | |
'widget' => 'embed', | |
'attributes' => ['class' => 'u-align--center u-width--two-thirds'], | |
], | |
[ | |
'name' => 'Align Right', | |
'type' => 'widget', | |
'widget' => 'embed', | |
'attributes' => ['class' => 'u-align--right u-width--half'], | |
], | |
); | |
foreach ($settings['editor']['formats'] as $name => $value) { | |
// Add new styles | |
$current_styles = $settings['editor']['formats'][$name]['editorSettings']['stylesSet']; | |
if ($current_styles) { | |
$settings['editor']['formats'][$name]['editorSettings']['stylesSet'] = array_merge($current_styles, $styles); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment