PHP code example of estd / kirby-modify-text

1. Go to this page and download the library: Download estd/kirby-modify-text library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

estd / kirby-modify-text example snippets




// Define custom styles
$styles = [
    'color: red',
    'font-weight: bold'
];

// Apply modifications to the text block
echo $block->text()->modifyTag([
    'styles' => $styles,            // Inline styles as an array
    'class' => 'custom-class',      // Add one or more CSS classes
    'tag' => 'span',                // Change the HTML tag (optional)
    'attributes' => [
        'data-custom' => 'example'  // Add any custom attributes
    ]
])->kt();



// Change tag
<?= $block->text()->modifyTag(['tag' => 'h2'])->kt()