PHP code example of goldnead / statamic-inline-edit

1. Go to this page and download the library: Download goldnead/statamic-inline-edit 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/ */

    

goldnead / statamic-inline-edit example snippets


use Goldnead\StatamicInlineEdit\InlineEdit;

return Inertia::render('Site/ArticleDetail', [
    'article' => $article,
    'edit' => [
        'title' => InlineEdit::marker($entry, 'title'),
        'content' => InlineEdit::marker($entry, 'content'),
    ],
]);

'middleware_groups' => ['statamic.web', 'web'],

'inject_for_signed_in' => true,

'heroMarker' => InlineEdit::popup($entry, [
    'rows.'.$line1['id'].'.text' => 'Line 1',
    'rows.'.$line2['id'].'.text' => 'Line 2',
], 'Hero headline'),

'quoteMarker' => InlineEdit::popup($testimonial, ['quote' => 'Quote', 'author_name' => 'Name']),

// one cell
'lead' => InlineEdit::cell($entry, 'rows', $row['id'], 'text', 'Lead', popup: true),
bash
php artisan vendor:publish --tag=statamic-inline-edit --force
bash
php artisan vendor:publish --tag=statamic-inline-edit-config
js
router.on('before', (event) => {
    if (window.StatamicInlineEdit?.dirty() && ! confirm('Unsaved changes. Leave anyway?')) {
        event.preventDefault();
    }
});