Loading src/Form/BlockClassBulkOperationsForm.php +1 −0 Original line number Diff line number Diff line Loading @@ -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'); } Loading src/Form/BlockClassConfirmBulkOperationForm.php +28 −0 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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. */ Loading Loading
src/Form/BlockClassBulkOperationsForm.php +1 −0 Original line number Diff line number Diff line Loading @@ -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'); } Loading
src/Form/BlockClassConfirmBulkOperationForm.php +28 −0 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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. */ Loading