Jump to content

Recommended Posts

On 1/28/2019 at 10:18 PM, kongondo said:

@besrwordt,

Do you have a current Media Manager subscription? makeBlankItem() is implemented in the latest Media Manager (version 012, soon coming out of beta). However, you can still import from one MM field to another. A MM field behaves like PageArrays (WireArrays).  

Yes i have. Will try that for sure!

A Media Manager field stores only two pieces of data; the (page) ID of the media being referenced and the media type (1=audio; 2=document; 3=image; 4=video; 3x=image variation). There's two ways you can go about exporting/importing from one field to the other. The second way is easiest if you need to import everything from one field to another, no questions asked. The first method allows fine control, e.g. if you want to skip certain media types. In the examples below, media_export is the Media Manager field with the media you want to copy over/merge with a second Media Manager field. media_import is the second Media Manager field into which media is being imported/copied over.

Method One: Loop through each media in the Media Manager field you are exporting from


// page with mm field we are importing into (media_import)
$p = $pages->get(1234);

// page with mm field we are exporting from (media_export)
foreach ($page->media_export as $m ) {
    // @note: here you can skip media you don't want to export
    // instance of new MediaManager()
    $mm = new MediaManager();
    // populate the MediaManager object properties with required data (media id and type)
    $mm->id = $m->id;
    $mm->type = $m->type;
    // import/add the media to the 2nd mm field (media_import)
    $p->media_import->add($mm);
}

// output formatting of
$p->of(false);
// save only the media manager field (page with import mm field)
$p->save('media_import');
// revert output formatting back on
$p->of(true);

 

Method Two: Import everything at once


// page with mm field we are importing into (media_import)
$p = $pages->get(1234);
// import all the media in the 1st mm field (media_export) into the 2nd mm field (media_import)
$p->media_import->import($page->media_export);
// output formatting of
$p->of(false);
// save only the media manager field (page with import mm field)
$p->save('media_import');
// revert output formatting back on
$p->of(true);

 

Note that all WireArray behaviour apply. For instance, you might want to first experiment in cases where your 2nd Media Manager field (media_import) already has some media which may or may not be present in the first Media Manager field. 

Great, Thanks!!!

 

Share this post


Link to post
Share on other sites

We've been experimenting with the v12 beta and have mostly had success with the new version.  We recently ran into a problem where the upload stopped working.  We can still upload via ftp and the "scan" function.  This is error that Tracy reports immediately after the files are uploaded.  We tried refreshing the module, but no go. 

MM-v12-error.png

Share this post


Link to post
Share on other sites
12 hours ago, Karinne Cyphers said:

We recently ran into a problem where the upload stopped working.  We can still upload via ftp and the "scan" function.  This is error that Tracy reports immediately after the files are uploaded.  We tried refreshing the module, but no go. 

Thanks for testing. The error says means that the media has not been found. It means that the media field is empty, for some reason, which is strange. The line where the error occurs tells me that in your settings you specify that uploading a duplicate media should replace the one that already exists in the Media Manager Library. Using these settings, I have tried to replicate the error that you are getting but everything works fine. The old media is replaced fine. Could you please provide more details? 

  1. What sort of media are you getting the error with? E.g. images
  2. If images, are they huge images?
  3. ProcessWire + PHP Versions
  4. What upload mode are you using? I've tried with both 'upload anywhere' on and off and I get no errors.
  5. It could be that you had an unfinished upload (maybe PHP ran out of memory). Could this be the case?

I have modified the file where the error is occurring to at least suppress the error. I've emailed it to you.

Share this post


Link to post
Share on other sites

Yes, what is strange is that the upload functionality was working fine, then it stopped working and began throwing those two errors.  Here are the details:

  1. Some media is a couple of megapixels, but the majority are things like icons and small graphics that are under 100kb, mostly imagees
  2. Most of the images are under 1mb and most are under 100kb
  3. Processwire 3.0.123 and PHP 7.3.x running as FPM
  4. We have upload anywhere turned on, but most of the uploads are done via the Media Manager itself
  5. The servers are virtualized but we have 256mb dedicated to PHP

We'll try to use the file you sent to see if suppressing helps the error.

Share this post


Link to post
Share on other sites
10 hours ago, Karinne Cyphers said:

Yes, what is strange is that the upload functionality was working fine, then it stopped working and began throwing those two errors. 

My bet is that there's an upload that didn't get completed and/or a media that, for some reason, did not get deleted and the process is stuck in memory.  Is it possible to try the following for me please?

  1. If you change the setting for "replacing duplicate media", to either "skip" or "rename" the uploaded media, does normal uploading work?
  2. With the setting back to "replace duplicate media", are you able to narrow down what particular image(s) leads to the errors? For instance, the error always occurs when you try to "upload and replace" a media called "Cats". We can then visit the "Cats" media page to edit it and see if there are any errors there.
  3. Are you able to edit your media pages to confirm that they all have images (i.e. they are not empty)?
  4. Are the images JPGs or PNGs or both?

Share this post


Link to post
Share on other sites

Well, it's strange... we toggled the replace duplicate media and gave it a go and now it is working again.  I set it back to confirm overwrite and it is still working.  This may be related to some other server issues we've been having, but our server guy has been making some adjustments to the environments today as well so that may have also had an impact.  Thank for your help with this!

Share this post


Link to post
Share on other sites

One other quick question, is there a configurable option to change the number of items returned?  I think by default it is set to 30, but is there an easy place we can change that?  Our content team has started to give us feedback and this was at the top of their list.

Share this post


Link to post
Share on other sites
9 hours ago, Karinne Cyphers said:

Thank for your help with this!

Glad you got it sorted :-).

 

9 hours ago, Karinne Cyphers said:

One other quick question, is there a configurable option to change the number of items returned?  I think by default it is set to 30, but is there an easy place we can change that?  Our content team has started to give us feedback and this was at the top of their list.

Yes. You can change the limit and lots of other similar stuff by using the filters under "What media to show". You can also configure and save a filter to be used as the default. Results can be filtered by a single or multiple criteria such as limit, title, description, tags, published, modified, etc. You can use operators such as contains text, equals, etc. The results are automatically refreshed when a filter is applied. Please see the two examples below. The first involves filtering the results directly without creating and saving the filter, although the filter will be cached and applied until the cache expires. The second one shows you how to create and save a filter that you can subsequently set as your default filter. This is especially useful if you are working in teams that need results tailored to their workflow. Please note that you may at times need to reset (rather than refresh) filters for a new one to apply due to caching. Although you can clear this type of filter directly, subsequent reloads with reload the filter as well. Hence, this type of filter persists across sessions. In the "What media to show" panel, the reset icon is the second one after the filters tab. The first icon is for refresh.

Direct Filter

 

media-manager-limit.thumb.gif.0ebf863d0f28b4a60f1a0ae5c6d7bb44.gif

 

Configure, Save and Apply Filter

In this example, we classify a number of items using a common tag, 'people'. We then create a filter titled People which limits the results returned by number (2) and tag (people). Please note that you do not have to use tags if all you are interested in is limit. We only use it to enrich the example. Finally, we set People as the default filter.  As a by  the way, you can also use tags to filter items in the frontend using a ProcessWire selector 🙂

media-manager-limit-filter.thumb.gif.aa2921d3ce8f713c151e30c3ce49c4a2.gif

  • Like 1

Share this post


Link to post
Share on other sites

Hi @kongondo,

we've discovered a strange behaviour of Media Manager upload (v 011): If the file extension is uppercase, i.e. "JPG", then the upload fails, despite "jpg" is set as valid image extension in settings. We've tried to add "JPG" (in uppercase) to the valid image extensions, but with no luck. The solution was finally to bulk rename all the files to lowercase jpg extension on a local device.

Have you ever heart of this beaviour? From my programmers view, I would assume, that the file extension check is case insensitive, but it isn't?

Greetings,

Thomas.

Share this post


Link to post
Share on other sites

HI @xportde

 

24 minutes ago, xportde said:

we've discovered a strange behaviour of Media Manager upload (v 011): If the file extension is uppercase, i.e. "JPG", then the upload fails, despite "jpg" is set as valid image extension in settings. We've tried to add "JPG" (in uppercase) to the valid image extensions, but with no luck. The solution was finally to bulk rename all the files to lowercase jpg extension on a local device.

Have you ever heart of this beaviour?

I'm not sure what's going on in your install :-). I've never experienced this behaviour before nor have I ever received a report about it. Just to be double sure, I've just now tested (MM 011; JFU 006) with an image with a .JPG extension and it is uploaded just fine. Any error shown? 

Share this post


Link to post
Share on other sites

Hi @kongondo,

this is very curious, indeed! So, if you never heart of this before, and it not seems to be a general problem, we will ask our customer not to use uppercased file extensions.

Thank you for your clarification!

Greetings,

Thomas.

Share this post


Link to post
Share on other sites
4 minutes ago, xportde said:

So, if you never heart of this before, and it not seems to be a general problem, we will ask our customer not to use uppercased file extensions.

What's their server environment? Are they on Windows? 

Edited by kongondo

Share this post


Link to post
Share on other sites

Hi @kongondo,

we've tested your new MM 012, great work!

In grid view, there is a small bug in rendering thumbnails: If the calculated width is not a whole number, the style of the elements div.mm_page_thumb is written as "width: 263,5px" for example. Because browsers expect decimal numbers in CSS with a dot, they fail in case of the comma, so the width is undefined and the thumbnail is not shown (see screenshot).

This error probably only occurs in german environments, where the decimal point is the comma by default.

I've changed line 524 in MediaManagerRenderer.php, what fixed the problem:

$wrapperWidth =  str_replace(',', '.', $media->thumbWidth) . 'px';

Alternatively, rounding the thumb width will have the same effect, because the decimal part isn't really important on rendering.

Greetings,

Thomas.

Screenshot MM 012 Grid View.jpg

  • Like 2

Share this post


Link to post
Share on other sites
On 5/8/2019 at 2:38 PM, xportde said:

In grid view, there is a small bug in rendering thumbnails: If the calculated width is not a whole number, the style of the elements div.mm_page_thumb is written as "width: 263,5px" for example. Because browsers expect decimal numbers in CSS with a dot, they fail in case of the comma, so the width is undefined and the thumbnail is not shown (see screenshot).

This error probably only occurs in german environments, where the decimal point is the comma by default.

Excellent find! You've saved me some debugging headache, thanks :-). A user reported missing images in grid view (table view was fine) and I couldn't figure out what was going on (I didn't have access to that site) but it was also a German user :-). 

Fixed in the release version (012). Please see post below.

Edited by kongondo

Share this post


Link to post
Share on other sites

Media Manager version 012  (released 10/05/2019)

Happy to announce the latest release of Media Manager.

Changelog

  1. ProcessWire 3.x support only.
  2. New GUI to match AdminThemeUiKit
  3. Upload Anywhere (drag and drop to upload in Media Manager Library and Media Manager Inputfields).
  4. Custom fields/columns - add any field to any of the Media Manager templates and access them as a property of a MediaManager object.
  5. Edit a single media including its custom fields

I would like to thank all the beta testers!

Documentation

Documentation is now complete! Please report any missing links or anything that is not clear.

Upgrading

  1. Grab the latest version of JqueryFileUpload (version 008) from here. Upgrade to that version (note: it is also namespaced)
  2. Grab the latest version of Media Manager using resend download links form here. Simply overwrite existing files but delete the files MediaManagerTabs.php and pocketgrid.css in the old files. Hit module refresh.

You might need to clear compiled files several times.

For most beta testers, upgrading has gone smoothly. However, two people have reported an error about class ProcessMediaManager not found in line 20 of MediaManagerUtilities. I have not been able to resolve this issue. I suspect FileCompiler is trying to be clever or some module loading order change?

Please let me know how it goes.

Beta testers, please upgrade as well. A few things have changed including a fix for the bug reported in the previous post.

Screenshots

media-manager.thumb.jpg.5b8aa9d4cc13f0638f5eb2d1c9f74f5c.jpg

Please refer to the documentation for more photos.

Thanks!

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi @kongondo,

For one of our customers, some pages of the MediaManager image view are not shown, because they contain some too big original images. Referring to this, in error protocol is written the well-known "Allowed memory size of .. bytes exhausted"-message, but we can't find out, what specific image is causing this.

Have you any idea to identify the problematic images?

Best regards,

Thomas.

Share this post


Link to post
Share on other sites
23 hours ago, xportde said:

For one of our customers, some pages of the MediaManager image view are not shown, because they contain some too big original images. Referring to this, in error protocol is written the well-known "Allowed memory size of .. bytes exhausted"-message, but we can't find out, what specific image is causing this.

Oh, oh. Someone forgot to set limits to upload sizes and/or client-side image resizing 😬😀.

23 hours ago, xportde said:

Have you any idea to identify the problematic images?

Good question. I'm not sure whether the code below will work. I don't know whether such images are counted by ProcessWire as uploaded or it is just their resizing that is an issue. I don't have a test image to use but try the below please in a Tracy console and let me know. It is just checking for empties. If it doesn't work maybe we can search by image size (0x260) instead.

$empties = $pages->find("template=media-manager-image,media_manager_image.count=0");
d($empties,'EMPTIES');

 

Share this post


Link to post
Share on other sites

I hope you don't mind me giving a little constructive feedback, it's going to be a bit critical but it's just an aspect that I think is being overlooked in an otherwise excellent module.

I think one thing that is holding me back from embracing this media manager (actually, we bought this in the past and then never used it -- and this is because there's no demo available) is that it really needs a little love in the styling department.

Nothing fancy, but -- if we look at the screenshot above we can see just general CSS issues, alignment of the filter label top right, checkbox and sort icons are too close to the sort options, a lot of negative space between the filters and the nav, image count is too big and not aligned with pagination opposite. The spacing also between the types of media along the top is also not right when compared to how the CMS typically spaces out horizontal navigation. This is just in one screenshot, but these issues persist throughout in various places, such as notifications, upload boxes etc.

Considering we have the UIKit CMS theme to base everything off, this kind of thing means that the media manager feels out of place in an otherwise quite neatly organised CMS.

Now, people using this media manager for their personal projects will not care about these things, they will roll their eyes and say "why should we care, it's the back-end of the site, only functionality matters" (and in this, I must reiterate, you have done an outstanding job), however if I am building a CMS and handing it over to someone else, I need all aspects to have a consistency in quality because that is reassuring to clients.

  • Like 2

Share this post


Link to post
Share on other sites
24 minutes ago, cjx2240 said:

I hope you don't mind me giving a little constructive feedback

Not at all :-). Thanks for the feedback. I value such feedback.

24 minutes ago, cjx2240 said:

and this is because there's no demo available

Actually there is/was...but it is outdated. I can look into this. Meanwhile, one can always test and request a refund if they are not satisfied with the product :-). 

24 minutes ago, cjx2240 said:

Now, people using this media manager for their personal projects will not care about these things, they will roll their eyes and say "why should we care, it's the back-end of the site, only functionality matters" (and in this, I must reiterate, you have done an outstanding job), however if I am building a CMS and handing it over to someone else, I need all aspects to have a consistency in quality because that is reassuring to clients.

Agreed. The thing that confuses me though is that we have hundreds of people using Media Manager, for client projects, some quite big (working with Hollywood; +500K images, etc) but not a single person has ever mentioned design issues. I am not saying this translates to no issues but a I am a bit curious why no one else has raised such issues.

Thanks.

Share this post


Link to post
Share on other sites
39 minutes ago, kongondo said:

Agreed. The thing that confuses me though is that we have hundreds of people using Media Manager, for client projects, some quite big (working with Hollywood; +500K images, etc) but not a single person has ever mentioned design issues. I am not saying this translates to no issues but a I am a bit curious why no one else has raised such issues.

I can only speak for myself. But I feel the same way. I bought the Media Manager, but never used it. Once I used it in a customer project, I had feedback from the customers that the visualization and usability was not good for them. Personally, I'm also a little bothered by that. Why have I never submitted this as a suggestion for improvement? You know: laziness. I always had the hope that others would do it and that there would be an update at some point. 😄 

  • Like 2

Share this post


Link to post
Share on other sites
7 minutes ago, David Karich said:

Once I used it in a customer project, I had feedback from the customers that the visualization and usability was not good for them.

Thanks for the feedback. Was this an older version or the latest (012)?

Share this post


Link to post
Share on other sites
4 minutes ago, kongondo said:

Thanks for the feedback. Was this an older version or the latest (012)?

To be fair, the last version I worked with is 011. Of course there have been some changes with the new version, but optically I see some deficits as well. Apropos: I never received a download link for the update to 012 by mail. Or do I have to buy a new license?

Share this post


Link to post
Share on other sites
13 minutes ago, kongondo said:

Thanks for the feedback. Was this an older version or the latest (012)?

I can also tell you what bothered her the most, besides the visual component. My customers like to think in folders. They would like to click through a tree and categorize the data into folders. As PW itself is structured. Because the biggest problem here again is laziness itself. If you upload a picture and don't immediately describe and tag it properly, later searching becomes difficult. And my customers are all hectic and have no time for that. 😄 

Share this post


Link to post
Share on other sites
1 hour ago, kongondo said:

Agreed. The thing that confuses me though is that we have hundreds of people using Media Manager, for client projects, some quite big (working with Hollywood; +500K images, etc) but not a single person has ever mentioned design issues.

@kongondo Good to know (+500k), do they use $config->pagefileExtendedPaths, an unlimited file system or are there special features of the Media Manager for storing the images?

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 teppo
      Needed a really simple solution to embed audio files within page content and couldn't find a module for that, so here we go. Textformatter Audio Embed works a bit like Textformatter Video Embed, converting this:
      <p>https://www.domain.tld/path/to/file.mp3</p> Into this:
      <audio controls class="TextformatterAudioEmbed"> <source src="https://www.domain.tld/path/to/file.mp3" type="audio/mpeg"> </audio> The audio element has pretty good browser support, so quite often this should be enough to get things rolling 🙂
      GitHub repository: https://github.com/teppokoivula/TextformatterAudioEmbed Modules directory: https://modules.processwire.com/modules/textformatter-audio-embed/
    • By Richard Jedlička
      Tense    
      Tense (Test ENvironment Setup & Execution) is a command-line tool to easily run tests agains multiple versions of ProcessWire CMF.
      Are you building a module, or a template and you need to make sure it works in all supported ProcessWire versions? Then Tense is exactly what you need. Write the tests in any testing framework, tell Tense which ProcessWire versions you are interested in and it will do the rest for you.

      See example or see usage in a real project.
      How to use?
      1. Install it: 
      composer global require uiii/tense 2. Create tense.yml config:
      tense init 3. Run it:
      tense run  
      For detailed instructions see Github page: https://github.com/uiii/tense
       
      This is made possible thanks to the great wireshell tool by @justb3a, @marcus and others.
       
      What do you think about it? Do you find it useful? Do you have some idea? Did you find some bug? Tell me you opinion. Write it here or in the issue tracker.
    • By Chris Bennett
      Hi all, I am going round and round in circles and would greatly appreciate if anyone can point me in the right direction.
      I am sure I am doing something dumb, or missing something I should know, but don't. Story of my life 😉

      Playing round with a module and my basic problem is I want to upload an image and also use InputfieldMarkup and other Inputfields.
      Going back and forth between trying an api generated page defining Fieldgroup, Template, Fields, Page and the InputfieldWrapper method.

      InputfieldWrapper method works great for all the markup stuff, but I just can't wrap my head around what I need to do to save the image to the database.
      Can generate a Field for it (thanks to the api investigations) but not sure what I need to do to link the Inputfield to that. Tried a lot of stuff from various threads, of varying dates without luck.
      Undoubtedly not helped by me not knowing enough.

      Defining Fieldgroup etc through the api seems nice and clean and works great for the images but I can't wrap my head around how/if I can add/append/hook the InputfieldWrapper/InputfieldMarkup stuff I'd like to include on that template as well. Not even sure if it should be where it is on ___install with the Fieldtype stuff or later on . Not getting Tracy errors, just nothing seems to happen.
      If anyone has any ideas or can point me in the right direction, that would be great because at the moment I am stumbling round in the dark.
       
      public function ___install() { parent::___install(); $page = $this->pages->get('name='.self::PAGE_NAME); if (!$page->id) { // Create fieldgroup, template, fields and page // Create new fieldgroup $fmFieldgroup = new Fieldgroup(); $fmFieldgroup->name = MODULE_NAME.'-fieldgroup'; $fmFieldgroup->add($this->fields->get('title')); // needed title field $fmFieldgroup->save(); // Create new template using the fieldgroup $fmTemplate = new Template(); $fmTemplate->name = MODULE_NAME; $fmTemplate->fieldgroup = $fmFieldgroup; $fmTemplate->noSettings = 1; $fmTemplate->noChildren = 1; $fmTemplate->allowNewPages = 0; $fmTemplate->tabContent = MODULE_NAME; $fmTemplate->noChangeTemplate = 1; $fmTemplate->setIcon(ICON); $fmTemplate->save(); // Favicon source $fmField = new Field(); $fmField->type = $this->modules->get("FieldtypeImage"); $fmField->name = 'fmFavicon'; $fmField->label = 'Favicon'; $fmField->focusMode = 'off'; $fmField->gridMode = 'grid'; $fmField->extensions = 'svg png'; $fmField->columnWidth = 50; $fmField->collapsed = Inputfield::collapsedNever; $fmField->setIcon(ICON); $fmField->addTag(MODULE_NAME); $fmField->save(); $fmFieldgroup->add($fmField); // Favicon Silhouette source $fmField = new Field(); $fmField->type = $this->modules->get("FieldtypeImage"); $fmField->name = 'fmFaviconSilhouette'; $fmField->label = 'SVG Silhouette'; $fmField->notes = 'When creating a silhouette/mask svg version for Safari Pinned Tabs and Windows Tiles, we recommend setting your viewbox for 0 0 16 16, as this is what Apple requires. In many cases, the easiest way to do this in something like illustrator is a sacrificial rectangle with no fill, and no stroke at 16 x 16. This forces the desired viewbox and can then be discarded easily using something as simple as notepad. Easy is good, especially when you get the result you want without a lot of hassle.'; $fmField->focusMode = 'off'; $fmField->extensions = 'svg'; $fmField->columnWidth = 50; $fmField->collapsed = Inputfield::collapsedNever; $fmField->setIcon(ICON); $fmField->addTag(MODULE_NAME); $fmField->save(); $fmFieldgroup->add($fmField); // Create: Open Settings Tab $tabOpener = new Field(); $tabOpener->type = new FieldtypeFieldsetTabOpen(); $tabOpener->name = 'fmTab1'; $tabOpener->label = "Favicon Settings"; $tabOpener->collapsed = Inputfield::collapsedNever; $tabOpener->addTag(MODULE_NAME); $tabOpener->save(); // Create: Close Settings Tab $tabCloser = new Field(); $tabCloser->type = new FieldtypeFieldsetClose; $tabCloser->name = 'fmTab1' . FieldtypeFieldsetTabOpen::fieldsetCloseIdentifier; $tabCloser->label = "Close open tab"; $tabCloser->addTag(MODULE_NAME); $tabCloser->save(); // Create: Opens wrapper for Favicon Folder Name $filesOpener = new Field(); $filesOpener->type = new FieldtypeFieldsetOpen(); $filesOpener->name = 'fmOpenFolderName'; $filesOpener->label = 'Wrap Folder Name'; $filesOpener->class = 'inline'; $filesOpener->collapsed = Inputfield::collapsedNever; $filesOpener->addTag(MODULE_NAME); $filesOpener->save(); // Create: Close wrapper for Favicon Folder Name $filesCloser = new Field(); $filesCloser->type = new FieldtypeFieldsetClose(); $filesCloser->name = 'fmOpenFolderName' . FieldtypeFieldsetOpen::fieldsetCloseIdentifier; $filesCloser->label = "Close open fieldset"; $filesCloser->addTag(MODULE_NAME); $filesCloser->save(); // Create Favicon Folder Name $fmField = new Field(); $fmField->type = $this->modules->get("FieldtypeText"); $fmField->name = 'folderName'; $fmField->label = 'Favicon Folder:'; $fmField->description = $this->config->urls->files; $fmField->placeholder = 'Destination Folder for your generated favicons, webmanifest and browserconfig'; $fmField->columnWidth = 100; $fmField->collapsed = Inputfield::collapsedNever; $fmField->setIcon('folder'); $fmField->addTag(MODULE_NAME); $fmField->save(); $fmFieldgroup->add($tabOpener); $fmFieldgroup->add($filesOpener); $fmFieldgroup->add($fmField); $fmFieldgroup->add($filesCloser); $fmFieldgroup->add($tabCloser); $fmFieldgroup->save(); /////////////////////////////////////////////////////////////// // Experimental Markup Tests $wrapperFaviconMagic = new InputfieldWrapper(); $wrapperFaviconMagic->attr('id','faviconMagicWrapper'); $wrapperFaviconMagic->attr('title',$this->_('Favicon Magic')); // field show info what $field = $this->modules->get('InputfieldMarkup'); $field->name = 'use'; $field->label = __('How do I use it?'); $field->collapsed = Inputfield::collapsedNever; $field->icon('info'); $field->attr('value', 'Does this even begin to vaguely work?'); $field->columnWidth = 50; $wrapperFaviconMagic->add($field); $fmTemplate->fields->add($wrapperFaviconMagic); $fmTemplate->fields->save(); ///////////////////////////////////////////////////////////// // Create page $page = $this->wire( new Page() ); $page->template = MODULE_NAME; $page->parent = $this->wire('pages')->get('/'); $page->addStatus(Page::statusHidden); $page->title = 'Favicons'; $page->name = self::PAGE_NAME; $page->process = $this; $page->save(); } }  
    • By Sebi
      Since it's featured in ProcessWire Weekly #310, now is the time to make it official:
      Here is Twack!
      I really like the following introduction from ProcessWire Weekly, so I hope it is ok if I use it here, too. Look at the project's README for more details!
      Twack is a new — or rather newish — third party module for ProcessWire that provides support for reusable components in an Angular-inspired way. Twack is implemented as an installable module, and a collection of helper and base classes. Key concepts introduced by this module are:
      Components, which have separate views and controllers. Views are simple PHP files that handle the output for the component, whereas controllers extend the TwackComponent base class and provide additional data handling capabilities. Services, which are singletons that provide a shared service where components can request data. The README for Twack uses a NewsService, which returns data related to news items, as an example of a service. Twack components are designed for reusability and encapsulating a set of features for easy maintainability, can handle hierarchical or recursive use (child components), and are simple to integrate with an existing site — even when said site wasn't originally developed with Twack.
      A very basic Twack component view could look something like this:
      <?php namespace ProcessWire; ?> <h1>Hello World!</h1> And here's how you could render it via the API:
      <?php namespace Processwire; $twack = $modules->get('Twack'); $hello = $twack->getNewComponent('HelloWorld'); ?> <html> <head> <title>Hello World</title> </head> <body> <?= $hello->render() ?> </body> </html> Now, just to add a bit more context, here's a simple component controller:
      <?php namespace ProcessWire; class HelloWorld extends TwackComponent { public function __construct($args) { parent::__construct($args); $this->title = 'Hello World!'; if(isset($args['title'])) { $this->title = $args['title']; } } } As you can see, there's not a whole lot new stuff to learn here if you'd like to give Twack a try in one of your projects. The Twack README provides a really informative and easy to follow introduction to all the key concepts (as well as some additional examples) so be sure to check that out before getting started. 
      Twack is in development for several years and I use it for every new project I build. Also integrated is an easy to handle workflow to make outputs as JSON, so it can be used to build responses for a REST-api as well. I will work that out in one section in the readme as well. 
      If you want to see the module in an actual project, I have published the code of www.musical-fabrik.de in a repository. It runs completely with Twack and has an app-endpoint with ajax-output as well.
      I really look forward to hear, what you think of Twack🥳!
      Features Installation Usage Quickstart: Creating a component Naming conventions & component variants Component Parameters directory page parameters viewname Asset handling Services Named components Global components Ajax-Output Configuration Versioning License Changelog
    • By Robin S
      Page Reference Default Value
      Most ProcessWire core inputfield types that can be used with a Page Reference field support a "Default value" setting. This module extends support for default values to the following core inputfield types:
      Page List Select Page List Select Multiple Page Autocomplete (single and multiple) Seeing as these inputfield types only support the selection of pages a Page List Select / Page List Select Multiple is used for defining the default value instead of the Text / Textarea field used by the core for other inputfield types. This makes defining a default value a bit more user-friendly.
      Note that as per the core "Default value" setting, the Page Reference field must be set to "required" in order for the default value to be used.
      Screenshot

       
      https://github.com/Toutouwai/PageReferenceDefaultValue
      https://modules.processwire.com/modules/page-reference-default-value/
×
×
  • Create New...