Skip to content
Snippets Groups Projects
Commit 2f8714fb authored by renatog's avatar renatog Committed by renatog
Browse files

Issue #3270453 by RenatoG: Update the operations to include attributes to upper operation

parent 03010787
No related branches found
No related tags found
10 merge requests!62Issue #3272848 by RenatoG: When the error appear the field is hidden and the...,!59Issue #3497768: Click JavaScript to close details causes modals to scroll unnecessarily,!35Issue #3366420: \Drupal calls should be avoided in classes,!34Issue #3366420: \Drupal calls should be avoided in classes,!29Issue #3272632 by RenatoG: Add a logic to block and disable the remove item if...,!28Issue #3272632 by RenatoG: Add a logic to block and disable the remove item if...,!23Issue #3272632 by RenatoG: Add a logic to block and disable the remove item if...,!22Issue #3272632 by RenatoG: Add a logic to block and disable the remove item if...,!20Issue #3272632 by RenatoG: Add a logic to block and disable the remove item if...,!7Issue #3320529 by justcaldwell: block_classes_stored setting only retains classes from most recently saved block
......@@ -114,6 +114,7 @@ class BlockClassBulkOperationsForm extends ConfigFormBase {
// Insert the "Insertion attributes" only if attributes is enabled.
if ($enable_attributes) {
$operation_options['insert_attributes'] = $this->t('Insert attributes');
$operation_options['convert_attributes_to_uppercase'] = $this->t('Convert all attributes to uppercase');
$operation_options['convert_attributes_to_lowercase'] = $this->t('Convert all attributes to lowercase');
}
......
......@@ -141,6 +141,12 @@ class BlockClassConfirmBulkOperationForm extends ConfirmFormBase {
continue 2;
case 'convert_attributes_to_uppercase':
$this->convertAttributesToUpperCase($block);
continue 2;
case 'convert_attributes_to_lowercase':
$this->convertAttributesToLowerCase($block);
......@@ -262,6 +268,28 @@ class BlockClassConfirmBulkOperationForm extends ConfirmFormBase {
$block->save();
}
/**
* Method to update attributes to uppercase.
*/
public function convertAttributesToUpperCase(&$block) {
// Get the current block classes configured.
$attributes = $block->getThirdPartySetting('block_class', 'attributes');
if (empty($attributes)) {
return FALSE;
}
// Add the new attributes in the current ones.
$attributes = strtoupper($attributes);
// Store that in the Third Party Setting.
$block->setThirdPartySetting('block_class', 'attributes', $attributes);
// Save the block.
$block->save();
}
/**
* Method to update attributes to lowercase.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment