PHP code example of statamic-addon / visual-editor

1. Go to this page and download the library: Download statamic-addon/visual-editor 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/ */

    

statamic-addon / visual-editor example snippets


use Statamic\Facades\Icon;

Icon::register('vizuall', resource_path('svg/set-icons'));

use Statamic\Fieldtypes\Sets;

Sets::useIcons('vizuall', resource_path('svg/set-icons'));
bash
php please sve:install
antlers
{{# Replicator / Bard set partial #}}
<div class="..." {{ visual_edit }}>
  {{ text }}
</div>
blade
{{-- Replicator / Bard set --}}
<div {!! Statamic::tag('visual_edit')->context($set->all())->fetch() !!}>
    {!! $set->text !!}
</div>
antlers
{{ visual_edit }}
  <h1>{{ hero_title }}</h1>
  <p>{{ hero_text }}</p>
{{ /visual_edit }}
antlers
<div {{ visual_edit outline_inside="true" }}>
blade
<div {!! Statamic::tag('visual_edit')->context($set->all())->params(['outline_inside' => true])->fetch() !!}>
antlers
<div {{ visual_edit field="text" inline_edit="true" }}>{{ text }}</div>
<h1 {{ visual_edit field="heading" inline_edit="true" }}>{{ heading }}</h1>
antlers
<div {{ visual_edit field="icon" inline_edit="true" }}>
    {{ iconify:icon }}
</div>
antlers
{{ _tag = font_tag ? font_tag : 'h2' }}
<{{ _tag }} {{ visual_edit field="headline" inline_edit="true" controls="font_tag|size" }}>
  {{ headline }}
</{{ _tag }}>
antlers
<ul>
  {{ benefits }}
    <li {{ visual_edit orderable="true" }}>
      <b {{ visual_edit field="number" inline_edit="true" }}>{{ number }}</b>
      <p {{ visual_edit field="text"   inline_edit="true" }}>{{ text }}</p>
    </li>
  {{ /benefits }}
</ul>
antlers
<div {{ visual_edit field="text" inline_edit="true" move="true" }}>{{ text }}</div>
antlers
<section id="id-{{ id }}" {{ visual_edit outline_inside="true" section_orderable="true" }}>
  …
</section>
antlers
<div {{ visual_edit field="blocks" insertable="true" }}>
  {{ blocks }}
    {{ if type == 'text' }}
      <div {{ visual_edit orderable="true" }}>{{ text }}</div>
    {{ elseif type == 'links' }}
      <div {{ visual_edit orderable="true" }}>{{ partial:components/btn_group }}</div>
    {{ endif }}
  {{ /blocks }}
</div>
antlers
<p {{ visual_edit field="title" inline_edit="true" default="Enter a title" }}>{{ title }}</p>

<div {{ visual_edit field="text" inline_edit="true" default="heading:1:Book Title|paragraph:Summary" }}>
  {{ text }}
</div>
antlers
<span {{ visual_edit global_edit="site_settings.phone" }}>Tlf. {{ site_settings:phone }}</span>
antlers
<div {{ visual_edit field="text" inline_edit="true" scope="{{ id }}" }}>{{ text }}</div>