ukyo Posted January 30, 2015 Share Posted January 30, 2015 FieldtypeFontIconPicker This field-type allow to you easily pick icons from input-field. This module using jQuery fontIconPicker as icon selector. You can see supported icon libraries below. If you need to use custom fonts you can check below example. Supported Icon Libraries FontAwesome 4.7.0 Uikit 3.0.34 IonicIcons 2.0.1 Cahangelog NOTE: Module store data without prefix, you need to add "prefix" when you want to show your icon on front-end, because some of front-end frameworks using font-awesome with different "prefix". Module will search site/modules/**/configs/IconPicker.*.php and site/templates/IconPicker.*.php paths for FieldtypeFontIconPicker config files. All config files need to return a PHP ARRAY like examples. Example config file : create your own icon set. File location is site/configs/IconPicker.example.php <?php namespace ProcessWire; /** * IconPicker : Custom Icons */ return [ "name" => "my-custom-icons", "title" => "My Custom Icon Set", "version" => "1.0.0", "styles" => array( wire("config")->urls->templates . "dist/css/my-custom-icons.css" ), "scripts" => array( wire("config")->urls->templates . "dist/js/my-custom-icons.js" ), "categorized" => true, "attributes" => array(), "icons" => array( "brand-icons" => array( "title" => "Brand Icons", "icons" => array( "google", "facebook", "twitter", "instagram" ) ), "flag-icons" => array( "title" => "Flag Icons", "icons" => array( "tr", "gb", "us", "it", "de", "nl", "fr" ) ) ) ]; Example config file : use existing and extend it. File location is site/configs/IconPicker.altivebir.php <?php namespace ProcessWire; /** * IconPicker : Existing & Extend */ $resource = include wire("config")->paths->siteModules . "FieldtypeFontIconPicker/configs/IconPicker.uikit.php"; $url = wire("config")->urls->templates . "dist"; $resource["scripts"] = array_merge($resource["scripts"], ["{$url}/js/Altivebir.Icon.min.js"]); $resource["icons"]["flag-icons"] = [ "title" => "Flag Icons", "icons" => array("tr", "en", "fr", "us", "it", "de") ]; $resource["icons"]["brand-icons"]["icons"] = array_merge($resource["icons"]["brand-icons"]["icons"], array( "altivebir" )); return $resource; After you add your custom config file, you will see your config file on library select box. Library Title (Location Folder Name). If your library categorized and if you have categorized icons set like uikit and fontawesome libraries, you will have category limitation options per icon field or leave it empty for allow all categories (default). Example : output if ($icon = $page->get("iconField")) { echo "<i class='prefix-{$icon}' />"; } MarkupFontIconPicker Usage // MarkupFontIconPicker::render(YourIconField=string, Options=array) echo MarkupFontIconPicker::render($page->YourIconField, [ 'prefix' => 'uk-icon-', // Icon class prefix, if you have different prefix, default is : "fa fa-" 'tag' => 'span', // Icon tag default is : "i" 'class' => 'fa-lg', // If you have extra cutom classes, for example : icons sizes, Array or Sting value 'style' => 'your custom styles if you have' // Array or String Value ]); Theme support Search support Category support 13 Link to comment Share on other sites More sharing options...
adrian Posted January 30, 2015 Share Posted January 30, 2015 Great work - just playing with it now and it's really slick - thanks for the contribution! One thing I noticed - not a big deal, but when you search by text, with "From all categories" selected, it duplicates the matching icons. Also, out of interest, did you see this: http://processwire.com/blog/posts/processwire-core-updates-2.5.15/#new-icon-selection-module-in-the-core It's an Inputfield, but not a Fieldtype, so it can't be used in templates as is, but I wonder how these two modules could be consolidated, or maybe they should remain completely separate - just thinking out loud - I have no idea whether Ryan is planning a matching fieldtype for his module. Link to comment Share on other sites More sharing options...
ukyo Posted January 31, 2015 Author Share Posted January 31, 2015 Great work - just playing with it now and it's really slick - thanks for the contribution! One thing I noticed - not a big deal, but when you search by text, with "From all categories" selected, it duplicates the matching icons. Also, out of interest, did you see this: http://processwire.com/blog/posts/processwire-core-updates-2.5.15/#new-icon-selection-module-in-the-core It's an Inputfield, but not a Fieldtype, so it can't be used in templates as is, but I wonder how these two modules could be consolidated, or maybe they should remain completely separate - just thinking out loud - I have no idea whether Ryan is planning a matching fieldtype for his module. Thanks for your feedback ! I think, duplicate problem is not actually a problem. Why ? : I took all icons from font-awesome website by categorized and 1 icon may in more than 1 category. I see @Ryan module, i am trying to use always dev version of processwire and i can follow updates, new things better, but you can't use it on page as a field. @Ryan solution is good for templates and field icons select. If you think from customer side : Simple example, think you have links page for social network website. You need an icon for each link page and you can easily select icon from select list. you don't need to search icon class inside font-awesome website or inside a icon class guide. Just select it from list. Also its possible to limit icons from input setting tab by category. Link to comment Share on other sites More sharing options...
ukyo Posted January 31, 2015 Author Share Posted January 31, 2015 V.0.0.2 MarkupIconPicker Markup added. 4 Link to comment Share on other sites More sharing options...
Pete Posted February 3, 2015 Share Posted February 3, 2015 Great work - I have a few sites I could use this on! If you submit this to the modules directory I will happily tag you as a module author on your dev profile too Link to comment Share on other sites More sharing options...
ukyo Posted February 3, 2015 Author Share Posted February 3, 2015 Yes, I submit it. Waiting for approve. Also if you can, can you correct the url of my dev profile False -> /alt-ve-bir-bilisim-teknolojileri/ (Loosing small "ı") True -> /alti-ve-bir-bilisim-teknolojileri/ (Turkish characters ). ı -> i note: I added logo also again. When you make post on dev form profile, if validation is not ok fields coming as blank field. Link to comment Share on other sites More sharing options...
adrian Posted February 8, 2015 Share Posted February 8, 2015 Having a small z-index problem Link to comment Share on other sites More sharing options...
ukyo Posted February 9, 2015 Author Share Posted February 9, 2015 Having a small z-index problem Screen Shot 2015-02-08 at 5.19.31 PM.png Thanks for your feedback! Z-index problem causing from content section ("<div id='content' class='content'>"). Icon selector z-index value is "10000" and not effecting outside of "content" section, if you add z-index value = 2, to "<div id='content' class='content'>" element its looking ok. Need a hack for ("<div id='content' class='content'>") section by jquery or core team can add a z-index value for this section. If core team can do it, i don't need a hack for z-index. If they can't i can add a little hack for this problem. Will wait for core team answer. Link to comment Share on other sites More sharing options...
Soma Posted February 9, 2015 Share Posted February 9, 2015 But PW has the "<div id='content' class='content'>" with z-index: 0, jquery is fine. I don't see a reason why PW needs a z-index: 0 there at all as it will result all absolute containers inside #content underlap #footer cause #footer has no z-index. Link to comment Share on other sites More sharing options...
ukyo Posted February 9, 2015 Author Share Posted February 9, 2015 Z-index values looking ok, but how copyright informations coming up? When i check page render result with firebug, footer section looking ok, .container element inside footer section coming up of absolute element. My solution is hack #content element or #footer .container element by little jquery code. Add a z-index value when document ready to #content "z-index: 2;" or #footer .container "z-index: -1;". Problem solve with this method. You can change InputfieldFontIconPicker.module line 94 with this code, I will update repo also : $output .= "\n<script> \n\tjQuery(document).ready(function($) { \n\t\t$('#{$options['id']}').fontIconPicker({ \n\t\t\tsource: {$options['icons']}, \n\t\t\t{$settings} \n\t\t}); \n\t\tif($('#content').length) { \n\t\t\t$('#content').css('z-index', 2); \n\t\t} \n\t}); \n</script>"; Link to comment Share on other sites More sharing options...
Soma Posted February 9, 2015 Share Posted February 9, 2015 Ugly things! PW should remove the z-index:0 from #content. No need to add it and if there's a reason it can be solved differently by adding z-index: 0 to footer too, but then why? PW has that wrong not your module or the plugins so PW needs to sort that out cause it's a ”bug". It's like "adding !important to all elements that need overriding specification problems in you CSS". Z-index values looking ok, but how copyright informations coming up? #header (stacking order 1) #content (stacking order 1) #footer (stacking order 1) now a "z-index: 0" to #content will make it #header (stacking order 1) #content (stacking order 0) #footer (stacking order 1) So content is "under" footer now. Link to comment Share on other sites More sharing options...
bernhard Posted February 17, 2015 Share Posted February 17, 2015 couldn't try it, because i got this error when i tried to install it Parse Error: syntax error, unexpected '[' (line 20 of /httpdocs/site/modules/FieldtypeFontIconPicker/FieldtypeFontIconPicker.module) pw 2.5.17 Link to comment Share on other sites More sharing options...
bernhard Posted February 20, 2015 Share Posted February 20, 2015 ok, this issue comes from the array notation! $array = array($foo, $bar); // is ok $array = [$foo, $bar]; // only php version 5.4+ had this issue today with a different module so i thought it was not specific to this module and did some research... Link to comment Share on other sites More sharing options...
ukyo Posted February 20, 2015 Author Share Posted February 20, 2015 ok, this issue comes from the array notation! $array = array($foo, $bar); // is ok $array = [$foo, $bar]; // only php version 5.4+ had this issue today with a different module so i thought it was not specific to this module and did some research... For compatibility, i will change [$foo, $bar] to array($foo, $bar). - Edit : Done. You can update module. 1 Link to comment Share on other sites More sharing options...
dazzyweb Posted March 15, 2015 Share Posted March 15, 2015 I don't know what I am doing wrong but I can't get this module to work. I tried it on a fresh install of processwire 2.5.3 I just get as the image shows below. No way to pick an icon. Link to comment Share on other sites More sharing options...
ukyo Posted March 16, 2015 Author Share Posted March 16, 2015 I don't know what I am doing wrong but I can't get this module to work. I tried it on a fresh install of processwire 2.5.3 I just get as the image shows below. No way to pick an icon. Capture.JPG I created Module with last dev version. Let me check for last stable version and i can see what is problem for oldest versions. Edit: Problem solved can you confirm after update to v0.0.5 2 Link to comment Share on other sites More sharing options...
dazzyweb Posted March 17, 2015 Share Posted March 17, 2015 Thanks. That appears to work fine now. Link to comment Share on other sites More sharing options...
GeraldSchmidt Posted May 20, 2015 Share Posted May 20, 2015 Nice module! Love the good work ( Ellerine saglik ukyo ;-) ) I would like to know if it's possible to include the icon package of foundation http://zurb.com/playground/foundation-icon-fonts-3 regards, Gerald Link to comment Share on other sites More sharing options...
NorbertH Posted June 5, 2015 Share Posted June 5, 2015 On Install i get : Parse error: syntax error, unexpected '[' in /somepath/site/modules/FieldtypeFontIconPicker/InputfieldFontIconPicker.module on line 22 I guess this is because that server uses php 5.4. that does not support the new [] Syntax. The funnie thing about that is that it should support it ! Link to comment Share on other sites More sharing options...
ukyo Posted June 12, 2015 Author Share Posted June 12, 2015 Nice module! Love the good work ( Ellerine saglik ukyo ;-) ) I would like to know if it's possible to include the icon package of foundation http://zurb.com/playground/foundation-icon-fonts-3 regards, Gerald Yes its possible, you can configure module as your needs On Install i get : Parse error: syntax error, unexpected '[' in /somepath/site/modules/FieldtypeFontIconPicker/InputfieldFontIconPicker.module on line 22 I guess this is because that server uses php 5.4. that does not support the new [] Syntax. The funnie thing about that is that it should support it ! - Corredted with last commit, you can download 0.0.6 version 1 Link to comment Share on other sites More sharing options...
saschapi Posted October 11, 2015 Share Posted October 11, 2015 Hi! Awesome Module (pun intended) This would turn out very usefull for my next project, However I get some strange behaviour when leaving an edit page without changing anything on the icon. It gives me a confirm box saying there is unsaved content (see attachment). Does anybody have the same behaviour or knows what I do wrong here? Thanks for any suggestion. Sascha Link to comment Share on other sites More sharing options...
ukyo Posted October 19, 2015 Author Share Posted October 19, 2015 Thanks, I will check this. Link to comment Share on other sites More sharing options...
saschapi Posted December 2, 2015 Share Posted December 2, 2015 Hi ukyo, did you find anything? Link to comment Share on other sites More sharing options...
David Bopp Posted December 3, 2015 Share Posted December 3, 2015 Great extension! Very useful for a project of mine, thank you! I have the same problem as saschapi. I save my page. Next I want to leave, I get a browser message (firefox) telling me that I have unsaved data. Google translation from German: "This page asks you to confirm that you want to leave the page - data you have entered will not be saved under certain circumstances." Link to comment Share on other sites More sharing options...
ukyo Posted December 3, 2015 Author Share Posted December 3, 2015 Hi ukyo, did you find anything? Great extension! Very useful for a project of mine, thank you! I have the same problem as saschapi. I save my page. Next I want to leave, I get a browser message (firefox) telling me that I have unsaved data. Google translation from German: "This page asks you to confirm that you want to leave the page - data you have entered will not be saved under certain circumstances." Hi! Awesome Module (pun intended) This would turn out very usefull for my next project, However I get some strange behaviour when leaving an edit page without changing anything on the icon. It gives me a confirm box saying there is unsaved content (see attachment). Does anybody have the same behaviour or knows what I do wrong here? Thanks for any suggestion. Sascha Sorry i am to busy with work and i know the issue. I think this issue appear, because fonticonpicker js library changing the processwire field attributes. I will do one more hidden field for fonticonpicker js attributes and after done i will update processwire field. Started to work on it. Thanks for interest ! 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now