TEIA.RU
Зеленый хостинг ТЭИА

Uptolike

LTCBTC - Bitfinex

Криптоновости

feedspot

Syndicate content My RSS Feed
My RSS Feed
Updated: 48 weeks 2 days ago

Daily Design Inspiration

Fri, 08/31/2018 - 06:13
Daily Design Inspiration AoiroStudio Aug 31, 2018

Part of the Daily Design Inspiration series that started it all on Abduzeedo. This is where you'll find the most interesting things/finds/work curated by one of us to simply inspire your day. Furthermore, it's an opportunity to feature work from more designers, photographers, and artists in general that we haven't had the chance to write or feature about in the past.

For this Daily we are selecting in graphic design, branding, animation and more. Our goal is to diversify the types of work and in the future we can perhaps categorize them in different sections. For now we are going to stick to the simple format of images and links. I hope you enjoy and share with use via Twitter or our Tumblr.

Until further notice, we'll display the images and the titles added to them. Because of little issues we had in the past, the images are still linked to their authors, we just won't mentioned who shared them like we used to.

Daily Design Inspiration daily inspiration
Categories: World News

Flat file CMS

Fri, 08/31/2018 - 04:46

Hey there,

I‘m looking for a flat file cms I could use to build a simple website.

However I want to design/style it myself. I don‘t want to use a premade theme of some kind.

The problem is I only knew HTML, CSS and the basics of JS. I want to avoid PHP.

I Looked into Grav first but since I need PHP/TWIG for it it is out.

Also no GitHub fl CMS, I don‘t want to have any files hosted there.

Is something out there fitting my needs?

submitted by /u/t3ax
[visit reddit] [comments]
Categories: World News

Top 10 Best Graphics Tablets for Drawing, Art & Design in 2018

Fri, 08/31/2018 - 04:45

As a graphic designer, there are many times when the project you’re working on may require you to flex your artistic muscles and pulling out sheets of paper and pencils is unlikely to satisfy the clients’ needs and unless you get it right the first time, is not going to make editing easy.

These days, many artists, illustrators, and graphic designers have started to turn towards using tablets to complete their art projects. A good tablet offers an artist a light, handy, responsive and electronic option to get projects done, even when they aren’t at the office.

Related posts:

While tablets have been around on the marketplace for more than a decade, for professional graphic designers, many of the tablets that would be considered professional grade won’t be available at your local electronics store.

With all of the tablet choices available, today we’re going to narrow it down and take a look at the best graphics tablet for graphic designers. If you’re ready, we’d like to get started by letting you know what you should be on the lookout for when you start shopping so you can make sure that you’re choosing the tablet that’s right for you.

How to choose the right tablet for graphic design

Before purchasing a drawing tablet for your drawing, art, illustrating or graphic design needs, you must consider the tablet’s:

  • active area
  • features
  • hot keys
  • stylus
  • model type
  • pressure sensitivity
  • resolution
  • scrollers
  • wireless or corded
Active Area

The active area can sometimes be referred to as your tablet’s work area. Simply put, it is the area where you stylus reacts and draws on the tablet. Many graphics tablets will come with a plastic edge or bezel which will come between the screen and the casing. Now, you don’t necessarily need a really large area in which to do your work depending on the interface that you are using, but it should be big enough so that it fits your personal style without the problems caused by running out of room.

The active area on most tablets you can purchase is clearly indicated, but it’s a good idea to double check the size of the screen before you buy the tablet. In fact, check the specifications for the tablet and the words ‘active area’ because the last thing you want to have happen is to end up with disappointment when you realize that it doesn’t have enough room to handle the work you are doing.

Additional Features

With a graphics tablet, anytime you see the term additional features, they aren’t necessarily must-have items, but they can be something you may want to consider when you might be on the fence and struggling to choose between two similar tablets. There are some additional features that can be useful such as HotKeys or even a multi-touch capability. If anything, these additional features are designed to help make operating the tablet easier and overall, a more enjoyable experience.

HotKeys

Also known as a shortcut key, it’s becoming more and more common, with the evolution of tablets, to see ones that come with HotKeys built right into the tablet. These keys are designed to help you save time and streamline your work process so you can focus more on getting things done instead of searching for the apps you use the most. Many tablets will allow you to customize as well as program the keys for your favorite shortcuts, while others will pull the shortcuts you use the most into the hotkeys automatically.

Stylus

For a lot of people, a stylus is a little plastic stick that comes with their child’s Nintendo 3DS or that if you’ve seen one stylus, you’ve seen them not. This isn’t the case if you’re a graphic designer or illustrator. For professionals, the best stylus comes in two forms: battery-operated and electromagnetic resonance (EMR). Although there are differences between them, they are designed specifically to mimic the feel of drawing with a regular pen or pencil.

EMR styluses use low energy levels that are generated by the pen’s circuits which reacts with the active area on the tablet. They tend to be thinner that battery-operated styluses and have a thicker point. On the other hand, a battery-operated stylus is designed with a finer point and made to be used for pen-to-tablet drawing.

On-screen or Flat Models

When you’re looking to buy a tablet to use for your projects, you’re going to run into one of two basic tablet designs. Flat and on-screen models. Now, obviously there can be a price difference between the two of them, but which one is better for you generally comes down to personal preference. The LPI (lines per inch) for an on-screen table will generally be the same the LPI for a flat model tablet.

For some though, using a flat model can take some getting used to. Drawing on a tablet while looking at your monitor or laptop screen can be discombobulating at first, while those who prefer drawing on an on-screen tablet are comfortable drawing right on the screen as they do not have any other option.

Pressure Sensitivity

A drawing tablet typically isn’t something that someone would buy unless they need it for a specific purpose such as drawing, illustrating, or graphic design work. The one that is ultimately chosen has many things considered, but one of the most important is the table sensitivity. Everyone has a different drawing or illustration style. Depending on yours, you may want to choose a tablet with an ultra-sensitive and responsive surface.

Another major factor is the pressure sensitivity, although this is a hardware issue for the tablet. Pressure levels on tables start at about 300 levels of pressure and go up to around 3000. In this case, the higher the number, the more responsive the tablet will be for you. For illustrations and design work, the optimal pressure level to look for on a tablet is in the 1024 range.

Resolution

If you work in a field where you need to make very high-resolution images that also have very sharp graphics, picking a tablet with a high LPI would be best suited for you. Think of LPI the same way that people think of 4K resolution found on televisions and computer monitors. with 4K resolution, the image on the screen is as bright and sharp as it can be, a higher LPI can provide the same effect on a tablet.

Scrollers

Moving around the screen on your tablet using the stylus to get around or even your finger could cause mistakes to be made on your project, meaning you’d have to spend more time fixing errors and not meeting your deadline. Thankfully, many tablets have a scroller built into the tablet already. This will help you move around the project quickly without unforeseen errors occurring.

Wireless or Wired

Like the tablet you choose, whether you decide to use a tablet that is wireless or wired is a personal choice. While a wired tablet keeps you at your desk and doesn’t give you the freedom of movement that a wireless tablet may, it will give you a direct connection to your workspace or monitor.

Wireless tablets have become a default choice for a lot of graphic designers. The freedom that it gives you to move around without accidentally pulling on the cord and possibly damaging the tablet is beneficial. However, with a wireless tablet, you’re reliant on having a good connection to your monitor or workspace, which may not be as secure.

Top 10 Best Drawing Tablets for Graphic Designers in 2018

Although everyone will have different requirements, these are the top drawing tablets for designers in 2018 and most likely, 2019.

  1. Wacom Intuos Pro Digital Graphic Drawing Tablet
  2. Huion Inspiroy Q11K Wireless Graphic Drawing Tablet
  3. Parblo Coast10 10.1″ Digital Pen Tablet Display Drawing Monitor
  4. Huion H610 Pro Graphic Drawing Tablet
  5. Wacom Cintiq 13HD Interactive Pen Display
  6. Apple iPad Pro 128GB
  7. Wacom DTH1620K0 Cintiq Pro 16 Graphic Tablet
  8. Huion H420 USB Graphics Drawing Tablet Board Kit
  9. UGEE XP-PEN Star03 Pro Graphics Tablet
  10. XP-PEN Star06C Graphics Tablet

Wacom Intuos Pro Digital Graphic Drawing Tablet

Available in small, medium, and large sizes, the Wacom Intuos Pro Digital Graphic Drawing Tablet also allows you to customize the tablet even further by being able to choose one of three different editions: Regular, paper, and the pro bundle.

Revamped pen technology helps to give you pinpoint accuracy and up to 8192 levels of pressure sensitivity each time you use the tablet. A battery-free, tilt support built-in pen keeps you having to worry about charging it. The included stand as well as its sleek design always keeps your pen within arm’s reach.

Able to support Windows 7 and beyond as well as Mac OS 10.10 and newer. the tablet comes equipped with a USB port. Bluetooth connectivity is supported in paper mode helping you connect to mobile devices as well as a larger active area than some others on the market.

The Wacom Intuos Pro Digital Graphic Drawing Tablet has many features that any illustrator will love including multi-touch gestures, customizable hotkeys, Radical Menus and a pen that comes with easy side switches. It is a quality choice for a graphic designer.

Learn More

($299)

Huion Inspiroy Q11K Wireless Graphic Drawing Tablet

An ergonomically designed tablet can be a good selling point for someone to look for. A tablet with ergonomic design features, like the Huion Inspiroy Q11K Wireless Graphic Drawing Tablet can provide maximum comfort for the person using it The tablet’s design and very large 11-inch active area allow you to get work done quickly and easily, but also allows you to rest your wrist comfortably along the edge of the tablet to help reduce fatigue.

Huion recently upgraded the pen that comes with the tablet with features that include 8192 levels of pressure which can give you the perfect level of accuracy and performance. The strokes you make with the pen ranging from thick lines to hairline designs can be as precise as you need them to be. With its balance and lightweight design as well a rechargeable battery the experience you have with the pen can help you with any project.

The wire-free design allows you to work just about anywhere without the fear of getting cords tangled or causing damage by pulling something off your workspace. While the wireless connectivity will make it easy to connect to the network at work while you’re working away from your desk

The Huion Inspiroy Q11K Wireless Graphic Drawing Tablet can easily become your favourite tablet very quickly. With up to 40 hours of battery life on a single charge and a pen with a built-in nb extractor, you can work all night long without having to worry about your tech failing you.

Learn More

($119)

Parblo Coast10 10.1″ Digital Pen Tablet Display Drawing Monitor

For some, holding a tablet while you work really isn’t best for them to get work done and a tablet that lays flat doesn’t give them the best viewing angle. With the Parblo Coast10 10.1″ Digital Pen Tablet Display Drawing Monitor, you can have a high viewing angle in both horizontal and vertical of 170 degrees so that you can view the tablet’s screen in different ways for optimal comfort. The design is also ergonomic so you can use the screen comfortably whether in your lap, with a desktop or on your workspace.

The pen closely mimics an actual drawing pen and is battery-free to make it more lightweight. Able to operate on the Windows operating system between XP and Vista. The large, 10.1 -inch is bright enough to provide you with an excellent way to complete any design or project you’re working on.

A major bonus that comes with the Parblo Coast10 10.1″ Digital Pen Tablet Display Drawing Monitor is its compatibility with many drawing programs that include Adobe Photoshop, Illustrator, and Fireworks as well as CorelDraw, Infinite Stratos and many more. This can make it very easy to use right out of the box which also comes with a multi-plugin USB cable as well as an artist’s glove.

The Parblo Coast10 10.1″ Digital Pen Tablet Display Drawing Monitor gives any artist a large and vivid tablet that’s easy to work with and with the different viewing angle, it makes getting whatever project you’re working on a breeze.

Learn More

($198)

Huion H610 Pro Graphic Drawing Tablet

With a very large active area measuring 10 by 6.25 inches, the Huion H610 Pro Graphic Drawing Tablet can make working on even the largest projects easier. The surface of the tablet has been redesigned to give it a paper-like feel that enhances the experience while you are designing. That redesigned feel also helps keep the pen from slipping while in use, keeping your work as accurate as you need it to be. Rechargeable, the pen comes with 2048 levels of pressure sensitivity and also has two programmable buttons which you can use for drawing capabilities and precise line work.

Eight customizable buttons and 16 hotkeys adorn the tablet at the top and sides giving you options such as zooming in and out, scrolling as well as mapping them to your own preference. Being able to use this comfortably with either hand adds the level of customization that the Huion H610 Pro Graphic Drawing Tablet provides you with.

The lightweight and thin design of the tablet makes it very easy to carry around, keeping you from being restricted by only working at your desk. An included artist’s glove helps to reduce hand-to-tablet friction and improves the overall drawing experience. To help protect the table from getting nicked or scratched, you can transport the table in the carrying bag that comes along with it,

The Huion H610 Pro Graphic Drawing Tablet is the epitome of customization combined with a large, bright active area. For the price, it is easily a top drawing tablet on our list.

Learn More

($49)

Wacom Cintiq 13HD Interactive Pen Display

Many professionals choose Wacom tablets over other options on the market and its great to see why the Cintiq 13HD Interactive Pen Display is one of them. The tablet is built for customization before you buy it and Wacom offers several different models including a new 13-inch model, a 13-inch pro bundle. and a 16-inch version.

A wide viewing angle and high resolution provide you with an amazing viewing experience while you work directly on the tablet’s screen that gives you a fast and interactive drawing experience. With an HDMI cable included with its purchase, you can connect the table to a monitor if you prefer being able to see what you’re drawing.

A display stand with three different positions allows you to easily adjust the viewing angle so it is easier to view and work on at a comfortable height. A compact. lightweight design allows the table to be carried with you easily. A Rocker Ring, as well as four Express Keys give you even more customization options as well as features multi-touch gestures allowing you to scroll, zoom in and out, pan, and even rotate your project with the simplest touch of the screen.

With its many different model options and focus on not only a lightweight design but high-end display technology, it’s not hard at all to see why the Wacom Cintiq 13HD Interactive Pen Display is a favorite of illustrators and graphic designers alike.

Learn More

($799)

Apple iPad Pro 128GB

The products from Apple need no introduction as they have always provided consumers and professionals high-quality products on the cusp of the best technology available and the iPad Pro 128BG is not different. Touting a lot of benefits already because of its portability and versatility, the iPad Pro has many upgrades over previous versions including HDR video, a TrueTone display, and the new Apple A10X processor.

While it’s not as light as some of the other options that appear on our list, the screen is as crisp and as beautiful as you might expect from an Apple product. Multitasking is a nice feature, allowing you to run two apps side-by-side, giving you the option to draw on one side, while doing research or watching video on the other.

The stylus, known as the Apple Pencil ($95), is arguably the best drawing tool that you can find with a drawing tablet. The response rate of the Pencil will make you feel like you’re using the real thing on a tablet. The hardware is capable of a level of fluidity and naturalness that you cannot find in another stylus. The only downside is that it only works with the iPad Pro, meaning you cannot bring the benefits to a different tablet.

The Apple iPad Pro is a more than capable tablet for your graphic design needs. Between its beautiful TrueTone display and innovative Apple Pencil, if you’re not already using an Apple product for your work, you may consider switching.

Learn More

($999)

Wacom DTH1620K0 Cintiq Pro 16 Graphic Tablet

With any tablet from Wacom, including the DTH1620K0 Cintiq Pro 16 Graphic Tablet, the manufacturer has designed them to give you as many options and choices as possible and that’s no different here. Available in four different varieties, the tablet comes with a gorgeous. high-resolution display, which when you are using the USB-C to USB-C connector to hook it up to a computer..

Categories: World News

High Tide

Fri, 08/31/2018 - 04:43
Categories: World News

Invernesshöjden

Fri, 08/31/2018 - 04:43
Categories: World News

Studio Juice

Fri, 08/31/2018 - 04:43
Categories: World News

Sonar Sound

Fri, 08/31/2018 - 04:43
Categories: World News

Fearful Harmony

Fri, 08/31/2018 - 04:43
Categories: World News

Leclercq Associés

Fri, 08/31/2018 - 04:43
Categories: World News

CriticalMass

Fri, 08/31/2018 - 04:43
Categories: World News

Louis Ansa

Fri, 08/31/2018 - 04:43
Categories: World News

After two hours, I came to a decent point of my first workstation!

Fri, 08/31/2018 - 03:43

https://imgur.com/a/4Hh5shh It only works in 1920x1080 monitors, in smaller ones the padding will go out of the screen, how can I fix? Percentages doesn't seem work

submitted by /u/Roti4MNDS
[visit reddit] [comments]
Categories: World News

WireGuard benchmark between two servers with 10 Gb ethernet

Fri, 08/31/2018 - 02:38

I just ran a benchmark on two of our servers with 10 Gb ethernet cards comparing an unencrypted link vs WireGuard vs OpenVPN using the config files at the end of this post.

I did no optimization for WireGuard, and saw 3 Gbs, which is ~13.4 times faster than the same benchmark run against a simple OpenVPN config. I'm curious if anyone is aware of any optimizations that might speed up WireGuard, or that I should do to OpenVPN to give a more apples-to-apples comparison.

Unencrypted link:

# netperf -t TCP_STREAM -l 60 -H 10.0.9.11 MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.0.9.11 () port 0 AF_INET : demo Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 87380 16384 16384 60.00 9733.28

Encrypted WireGuard link:

# netperf -t TCP_STREAM -l 60 -H 192.168.10.2 MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.10.2 () port 0 AF_INET : demo Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 87380 16384 16384 60.01 3095.09

Encrypted OpenVPN link:

# netperf -t TCP_STREAM -l 60 -H 172.16.1.1 MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 172.16.1.1 () port 0 AF_INET : demo Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 87380 16384 16384 60.03 230.70

WireGuard Server config:

[Interface] PrivateKey = <key removed for security> ListenPort = 49152 [Peer] PublicKey = <key removed for security> AllowedIPs = 192.168.10.0/24 Endpoint = 10.0.9.15:49152

WireGuard Client config:

[Interface] PrivateKey = <key removed for security> ListenPort = 49152 [Peer] PublicKey = <key removed for security> AllowedIPs = 192.168.10.0/24 Endpoint = 10.0.9.11:49152

OpenVPN Server config:

dev tun ifconfig 172.16.1.1 172.16.1.2 secret static.key cipher AES-128-CBC

OpenVPN Client config:

remote cms-depot1.vampire dev tun ifconfig 172.16.1.2 172.16.1.1 secret static.key cipher AES-128-CBC submitted by /u/MetricT
[visit reddit] [comments]
Categories: World News

Nested AjaxAddMore using Drupal FAPI

Fri, 08/31/2018 - 02:01

Using examples module as a reference guide, I'm able to implement the AjaxAddMore functionality into one of my configuration forms, but somehow when I'm trying to achieve the same logic by further enhancing the form with some nested fields it's not working as expected.

Following is the code for the same:

<?php namespace Drupal\custom_config\Form; use Drupal\Core\Form\FormStateInterface; /** * Class MyForm. * * @package Drupal\custom_config\Form */ class MyForm extends ConfigFilesFormBase { /** * {@inheritdoc} */ protected function getEditableConfigNames() { return [ 'custom_config.form', ]; } /** * {@inheritdoc} */ public function getFormId() { return 'my_form'; } /** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('custom_config.form'); $form['information'] = [ '#type' => 'vertical_tabs', '#default_tab' => 'outer_group', ]; // outer_group. $outer_group_items = $this->getMultipleFields($form_state, 'outer_group'); $form_state_outer_group_count = $form_state->get('outer_group_count'); $outer_group_count = isset($form_state_outer_group_count) ? $form_state_outer_group_count : [1]; $form['outer_group'] = [ '#type' => 'details', '#title' => $this->t('Outer Group'), '#group' => 'information', '#tree' => TRUE, ]; $form['outer_group']['fieldset'] = [ '#type' => 'fieldset', '#prefix' => '<div id="outer-group-fieldset-wrapper">', '#suffix' => '</div>', ]; foreach ($outer_group_count as $key => $value) { $form['outer_group']['fieldset'][$key] = [ '#type' => 'fieldset', '#title' => $this->t('Outer Group'), ]; $form['outer_group']['fieldset'][$key]['title'] = [ '#type' => 'textfield', '#title' => $this->t('Outer Group Title'), '#default_value' => $outer_group_items['fieldset'][$key]['title'], ]; $form['outer_group']['fieldset'][$key]['help'] = [ '#markup' => $this->t('Some text!'), ]; // inner_group. $form_state_inner_group_count = $form_state->getValue("outer_group.fieldset.$key.inner_group.fieldset"); $inner_group_count = isset($form_state_inner_group_count) ? $form_state_inner_group_count : [1]; // We have to ensure that there is at least one field. // Value for default. if ($form_state_inner_group_count === NULL && $config->get("outer_group.fieldset.$key.inner_group.fieldset") === NULL) { $form_state_inner_group_count = 1; $form_state->set("outer_group.fieldset.$key.inner_group.inner_group_count", range(1, $form_state_inner_group_count)); } // If has configuration save but not in form state. elseif ($config->get("outer_group.fieldset.$key.inner_group.fieldset") && $form_state_inner_group_count != NULL) { $form_state->set("outer_group.fieldset.$key.inner_group.inner_group_count", $form_state_inner_group_count); } $form['outer_group']['fieldset'][$key]['inner_group']['fieldset'] = [ '#type' => 'fieldset', '#prefix' => '<div id="inner-group-fieldset-wrapper">', '#suffix' => '</div>', ]; $inner_group_array_key = []; foreach ($inner_group_count as $k => $v) { $form['outer_group']['fieldset'][$key]['inner_group']['fieldset'][$k] = [ '#type' => 'fieldset', '#title' => $this->t('Inner Group'), ]; $form['outer_group']['fieldset'][$key]['inner_group']['fieldset'][$k]['id'] = [ '#type' => 'textfield', '#title' => $this->t('Inner Group ID'), '#default_value' => $outer_group_items['fieldset'][$key]['inner_group']['fieldset'][$k]['id'], '#description' => $this->t('Inner Group Description'), ]; $form['outer_group']['fieldset'][$key]['inner_group']['fieldset'][$k]['title'] = [ '#type' => 'textfield', '#title' => $this->t('Inner Group Title'), '#default_value' => $outer_group_items['fieldset'][$key]['inner_group']['fieldset'][$k]['title'], ]; $form['outer_group']['fieldset'][$key]['inner_group']['fieldset'][$k]['actions']['remove'] = [ '#type' => 'submit', '#name' => 'delete_item_' . $k, '#value' => t('Delete Inner Group'), '#submit' => ['::removeOneInnerGroup'], '#ajax' => [ 'callback' => '::innerGroupCallbackWrapper', 'wrapper' => 'inner-group-fieldset-wrapper', ], ]; $inner_group_array_key[] = $v; } $form['outer_group']['fieldset'][$key]['inner_group']['fieldset']['actions'] = [ '#type' => 'actions', ]; $form['outer_group']['fieldset'][$key]['inner_group']['fieldset']['actions']['add'] = [ '#type' => 'submit', '#value' => t('Add Inner Group'), '#submit' => ['::addOneInnerGroup'], '#ajax' => [ 'callback' => '::innerGroupCallbackWrapper', 'wrapper' => 'inner-group-fieldset-wrapper', ], ]; $form['outer_group']['fieldset'][$key]['inner_group']['inner_group_count'] = array( '#type' => 'hidden', '#value' => range(1, $inner_group_array_key), ); $form['outer_group']['fieldset'][$key]['actions']['remove'] = [ '#type' => 'submit', '#name' => 'delete_item_' . $key, '#value' => t('Delete Outer Group'), '#submit' => ['::removeOneOuterGroup'], '#ajax' => [ 'callback' => '::outerGroupCallbackWrapper', 'wrapper' => 'outer-group-fieldset-wrapper', ], ]; } $form['outer_group']['fieldset']['actions'] = [ '#type' => 'actions', ]; $form['outer_group']['fieldset']['actions']['add'] = [ '#type' => 'submit', '#value' => t('Add Outer Group'), '#submit' => ['::addOneOuterGroup'], '#ajax' => [ 'callback' => '::outerGroupCallbackWrapper', 'wrapper' => 'outer-group-fieldset-wrapper', ], ]; return parent::buildForm($form, $form_state); } /** * Gather the fields which are already present in the form. * * @param array $form_state * The current state of the form. * @param string $field * The name of the field. * * @return mixed * Form definition. */ public function getMultipleFields($form_state, $field) { $config = $this->config('custom_config.form'); // Gather the number of fields in the form already. $field_count = $form_state->get($field . '_count'); // We have to ensure that there is at least one field. // Value for default. if ($field_count === NULL && $config->get($field) === NULL) { $field_count = 1; $form_state->set($field . '_count', range(1, $field_count)); return $items = $config->get($field); } // If has configuration save but not in form state. elseif ($config->get($field . '.fieldset') && $field_count == NULL) { $field_count = $config->get($field . '_count'); if (!is_array($field_count)) { $field_count = range(1, $field_count); $field_count = array_flip($field_count); } $form_state->set($field . '_count', $field_count); return $items = $config->get($field); } else { return $items = $form_state->get('not_deleted_items'); } } /** * For more reference: https://drupal.stackexchange.com/a/245484/3808. */ /** * Callback for both ajax-enabled buttons. * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. * * @return mixed * Selects & returns the fieldset with the outer_group in it. */ public function outerGroupCallbackWrapper(array &$form, FormStateInterface $form_state) { return $form['outer_group']['fieldset']; } /** * Callback for both ajax-enabled buttons. * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. * * @return mixed * Selects & returns the fieldset with the inner_group in it. */ public function innerGroupCallbackWrapper(array &$form, FormStateInterface $form_state) { $outer_group = $form_state->getValue('outer_group'); foreach ($outer_group['fieldset'] as $key => $value) { if (is_numeric($key)) { foreach ($value['inner_group']['fieldset'] as $k => $v) { if (is_numeric($k)) { return $form['outer_group']['fieldset'][$v]['inner_group']['fieldset']; } } } } } /** * Submit handler for Add More. Increments the max counter & causes a rebuild. * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. */ public function addOneOuterGroup(array &$form, FormStateInterface $form_state) { $outer_group_count = $form_state->get('outer_group_count'); $last_item = end($outer_group_count) + 1; array_push($outer_group_count, $last_item); $form_state->set('outer_group_count', $outer_group_count); $form_state->setRebuild(); } /** * Submit handler for Add More. Increments the max counter & causes a rebuild. * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. */ public function addOneInnerGroup(array &$form, FormStateInterface $form_state) { $outer_group = $form_state->getValue('outer_group'); foreach ($outer_group['fieldset'] as $key => $value) { if (is_numeric($key)) { $inner_group_count = $value['inner_group']['inner_group_count']; $inner_group_count++; $form_state->set("outer_group.fieldset.$key.inner_group.inner_group_count", $inner_group_count); } } $form_state->setRebuild(); } /** * Submit handler for Remove One. Decrements the max counter & causes rebuild. * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. */ public function removeOneOuterGroup(array &$form, FormStateInterface $form_state) { // Get the triggering item. $element_id = isset($form_state->getTriggeringElement()['#parents']) ? $form_state->getTriggeringElement()['#parents'][2] : ''; if (isset($element_id)) { $config_factory = \Drupal::inner_group('config.factory') ->getEditable('custom_config.form'); if ($form_state->get('outer_group_count') !== NULL) { $outer_group_count = $form_state->get('outer_group_count'); } else { $outer_group_count = $this->config('custom_config.form')->get('outer_group_count'); } $outer_group = $config_factory->get('outer_group'); unset($outer_group_count[$element_id]); $form_state->set('outer_group_count', $outer_group_count); unset($outer_group['fieldset'][$element_id]); $config_factory->set('outer_group', $outer_group); $config_factory->save(); } // Rebuild the form. $form_state->setRebuild(); } /** * Submit handler for Remove One. Decrements the max counter & causes rebuild. * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. */ public function removeOneInnerGroup(array &$form, FormStateInterface $form_state) { // Get the triggering item. $element_id = isset($form_state->getTriggeringElement()['#parents']) ? $form_state->getTriggeringElement()['#parents'][2] : ''; $outer_group = $form_state->getValue('outer_group'); if (isset($element_id)) { foreach ($outer_group['fieldset'] as $key => $value) { if (is_numeric($key)) { if ($form_state->get("outer_group.fieldset.$key.inner_group.inner_group_count") !== NULL) { $inner_group_count = $value['inner_group']['inner_group_count']; } else { $inner_group_count = $this->config('custom_config.form')->get("outer_group.fieldset.$key.inner_group.inner_group_count"); } } } $config_factory = \Drupal::inner_group('config.factory')->getEditable('custom_config.form'); $inner_group = $config_factory->get("outer_group.fieldset.$key.inner_group.inner_group_count"); unset($inner_group_count[$element_id]); $form_state->set("outer_group.fieldset.$key.inner_group.inner_group_count", $inner_group_count); unset($inner_group['fieldset'][$element_id]); $config_factory->set('inner_group', $inner_group); $config_factory->save(); } // Rebuild the form. $form_state->setRebuild(); } /** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); $this->config('custom_config.form')->set('outer_group_count', $form_state->get('outer_group_count'))->save(); $this->config('custom_config.form')->set('outer_group', $form_state->getValue('outer_group'))->save(); } }

After a lot of debugging, it seems that there's an issue with innerGroupCallbackWrapper but not sure what exactly.

N.B: AjaxAddMore for OuterGroup is working as expected.

Any guidance will be appreciated!

Categories: World News

View Content:Path Rewrite Result doesn't update

Fri, 08/31/2018 - 02:01

The Content:Path is used to create a Read More button, that redirects the user to another page from View.

It had a previous Rewrite Result of:

<a href="[path]" > Read More </a>

I want the change the string to See More, so I thought it would be a easy change. Boy was I wrong.

No matter what I input into the Rewrite Results output field, it will always default to display Read More (with it's class and href). I can write gibberish, and the View wouldn't show what I wrote and default back to Read More (though preview does display accordingly).

The only time I can get it to display different is when I leave the field empty, or disable Rewrite Result functionality, which it defaults to the content path.

Can anyone explain this weird behaviour? I've done some checks if there's a hook influencing the view, but couldn't find anything.

Categories: World News

Make drupal commerce cart ignore empty edit quantity field

Fri, 08/31/2018 - 02:01

The thing is that I have an ajaxified edit quantity field on cart line items and whenever a user removes the default value (in order to enter the quantity that he wants), he ends up deleting a line item from a cart. What code strings are responsible for such a behaviour and in what file can I find them? Already looked in commerce_cart.module, commerce_line_item module and commerce_line_item_handler_field_edit_quantity.inc.

Categories: World News

Просто хороший хостинг