Jump to content
a-ok

PageTableExtended admin layout

Recommended Posts

Hi folks,

I've been using the PageTableExtended recently to create some dynamic/curated sections on my site which is working really well, functionality wise, but the admin layout in the CMS is a little odd to work with. I have attached a screenshot of how one of my setups currently looks. You'll see it's hard to know what 'flexible-content-block' is an image, or text, or embeddable media etc. What would be really useful is to see the 'page' title on this screen. I have attached a screenshot with an idea. So, is something like my proposal currently possible, and if not, could it be added to a feature list? Wordpress's ACF flexible content area use this type of setup and it's a lot easier to maintain and organise. Especially for clients/users. Or, is there a way which I can fork this and build this layout for others to use if they find it useful?

post-2553-0-78564500-1425645467_thumb.pn

post-2553-0-62042300-1425645729_thumb.pn

Thanks,

R

Share this post


Link to post
Share on other sites

I think the regular PageTable Field is already doing what you want.

Just choose some Templates and you can select in the entry tab which fields to show up.

post-1843-0-04411600-1425652166_thumb.pn

Share this post


Link to post
Share on other sites

Yep, definitely using the Extended version. But maybe it's to do with the 'Automatic Page Name Format' field? See my screenshots below. Any way to make the 'template label' appear as the type? Do you see what I mean?

Screen%20Shot%202015-03-06%20at%2014.31.

Screen%20Shot%202015-03-06%20at%2014.33.

Share this post


Link to post
Share on other sites

I managed to found out where it is outputting Automatic Page Name Format (flexible-content-block in this case) in the wire

protected function renderTableCol(Page $item, array $fields, $column, $width, $linkURL = '') {
    $out = $this->getItemValue($item, $fields, $column); 
    if($linkURL) $out = "<a class='InputfieldPageTableEdit' data-url='$linkURL' href='#'>$out</a>";
    $attr = $width ? " style='width: $width%'" : '';
    return "<td$attr>$out</td>";
}

So, where it is outputting the `getItemValue` can it not output the label of the template being used?

Ideally something like

$templateLabel = $template->label;
if($linkURL) $out = "<a class='InputfieldPageTableEdit' data-url='$linkURL' href='#'>$templateLabel</a>";

Share this post


Link to post
Share on other sites

Yep, definitely using the Extended version.

Sorry missed your point a bit, thought you wanted a more "descriptive" layout instead of only better titleing. backes already showed the part of the pagetable configuration, where you can change which rows should be visible. Just put title in the first line and you'll get the title there.

Edit: If you're talking about the title of the type of page use "template" or even "template.label"

Share this post


Link to post
Share on other sites

Thanks for the help. I have put title, but the title is automatically generated as I don't want the user to have to type 'Image' or 'Image' every time. I have hidden this from the editor by default (see attachment) I'd like the title of the type of page to be shown here.

Screen%20Shot%202015-03-06%20at%2015.21.Screen%20Shot%202015-03-06%20at%2015.21.

Share this post


Link to post
Share on other sites

You don't seem to have noticed the edit to my last post. It's doable with "template" or "template.label".

  • Like 1

Share this post


Link to post
Share on other sites

Thanks. But do you mean adding this under 'Automatic Page Name Format'?

Or here:

protected function renderTableCol(Page $item, array $fields, $column, $width, $linkURL = '') {
    $out = $this->getItemValue($item, $fields, $column); 
    if($linkURL) $out = "<a class='InputfieldPageTableEdit' data-url='$linkURL' href='#'>" . $out->template.label . "</a>";
    $attr = $width ? " style='width: $width%'" : '';
    return "<td$attr>$out</td>";
}

Share this post


Link to post
Share on other sites

In neither. If you're editing the pageTable field there's a textarea "Table fields to display in admin" under the "Input" tab. There's the place to change the columns.

  • Like 2

Share this post


Link to post
Share on other sites

Haha yes! That is brilliant. I'm guessing you can't change the 'Template > Template.label' text to something more user friendly? That's definitely not the end of the world though. Really really appreciated.

Screen%20Shot%202015-03-06%20at%2015.58.

Share this post


Link to post
Share on other sites

Hi all!

Bringing up this old thread...

I'm guessing you can't change the 'Template > Template.label' text to something more user friendly?

My hope was to solve this by modifying the entries in the textarea "Table fields to display in admin".

For, say,  a field "text" of fieldtype file with the Label "Notes"  I had the entry "text.filesizeStr", hence the column title was "NOTES > TEXT.FILESIZESTR".

Wanting the title "SIZE" instead, I tried the entry "Size=text.filesizeStr".

And really, the column title changed to "SIZE". But the column lost its values - all its cells were empty.

So I assume that it needs just a slightly different syntax for the entry to work... Suggestions welcome!

Share this post


Link to post
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.

  • Similar Content

    • By louisstephens
      So I ran into a very strange issue today. I have a template with a pagetable and I went to add an item to it, when I went to select an image (for an image field) the page instantly threw up an error
      "ProcessPageSearchLive: No search specified"
      The page's content also switched to the image attached. This all worked perfectly last week (local mamp box). Has anyone experienced this before, and how did you solve it?
       

    • By jploch
      Hey folks,
      I have a question regarding rendering of template files that are in a subfolder of the template folder.
      How would I for example render these PageTable items, when their template files are inside templates/blocks/:
      <div class="grid"> <?php foreach($page->grid_ext as $item): ?> <div id="pteg_<?= $item->id ?>"> <?php echo $item->render(); ?> </div> <?php endforeach; ?> </div> I tried this, but get an error:
      <?php echo $item->render(wire('config')->paths->templates . '/blocks/'); ?>  
    • By tron1000
      Hello! I use PW 3.0.98 and I have frontend editing enabled for a PageTable Field. Somehow, when I double click the field in the frontend, the iframe in wich the content is displayed is very small (see screenshot). I couldn't find out if thats some CSS conflict or another problem. Any suggestions? Thanks, Andrej
       

    • By Noel Boss
      I use a PageTable field to make edits to children of pages more intuitive…
      To register the hooks, insert the following Snippet inside your init function in your module (or add it to your init.php file):
      /** * Initialize the module. * * ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called * when ProcessWire's API is ready. As a result, this is a good place to attach hooks. */ public function init() { // Prefill pageTable field $this->wire()->addHookBefore('InputfieldPageTable::render', $this, 'addChildrenToPageTableFieldsHook'); $this->wire()->addHookBefore('InputfieldPageTableAjax::checkAjax', $this, 'addChildrenToPageTableFieldsHook'); } Then, add this hook method:
      /** * Fill pagetable fields with children before editing…. * * @param HookEvent $event */ public function addChildrenToPageTableFieldsHook(HookEvent $event) { $field = $event->object; // on ajax, the first hook has no fieldname if (!$field->name) { return; } // get the edited backend page $editID = $this->wire('input')->get->int('id'); if (!$editID && $this->wire('process') instanceof WirePageEditor) { $editID = $this->wire('process')->getPage()->id; } $page = wire('pages')->get($editID); // disable output formating – without this, the ajax request will not populate the field $page->of(false); // you could also insert a check to only do this with sepcific field names… // $page->set($field->name, $page->children('template=DesiredTemplate')); // just specific templates $page->set($field->name, $page->children); } Now whenever there is a page-table field on your page, it gets populated with the children
×
×
  • Create New...