mirror of
				https://github.com/getgrav/grav-plugin-admin.git
				synced 2025-11-03 20:05:53 +01:00 
			
		
		
		
	Add option to create modular content
This commit is contained in:
		@@ -445,6 +445,7 @@ class Admin
 | 
				
			|||||||
                $page->name($type.CONTENT_EXT);
 | 
					                $page->name($type.CONTENT_EXT);
 | 
				
			||||||
                $page->header();
 | 
					                $page->header();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            $page->modularTwig($slug[0] == '_');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $page;
 | 
					        return $page;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -364,7 +364,10 @@ class AdminController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $data = $this->post;
 | 
					        $data = $this->post;
 | 
				
			||||||
        $route = $data['route'] != '/' ? $data['route'] : '';
 | 
					        $route = $data['route'] != '/' ? $data['route'] : '';
 | 
				
			||||||
        $folder = $data['folder'];
 | 
					        $folder = ltrim($data['folder'], '_');
 | 
				
			||||||
 | 
					        if (!empty($data['modular'])) {
 | 
				
			||||||
 | 
					            $folder = '_' . $folder;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        $path = $route . '/' . $folder;
 | 
					        $path = $route . '/' . $folder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->admin->session()->{$path} = $data;
 | 
					        $this->admin->session()->{$path} = $data;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,6 +77,7 @@
 | 
				
			|||||||
    <div class="button-bar">
 | 
					    <div class="button-bar">
 | 
				
			||||||
        {% if mode == 'list' %}
 | 
					        {% if mode == 'list' %}
 | 
				
			||||||
            <a class="button" href="#modal" data-remodal-target="modal"><i class="fa fa-plus"></i> Add Page</a>
 | 
					            <a class="button" href="#modal" data-remodal-target="modal"><i class="fa fa-plus"></i> Add Page</a>
 | 
				
			||||||
 | 
					            <a class="button" href="#modular" data-remodal-target="modular"><i class="fa fa-plus"></i> Add Modular</a>
 | 
				
			||||||
        {% elseif mode == 'edit' %}
 | 
					        {% elseif mode == 'edit' %}
 | 
				
			||||||
            <a class="button" href="{{ base_url }}/pages"><i class="fa fa-reply"></i> Back</a>
 | 
					            <a class="button" href="{{ base_url }}/pages"><i class="fa fa-reply"></i> Back</a>
 | 
				
			||||||
            {% if exists %}
 | 
					            {% if exists %}
 | 
				
			||||||
@@ -157,6 +158,10 @@
 | 
				
			|||||||
        {% include 'partials/blueprints-new.html.twig' with { blueprints: admin.blueprints('pages/new'), data: context } %}
 | 
					        {% include 'partials/blueprints-new.html.twig' with { blueprints: admin.blueprints('pages/new'), data: context } %}
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <div class="remodal" data-remodal-id="modular" data-remodal-options="hashTracking: false">
 | 
				
			||||||
 | 
					        {% include 'partials/blueprints-new.html.twig' with { blueprints: admin.blueprints('pages/modular_new'), data: context } %}
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div class="remodal" data-remodal-id="delete" data-remodal-options="hashTracking: false">
 | 
					    <div class="remodal" data-remodal-id="delete" data-remodal-options="hashTracking: false">
 | 
				
			||||||
        <form>
 | 
					        <form>
 | 
				
			||||||
            <h1>Confirmation Required</h1>
 | 
					            <h1>Confirmation Required</h1>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user