Jump to content

New processwire.com (?)


heldercervantes

Recommended Posts

20 minutes ago, bernhard said:

Nice idea.

And a textarea to post the names of modules to install automatically. And an URL field to post the URL to a gist with a basic setup ^^

Perhaps a pw-bootstrap.php that could be run after the installation?

<?php

return [
    'installs' => [
        'FieldtypeRepeater',
        'InputfieldPageAutocomplete',
        'AdminThemeUikit' => 'https://github.com/ryancramerdesign/AdminThemeUikit/archive/master.zip'
    ],
    'fields' => [
        ['body' => ['type' => 'textarea']],
        ['views' => ['type' => 'integer']],
        ['products' => ['type' => 'table']]
    ],
    'templates' => [
        ['post' => ['label' => 'Post']],
        ['blog' => ['label' => 'Blog']],
        ['listing' => ['label' => 'Product Listing'],
        ['product' => ['label' => 'Product', 'urlSegments' => 1]]
    ],
    'pages' => [
        '/blog/' => ['template' => 'blog'],
        '/blog/test-post/' => ['template' => 'post'],
        '/products/' => ['template' => 'listing'],
        '/products/test-product/' => ['template' => 'product']
    ]
];

Which then could be used to perform a quick setup like this:

$bootstrapPath = './pw-bootstrap.php';
if (!file_exists($bootstrapPath)) return;
$setup = include($bootstrapPath);


function installModule($name) {...}
function createField($name, $opts) {...}
function createTemplate($name, $opts) {...}
function createPage($path, $opts) {...}

foreach ($setup as $type => $items) {
    switch ($type) {
        case 'installs':
            foreach ($items as $module) installModule($module);
            break;
        case 'fields':
            foreach ($items as $fields => $opts) createField($field, $opts);
            break;
        case 'templates':
            foreach ($items as $template => $opts) createTemplate($template, $opts);
            break;
        case 'pages':
            foreach ($items as $page => $opts) createPage($page, $opts);
    }
}

Performing these manually takes at least 10min, but with an automated system it wouldn't take more than 10-20 seconds

  • Like 2
Link to comment
Share on other sites

On 9/22/2017 at 12:18 PM, benbyf said:

maybe im looking at an old version then as i dont have the tree link.

59c537ac74e5e_Screenshot2017-09-2217_17_01.thumb.png.fa7c4be7989c01357db9fce26d56820c.png

you can double click the Pages item to page tree, or you can re-enable the Tree submenu item (i always do that).

  • Like 1
Link to comment
Share on other sites

27 minutes ago, adrian said:

Remember that ModuleToolkit can batch install modules with a list of module class names.

i knew it ;):D but still i would prefer a solution during install. the topic is maybe also related to wireshell... personally i don't use either of the mentioned solutions. maybe i'm just too lazy. but maybe there could be a more streamlined or standardized way of doing this...

or maybe i should start using moduletoolkit. i'll have a second or third look on my next project ;)

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...