texts: How to run alterRoutes on particular condition ? Does it run on cache clear and not on normal Request?

texts:
I am trying to implement a feature where I need to run different flow than default flow while the registering user on the site.

I am trying to alter the route of "user password reset" for the for the first time logging users, Below is the code

    <?php

    namespace Drupal\developer_registration\Routing;

    use Drupal\Core\Routing\RouteSubscriberBase;
    use Symfony\Component\Routing\RouteCollection;
    use Symfony\Component\HttpFoundation\Request;

    /**
     * Listens to the dynamic route events.
     */
    class RouteSubscriber extends RouteSubscriberBase {

      /**
       * {@inheritdoc}
       */
      protected function alterRoutes(RouteCollection $collection) {
      // The Test is getting printed on only cache clear and not on URL Hit
      echo "Test"; exit;

      if(isset($_SESSION['developer_registration']['email_id'])) {

       if ($route = $collection->get('user.reset')) {
                 $route->setDefaults(array(
                 '_controller' => '\Drupal\developer_registration\Controller\UserCustomController::setPasswd',
              ));
             }
          }
       }
 }

The problem is that above alterRoute method doesn't runs on the URL hit. It only runs on cache. But my problem is that I want to  run alter route on particular condition.

I am not getting the way to do the same. Please help me.


texts:
The goal is to hack core so that the search module will populate the search_node_links table from uuid-link hrefs in node content.

Planned approach is to modify the parsing functions of search_index in the core search.module.

The targeted section of code is lines 633-643 of search.module.

if (preg_match($node_regexp, $value, $match)) {
  $path = drupal_get_normal_path($match[1]);
  if (preg_match('!(?:node|book)/(?:view/)?([0-9]+)!i', $path, $match)) {
    $linknid = $match[1];
    if ($linknid > 0) {
      $node = db_query('SELECT title, nid, vid FROM {node} WHERE nid = :nid', array(':nid' => $linknid), array('target' => 'slave'))->fetchObject();
      $link = TRUE;
      $linktitle = $node->title;
    }
  }
}

The plan is to use entity_uuid_load to grab the nid directly like so:

if (preg_match($uuid_regexp, $value, $match)) {
  $entity = entity_uuid_load('node',$match);
  $linknid = key($entity);
  if ($linknid > 0) {
    $node = db_query('SELECT title, nid, vid FROM {node} WHERE nid = :nid', array(':nid' => $linknid), array('target' => 'slave'))->fetchObject();
    $link = TRUE;
    $linktitle = $node->title;
  }
}

I've used this code to pull a node title with $value set to an HTML snippet containing a UUID-href link; however, this still seems to fail to populate the search_node_links table.

$uuid_regexp is working as expected, but here it is for reference along with $node_regexp for comparison.

$node_regexp = '@href=[\'"]?(?:' . preg_quote($base_url, '@') . '/|' . preg_quote(base_path(), '@') . ')(?:\?q=)?/?((?![a-z]+:)[^\'">]+)[\'">]@i';
$uuid_regexp = '@href=[\'"]?(?:\[uuid-link:node:)([0-9a-f]{8}-(([0-9a-f]{4}-){3})[0-9a-f]{12})(?:\])(?:[\'">])@i';

And here is the UUID link format:

UUID link

I'm sure there's something I'm just not seeing in search.module that is preventing this from working as desired. Any comments/support/pointers would be greatly appreciated.

UPDATE: Finding now that it's not UUIDs causing the issue, but aliased paths instead (probably combined with Global Redirect module). Tried the following code instead, still no change in search_node_links.

if (preg_match($node_regexp, $value, $match)) {
  $clean_url = preg_split('![(en)|(fr)]/!', $match[1])[1];
  $path = drupal_lookup_path("source", $clean_url);
  if (preg_match('!(?:node|book)/(?:view/)?([0-9]+)!i', $path, $match)) {
    $linknid = $match[1];
    if ($linknid > 0) {
      $node = db_query('SELECT title, nid, vid FROM {node} WHERE nid = :nid', array(':nid' => $linknid), array('target' => 'slave'))->fetchObject();
      $link = TRUE;
      $linktitle = $node->title;
    }
  }
}

Again, this code is able to pull a node title but is not contributing to search_node_links.


texts:
How can I set an expiration date on a product variation?
I am building a webshop and my goal is to have an expiration date on a product variation, meaning the after a scheduled date, the product would no longer be available to sell, so it would automatically unpublish. Also, vice versa, the product variation might have a publishing date.
Currently I am looking at scheduler, but that is for nodes, not for products. Is there another way of doing this?


texts:
I am trying to display message or run some other action when user logout and redirect them to home page. I am trying following code, but all I get is just set_message and it never logoff me. why?

/**
 * Implements hook_user_logout().
 *
 */
function ucenter_user_logout($account) {
  drupal_set_message(t('Thanks for visiting, come again!'));
  drupal_goto();
}


texts: Media Browser in WYSIWYG editor doesn't allow uploads for non-admins

texts:
As admin everything works as expected. I can upload images. As a non-admin user I can use the "Web" and "Library" functions but not the file upload function.

I have it enabled:

And the user has the correct permissions applied:


texts: Redirect all pages to a form unless the user has filled out some information (Drupal 7)

texts:
I need to bring up some sort of dialog or form to collect user information when they first login. Is there anyway that the user can be redirected to a form that they must fill out before they can proceed when they first login?

I need to do this because we need to collect information from users who have already created accounts and will not have entered the information that we are adding to the user node.

EDIT: I really want to force the user to fill out this form if they have not, so what I am really looking for is a way to redirect all pages on the Drupal site to this form unless they have filled it out.


texts: How to add a custom variable that can be accessed on bootstrap's menu--account.html.twig?

texts:
I have a custom theme (subtheme of drupal bootstrap theme).  We are overriding menu--account.html.twig.  So I copied menu--account.html.twig from the bootstrap theme template folder into my theme's template folder, and I verified this template is being used because static text changes I added show up on screen.

Now I'm trying to add a variable that the menu--account.html.twig template can read.

How do I do that?  My variable's name is 'nickname'.  I tried this:

 function mymodule_preprocess_menu__account(&$variables)
 {
     $variables['nickname'] = 'Jeff';
 }

The variable is added to the array, and I can see it if I use dpm, but when I reference {{nickname}} in the template it's always null.

I also read I had to define the variable like this:

 function candidate_poral_theme_registry_alter(&$theme_registry)
 {
   $theme_registry['menu__account']['variables']['nickname'] = 'default';
 }

But that also doesn't work.

Any assistance would be welcome.


texts: Webform template for all webforms in content type

texts:
I have content type with attached webforms. There is currently 8 nodes with webforms. Is there a way to create one webform template for all of this webforms? Because right now I'm using multiple templates, like this:
- webform-form-11.tpl.php
- webform-form-12.tpl.php
- webform-form-13.tpl.php

But I want this:
 - webform-form-contenttypename.tpl.php

Is this possible?


texts: Re-write output on different images on Views Slideshow

texts:
Using this - tutorial

I have a views slideshow that rotates images with a fade effect.
I know you can re-write output to show images and a text field below but so far I can just add one text block - I want each image to have its own text!


texts: site returns 404 on every request, except /

texts:
After my site is moved from a shared hosting plan to VPS (dreamhost), all request returns:

  Not Found

  The requested URL /index.php was not found on this server.

  Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

For example.com/, it does returns some content. Any other requests (e.g. example.com/install.php) returns 404.

Rewrite settings are as default:

RewriteEngine on

# RewriteBase /

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

What should I check?

Update:

If I request example.com/? or example.com/?q=user, it returns:

  Site Temporarily Unavailable
  We apologize for the inconvenience. Please contact the webmaster/ tech support immediately to have them rectify this.

  error id: "bad_httpd_conf"


texts: How do I pass a value to a content type field with a custom submit please

texts:
and thank you for your patience in helping me learn

I have created a content type called response (Through Drupal, not in a custom module)

In the content type I have a field called field_response_number which is a text field.

When I create new content for the response content type and press submit I want to first submit the form, then run a custom submit afterwards that populates my field_response_number based on the result of a custom function.

I can submit and call my custom form submit function fine, but how do I get the total returned from my custom function to populate the field_response_number please

So my work flow is

Create new response content
Submit results in form and then call custom submit handler
Get count from DB
Populate the field_response_number with the result
Display result

Can anyone assist please, as I think I'm almost there

My code is as follows

function testmodule_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  foreach (array_keys($form['actions']) as $action) {
    if ( $form_id == 'node_response_form'){
      if ($action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
        $form['actions'][$action]['#submit'][] = 'testmodule_form_submit';
      }
    }
  }
}

function testmodule_form_submit(array $form, FormStateInterface $form_state){
  // This works
  //$result = testmodule_get_node_count('response');
  //drupal_set_message($result);

  How do I populate my field_response_number here please
}

//This handles incrementing by one I want to use to populate the field_response_number with
function testmodule_get_node_count($content_type) {
  $query = "SELECT COUNT(*) FROM {node} n ".
           "WHERE n.type = :type";
  $total = db_query($query, array(':type' => $content_type))->fetchField();
  return $total;
}

Many Thanks for your assistance


texts: Display a menu on all pages except a specific page type

texts:
In my site, I have a menu that should be displayed on all pages, except on pages of a certain type.

In "admin -> structure -> blocks" I can set the visibility parameters of this menu to "pages of a certain type", and check all page types except the one I dont want. This has 2 problems :

1) whenever I add a new page type, I need to update this menu visibility (minor problem)

2) the menu will not be visible except on pages. For example, on the contact page, there is no menu.

What should be the right way to do that ?


texts: How can I open Poll for Anonymous users?

texts: I wonder how I can open my poll for everyone including anonymous users, not just registered users.


texts: Drupal 7 multilanguage front page using templates

texts:
I need to have 2 separate front page tpl pages for a multilanguage site I'm building, one for the english layout and one for the chinese layout. If the default language is zh-hans, I would like it to serve the custom tpl page-cnfront.tpl.php.

I managed to find an answer to my question for Drupal 6, which provided the following code:

function mytheme_preprocess_page(&$variables) {
  global $language;
  if (drupal_is_front_page() && $language->language == 'en') {
    $variables['template_file'] = 'page-customfront';
  }
}

I tried to modify it for my site in Drupal 7 like so:

function mytheme_preprocess_page(&$vars) {
  global $language;
  if (drupal_is_front_page() && $language->language == 'zh-hans') {
    $vars['theme_hook_suggestions'] = 'page__cnfront';
  }
}

but I think something is wrong, because I get a WSOD when I add this to my template.php.
What is the correct way to do this?


texts: Add a youtube video in the template file using url

texts: I've tried using this code <?php print theme('video_embed_field_embed_code', array('url' => $video['http://www.youtube.com/embed/Zz1HPLtecOg'])); ?> but it only displays the url and doesnt show the video. How can I fix this?


texts: add code automatically for any article/post

texts:
I built a Drupal website with a custom theme, but in the last stand I need to add a specific code after any post/article published on the site. For example:

article 1

code

article 2

the same code...

The pinpoint is that I don't know how to take a reference of a single post/article to include it in a buckle to add this code.


texts:
i would show a page not themed by drupal from a specific path from my custom module.

I'm using drupal7.

Here is the example module:

file: custom_example.module

<?php
/*
 * Implementation of hook_menu()
 */
function custom_example_menu(){
  $items['foo/bar'] = array(
    'title' => 'Page Title',
    'description' => 'Simple custom hook_menu() implementation.',
    'page callback' => 'my_page_function',
    'access arguments' => array('access content'),
  );
  return $items;
}

/*
 * Returns custom content to Drupal
 */
function my_page_function(){
   return theme('my_custom_template');
}

/*
 * Implementation of hook_theme().
 */
function custom_example_theme(){
  return array(
    'my_custom_template' => array(
      'template' => 'custom-page',
    ),
  );
}

file:custom-page.tpl.php

hello

This works fine to show the page at mysite.com/foo/bar link but the page is themed with all drupal stuffs (header footer sidebar) that i don't want.

Thanks all


texts: How to add a class to the  link elements within a Multiple Values field in a View?

texts:
I have a Views field (in this case, taxonomy term references) with Multiple Values set to "Display all values in the same row", using the Link formatter and a seperator. I want to add a class to each "multiple values"  element within this one field. My output currently looks like this:

  Some name
  ,
  Another name

I simply want to add classes to the multiple links within the field (and not the the wrapper), like this:

  Some name
  ,
  Another name

While my fields are taxonomy term references ideally I'd like to know how to do this with any of the many fields that use the "Link" formatter.

Note that this field is included with other fields using a replacement pattern in a custom text field, which unfortunately seems to prevent field tpl.php options from working.

This seems like it should be simple, but I can't find a way even after trying all these things:

Every combination of Views  Multiple Field Settings (which contain no means to add a class) and Style Settings (which only affect the field wrapper, not each of the multiple items)
Reading about twenty related questions on here, none of which combine all the elements in my question (CSS class, views, multiple value field), I couldn't find anything that actually works, and the only suggestions that sound like they might work were to use Display Suite, which is a great module but way too big an added overhead for something so minor as adding some classes to some links, or giving up, cheating and adding the class client-side in jQuery, or brute force with Views PHP. Most answers don't apply to Multiple Values fields (even when the asker specified such). This suggestion based on hook_preprocess_field looks perfect, but it doesn't get called from Views.
Hacking through the objects available in hook_preprocess_views_view_field() and hook_views_view_field__[view_name]__[view_style]__[field_name](). The former seems to treat multiple field items as a lump and not allow changes to each, the latter, when trying to do something like this, just wouldn't change anything at all
Scouring Views and Drupal Core's tpl.php files, and Views' handler for links. No changes here seemed to make any difference.
Checking the Views issue queue. I found a feature request and non-committed patch, adding the ability to set a class like this - but it only applies to multiple field items that are set to be a list item, not seperator-separated items.
I've considered creating a custom Views field formatter, but that seems like a terrible solution given that I'd simply be duplicating the existing Link formatter then adding a class. I've looked for a way to hook in to an existing formatter but haven't found one.


texts: Limit amount of adding a certain Paragraph per Content type

texts:
I use Drupal 8 Paragraphs module.

I created a Content type Landingpage.

I create some Paragraph types like Hero Image, Intro text etc.

In the Content type Landingpage I created a Paragraph Entity reference revisions field. In the REFERENCE TYPE, the Paragraph types Hero Image, Intro text are selected.

How do I manage the site editor is able to only insert one time (one value), the Hero Image Paragraph type? Because it doesn't make sense to have more then one Hero image section on the website...


texts:
I have developed a multilingual blog (two languages). Some of my articles are both languages.

I'm trying to do the following:

As you can see, this article is tagged with the 'Drupal Gardens' tag: (This is not my site. It's a blog with the functionality I would like to implement)

http://reyero.net/es/drupal/construyendo_sitios_web_multilingues_con_drupal_gardens

When you click on the taxonomy link, the next page is showing the articles with the 'Drupal Gardens' tag, but only in spanish.
http://reyero.net/es/taxonomy/term/85

Then, if you change the language to english http://reyero.net/taxonomy/term/85 is showing the articles with the 'Drupal Gardens' tag, but only in english.

How can I implement this functionality in my blog. reyero.net is not my site. It's a blog with the functionality I am searching for.


texts:
How can I apply CSS styling to a PDF generated from node content?
Using the Entity Print module I am able to create PDFs from my node content.
My problem is the PDF output do not reflect the styling I am applying to it. For example, the http://localhost:85/print/pdf/node/2 is the PDF url but it is entirely deviod of my styling despite my continued efforts.
Using the TCPDF (v1) pdf engine and having followed the pertinent instructions at this link, I have the following configuration code:
In mytheme.info.yml:
entity_print:
  node:
    deal: 'oliverock/deal-pdf-styling'

And in mytheme.libraries.yml:
deal-pdf-styling:
  css:
    theme:
      css/deal.css: {}

And deal.css is quite simple:
* {
    color: red;
}

div {
    background: blue;
}

As I alluded to above, I expected that simple styling to take effect in my PDFs but it's all just black text on a white background.
And for the longest time I assumed my code was at fault until I noticed the debug line in the instructions.
All my code is visible at http://localhost:85/print/pdf/node/2/debug but that output is not a PDF.
I would appreciate some help please.


texts: Customizing taxonomy Term page with sticky articles

texts:
I am trying to create an educational website. I have created terms as

History, Science, Biology, Mathematics
and Mathematics term, sub-term as Algebra, Trigonometry

I want to create a separate page like frontpage for each term with few posts sticky at top. For example When someone clicks on History then a page with teaser view of Articles like "About history", "Books for history", " Preparation Guide" will be top on that page list and all other nodes tagged with History term will come below these three posts.

And how can I set no of total posts of History term page as 10?

I am new to drupal and not able to find right modules. Stuck in this issue for 2 days, any help will be appreciated.


texts: Cart API doesn't fire the "update cart" event

texts:
Following this documentation I have created a custom event subscriber for add, update and remove items from cart. It works good and events are fired in every case you add,update or remove items from the cart on the cart page or from the shop view.
I have installed Commerce Cart Fly Out, that uses Commerce Cart Api and a fly-out window to show the cart, and It uses REST to update and remove. If you remove an item, then my remove event is fired. But if you update the quantity, update event is not fired. I have followed, with xdebug, the execution progress until class CartUpdateItemsResource and its patch method, that save the order item. The line is updated well but my update event is not fired. I don't know the reason.
This is my custom Event subscriber:
/**
 * Cart Event Subscriber.
 */
class MyCartEventSubscriber implements EventSubscriberInterface {

  protected $database;

  protected $messenger;

  protected $cartManager;

  public function __construct(MessengerInterface $messenger, CartManagerInterface $cart_manager) {
    $this->messenger = $messenger;
    $this->cartManager = $cart_manager;
    $this->database = \Drupal::database();
  }

  public static function getSubscribedEvents() {
    return [
      CartEvents::CART_ENTITY_ADD => [['addToCart', 100]],
      CartEvents::CART_ORDER_ITEM_REMOVE => [['removeFromCart', 100]],
      CartEvents::CART_ORDER_ITEM_UPDATE => [['updateCart', 100]],
    ];
  }

  public function addToCart(CartEntityAddEvent $event) {
    \Drupal::logger('CartEvent')->notice('add to cart');
    // ... some code
  }

  public function removeFromCart(CartOrderItemRemoveEvent $event) {
    \Drupal::logger('CartEvent')->notice('remove from cart');
    // ... some code
  }

  public function updateCart(CartOrderItemUpdateEvent $event) {
    \Drupal::logger('CartEvent')->notice('update cart item');
    // ... some code
  }
}


texts: Allowing one page to be accessed by Anonymous user in restricted site

texts:
My site is for logged in users only as "View published content" is unchecked for Anonymous users.

Now the problem is that there is one page that I created which shows a form for a user to fill for applying for a membership. It's been created in Webform and I want to show it to Anonymous user.

Naturally, this page is currently restricted and I am confused as to how to show this page to an Anonymous user.

Any help would be appreciated.

Thanks.


texts: Where has module-specified HOOK_preprocess_page gone in D8?

texts:
I'm making a quick module whilst playing with D8, which I want to preprocess Stylus into CSS. The obvious choice for me, coming from D7, would be to use hook_preprocess_page, but it seems to have been removed from D8, or at least only in themes and not modules.

So just to reiterate, I have my module stylus, my file stylus.module and the function stylus_preprocess_page(&$variables), but no dice.

What would be the best D8 alternative?


texts:
I have recently migrated my site to a new hosting company and, since then, I can no longer change the settings in my views. For example, if I wish to edit a field, I can get into it but the REWRITE RESULTS and other sub headings no longer are links and do not open. Creating new fields does the same thing. When I want to add a field I do not get the drop down list that allows me to select the field I want, instead I get a long list of the available fields.

The overall look of the views edit form is no longer Severn but my default theme (Bartik) See the attached picture. There are no drop down lists any longer.

I had that problem very rarely on with the previous hosting company but a refresh generally fixed the issue. Now, it is permanent.

Does anyone know how to fix this?

Thanks. :)


texts: How to show only an image of the YouTube video while using Media: YouTube module?

texts:
Is there a way to show an image of a youtube video instead of the actual player ? This would be done only for the teaser view of the node.

I know that I can show a video thumbnail, but I need an image that looks like the actual player.

Thanks.


texts: Formatting Field Collection data with Views Data Export (CSV)

texts:
I've got a Field Collection on use in a basic page content type on my Drupal 7 site. I've built a view with the Data Export module that is outputting the data from nodes of this content type as a CSV. The view is configured to dump all of the Field Collection data for each parent node into one cell... not ideal, but I'll live with it.

The problem is that there is no separator between the fields in the Field Collection. So, the contents of the Field Collection cell in the CSV looks like this:

Fruit_1: AppleFruit_2: OrangeFruit_3: Banana

It makes reading through the data in that cell unbearable (the separator should be after Apple and Orange... oh and fruit is just for this example, not actual data).

How do I get some kind of separator in there? Doesn't have to be anything fancy; something as simple as a comma and a space would be lovely! Ex:

Fruit_1: Apple, Fruit_2: Orange, Fruit_3: Banana

I've experimented with Field Collection Views, but no luck.


texts:
I am using hook_cron in my module to create a queue.  The queue will process a couple of non-drupal database tables and synch some data around (a process that can take close to 10 minutes).  I'm creating a single item (createItem) and don't need to pass anything to the function.  I'm passing null to createItem and I've also tried passing an StdClass object.

$queue = DrupalQueue::get("alltimesynch");
$queue->createItem(null);

However, hook_cron_queue_info never runs.  I know this because the watchdog function never adds the string to the log

function timesdb_cron_queue_info() {
  watchdog("timesdb","timesdb_cron_queue_info called");
  $queues['alltimesynch'] = array (
    'worker callback' => 'timesdb_import_alltime_start',
  );
}
function timesdb_import_alltime_start($null) {
  watchdog("timesdb","Starting alltime import");
  timesdb_import_alltime();
}

What am I doing wrong?


texts: Create an advanced search that searches only on a field with search_api in drupal 7

texts:
I've successfully installed the search api module in drupal 7. I installed solar and it works fine. I need to create a custom search form that has various fields and those fields performs search only on the relitive field.

This means that if i have a content type with the following fields:

"job requested"

"previous exerience"

"city"

I want a searchh page with the same fields and when the user enter a value in the "city" field, it searches for that data only in that field: if I search the "city" field for "milan" I want to find only nodes with the word "milan" entered in the field "city" and not with the word "milan" entered in the body.

I think I need separete indexes for each fields, but structure the two forms?


texts:
I've got a webform set-up to integrate with CiviCRM using the Drupal Webform CiviCRM module.

The pay later option is working, and the checksum populating the fields.

But the contribution always fails with the error, "Make sure your billing fields are correct."

And they are.

I am using the IATS payment processor. The docs said that as long as the payment processing happens from your web site and not on a third party site (like PayPal standard), then payments should work.

NOTE: the contact-type that is making the contribution is an organization, not an individual.

How can I troubleshoot this?

Thanks.


texts:
I try to configure a custom table in hook_views_data. I need to join the same table (node) twice.
The problem is that i can't have the same key for 2 entries in my array :

$data['maz_composition']['table']['join'] = array(
    // Index this array by the table name to which this table refers.
    // 'left_field' is the primary key in the referenced table.
    // 'field' is the foreign key in this table.
    'node' => array(
        'left_field' => 'nid',
        'field' => 'aid',
    ),
);

Is there a solution for that ?
Thanx and sorry for my bad english.


texts: CSS changes to .menu .leaf affect main-menu AND admin shortcut menu in Drupal 7

texts:
I'm using drupal 7 and have created the subtheme of omega using drush omega-wizard. I'm using compass to watch for changes to the scss files and it's +/- behaving as I'd expect. My problem occurs when I try to style the main-menu with something like:

.menu .leaf {
    width: 30px;
}

The restyling works but it also affects the admin's shortcut menu which uses .menu .leaf. Is there a setting in the config that I've missed, should I be targeting the menu in another way. How do I not affect the shortcut menu when styling the main-menu?

Any help would be greatly appreciated.
Thanks, Steve


texts: Using the Sites module with a multiligual site

texts:
My multilingual site has three sets of (anonymous or logged-in) users: public, set1 and set2. They will all get the same site structure, but set1 or set2 will see slightly different content on some pages. Each group will be given a URL: http://example.com/mysite for public, and http://example.com/mysite/set1 or http://example.com/mysite/set2 for the others.

I can use the Views module with the Context module to help decide what content to show on the pages, but I need a way for the URL to retain, for example, "set1" in the URL path as they navigate around.

I tried Sites (which uses PURL), but it doesn't work with Internationalization: it prefixes the site name before the language, so when clicking the language selector back and forth, you can end up with page not found and a broken menu at http://example.com/mysite/set1/en/fr/fr/fr/en/en/en/en!

Is it possible to use Sites with i18n?

Or should I use another approach?


texts: How to increase a scheduled time using a new field and rules component scheduler

texts:
I am working on Drupal 7 on a custom content type that is called Event.

Each created Event is programmed to be displayed for 1 hour before been deleted. I am using rules component scheduler for that and it works well.

Now I need to be able to increase that display duration.

I already created a numeric field called duration that take the value of the duration from the user. That value that I want to add to the initial display duration.

I need to use that duration field in the Scheduled evaluation date. But rules denied using the + with an identifier.

Can anybody help ?

How do I increase the duration of a tasks that has already been scheduled on node creation. How do I do that using a field that take the value to add?


texts: Language switcher doesn't work with my views

texts:
I am new to this forum, but I hope to get an answer to my problem. Searching 2 days already, bur no success...

I have a multilingual (French and Dutch) D7 website. Besides the needed core modules enabled, I installed the i18n module and the variable i18n module. As for normal pages, everything works perfect. I have a menu for each language, the menu links refer to the correct pages. I have also a language switcher, which works perfect with my nodes.

Now comes my problem. I created a view to display a teaser of all products. Look at http://www.solarine.eu/solarine/ to see what I mean. I made a view for the Dutch language (called "producten"), and one for the French ("produits"). When you access the pages by the main menu, they display correcly (5 products for Dutch, only 1 for French). BUT if you use the language switcher to toggle between languages when visiting the products page, the content of the views stays in the wrong language.

Can anyone please help me with this? It MUST be possible to solve this, but after 2 days searching on different websites with no result, I am out of ideas.

Many thanks!
Steven


texts: How to copy select list value from a webform submisison into select list field new node?

texts:
This is the scenario:

A webform with the following fields

Question -> Textfield
Category -> Select options (Listbox) Listing vocabulary HETCAT

A content type Question with these fields

Title
Category -> Term reference listing vocabulary HETCAT

Once the webform is submitted i create a new question node.
Everything works fine, the Question field of the webform is the new Question node title, but i can not see the way to copy the category selected on the webform to the new node

Thanks in advance

This is the export rule code

{ "rules_submissions_to_node" : {
"LABEL" : "Submissions to node",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "webform_rules", "rules" ],
"ON" : { "webform_rules_submit" : [] },
"IF" : [
  { "webform_has_id" : {
      "form_id" : [ "form_id" ],
      "selected_webform" : { "value" : { "webform-client-form-140" : "webform-client-form-140" } }
    }
  }
],
"DO" : [
  { "entity_create" : {
      "USING" : {
        "type" : "node",
        "param_type" : "het_question",
        "param_title" : [ "node:title" ],
        "param_author" : [ "user" ]
      },
      "PROVIDE" : { "entity_created" : { "new_question" : "New question" } }
    }
  },
  { "data_set" : { "data" : [ "new-question:title" ], "value" : "[data:question-value]" } },
  { "data_set" : {
      "data" : [ "new-question:field-month" ],
      "value" : [ "site:current-date" ]
    }
  },
  { "entity_save" : { "data" : [ "new-question" ], "immediate" : 1 } },
  { "mail_to_users_of_role" : {
      "roles" : { "value" : { "4" : "4" } },
      "subject" : "New question to approve",
      "message" : "[new-question:title]\r\n\r\n\u003Ca href=\u0022[new-question:edit-url]\u0022\u003EEdit to publish it\u003C\/a\u003E\r\n",
      "from" : "[site:name]"
    }
  },
  { "node_unpublish" : { "node" : [ "new-question" ] } }
]}}


texts: Populate second node reference field based on what first node reference field is selected

texts:
I have 2 content types. "ABC" content type and "DEF" content type.  In "DEF" content type i give reference to "ABC" node reference.

I am building another content type called "XYZ" where i give node reference to "ABC" and along with it i give node reference to "DEF" content type.

My problem is that i need to filter out the "DEF"(node reference to "DEF") drop down based on what "ABC" is selected from previous "ABC" drop down.

How to achieve this.

Any help is appreciated.


texts: How to alter search query to include custom fields?

texts: How can I alter the query for user search (using normal Drupal search) so that instead of searching only email and username, it will also search custom user fields (from fields module)?


texts:
I am showing Google DFP ad in colorbox, I am using setCollapseEmptyDiv(true); to collapse empty divs, but in colorbox, ad collapsed but blank color box remains there.
I have tried several ways to hide it but didn't worked. I have checked display:none by jquery, like that:

  if( $("#ad_id").css("display") == "none"){           $.colorbox.remove(); }

but before the ad loads, color box shows up, so it cant find display:none.
Then I have used setTimeout to check condition (display:none) repetitively, this worked but still colorbox appears for at least 2 seconds before disappear.
So how to hold colorbox to load until that display:none condition check?
Give me some direction.


texts: Drupal local configuration clone. Only home page is accessible

texts: I have cloned an existing drupal installation, the problem is, I can see only the home page, other url's are not working.My apache rewrite module is configured. I can not log in as any kind of user.


texts: I want to add a wrapper to all images on my site in drupal 7. None of these images were inline elements so I can’t just directly edit the html code. I’m fairly new to drupal so I’m still figuring out how modules work and have no idea how to implement this. Any help?


texts: Drupal 8 Webform : Regular expression in conditions to check specific day of the week

texts:
I am setting another webform on Drupal 8.
I want to enable some fields based on the day of the week selected.
I used JS on a site with Drupal 7, it is working fine,  thanks to JSDrupal.

I would like to implement it on the Drupal 8 site with a regexp.
I am using the HTML5 date field, not the Jquery datepicker.
My concern is the same than before :

if the Day selected on field DATE_D( a Date field) is Tuesday OR Thursday then hide SELECT( select field).

Thank you


texts:
i have a node which is of content type "Album", they all have categories defined by terms , and i want the user to be able to choose which category he want to filter by but with tabs instead of a dropdown list.

Cant find anything on the internet so this is my last hope.

Thank you.


texts: How do I call a controller function in a module?

texts:
I am trying to access a static method of a controller class from a module, but my code doesn't work.

This is the controller class.

namespace Drupal\content_statistics\Controller;

use Drupal\Core\Controller\ControllerBase;

class ContentStatisticsCount extends ControllerBase {

  public static contentStatisticsCount() {
    $value = $this->t('hi');
    return $value;
  }

}

This is the module code.

use Drupal\Core\Controller\ControllerBase;
use Drupal\content_statistics\Controller;

/**
 * Implements hook_node_view().
 */
function content_statistics_node_view($node, $display, $view_mode, $langcode) {
  $value = ContentStatisticsCount::contentStatisticsCount();
  print_r($value);
  die;
}

This is giving me the following PHP error:

  PHP Fatal error:  Class 'ContentStatisticsCount' not found in /home/qbuser/Projects/test/modules/custom/content_statistics/content_statistics.module on line 15


texts: PHP to show if content has new comments in taxonomy-term.tpl.php?

texts: Is it possible to add some PHP to taxonomy-term.tpl.php that will look and see if any content tagged with the term has new comments, and if so print something in the html?


texts: Book node entity to set child nodes access permissions

texts:
I'm working on a simple permissions module for books. This module should make a book with its child nodes private. The toplevel content type is called reader than I have a child content type edition and a child content type of edition is article.
In the content type reader I have a boolean field called Private (field_private). This can be turned on to make the node private.
My module is inspired by the Private Content module, this basically covers what I want. The only thing I need is to also set permissions of the child nodes.
The code I have written so far seems to work. But what I have to do now is save the toplevel reader and than save all child nodes manually. I'm wondering if it is possible to automatically set the permissions of the child nodes when the toplevel reader (parent) node is saved?
My guess is I have to iterate trough the children and change their views access permission. But how?
My code till now:
In my own private_content module I have a private_content.module file.
In this file I have a hook_node_grants function:
function private_content_node_grants(AccountInterface $account, $op){
  $grants = array();

  if ($op == 'view') {
    if (!$account->isAnonymous()) {
      $grants['private_author'] = array($account->id());
    }
    if ($account->hasPermission('access private content')) {
      $grants['private_view'] = array(PRIVATE_GRANT_ALL);
    }
  }
  return $grants;
}

And I have a hook_node_access_records function:
function private_content_node_access_records(NodeInterface $node){
  $grants = array();

  //check content type
  if ($node->bundle() == 'reader') {
    //if reader
    $book = $node;
  } else if ($node->bundle() == 'edition' || $node->bundle() == 'article') {
    //if edition or article
    //get parent book
    $book = Node::load($node->book['bid']);
  }

  //get private state from book
  $private = $book->field_private->get(0)->value;

  if ($node->status && $private == 1) {
    // Grant read access to users with 'access private content'.
    $grants[] = array(
      'realm' => 'private_view',
      'gid' => PRIVATE_GRANT_ALL,
      'grant_view' => 1,
      'grant_update' => 0,
      'grant_delete' => 0,
      'priority' => 0,
    );

    // Grant read access to the owner, but not ANONYMOUS user.
    if (!$node->getOwner()->isAnonymous()) {
      $grants[] = array(
        'realm' => 'private_author',
        'gid' => $node->getOwnerId(),
        'grant_view' => 1,
        'grant_update' => 0,
        'grant_delete' => 0,
        'priority' => 0,
      );
    }

    // Otherwise, deny read access for private nodes.
  }

  return $grants;
}


texts: Why is a new post not shown in the Latest Topics Block after updating Advanced Forum?

texts:
I updated the version of the Advanced Forum module today. I posted a new topic and now it doesn't show on a block I have in the side bar where latest created topics always used to show up.

What can be happening?


texts: Trying to customize login page for mobile, interfering with desktop version of login page

texts:
I've been trying to customize the login/retrieve password/create account pages on the mobile version of my website for a couple of weeks now with little success. I haven't found a satisfactory answer to my problem anywhere. The closest I've come is Dropal's solution here. This actually seemed to work (after I also created a page--user.tpl.php page in addition to the recommended page--user--login.tpl.php). It seemed to work, that is, until it didn't.

Again, I'm trying to stylize only the mobile version of my site, which I created in a sub-domain. When I put these customized login/password pages into the sub-domain and clear the cache, the mobile version looks great...but it totally destroys the login/retrieve password/create account pages on the desktop version of my site, causing it to look ridiculously wrong.

This makes no sense to me at all. I haven't created custom page--user.tpl.php or page--user--login.tpl.php files in the directory for my desktop version. So why are the sub-domain files interfering with with the regular domain files? So, so, so confused. Can someone please shed some light on why this is happening?


texts: Basic Multiple Image Upload to replace standard image uploader

texts:
First question on Drupal Answers, hi everyone.
Starting off with a very basic question actually:

While the standard single image at a time uploader is swell and all, I've got the Galleria module installed, and we have hundreds of photos to upload across multiple albums, and a ton more to come along in The near future. Quite simply is there an existing package/mod that can transform that single image uploader into a multiple image uploader, One where you can select multiple images in the browse window?


texts: Tag users in a content field to create user-specific content listings

texts:
I'm newish to drupal and it seems like this should be somewhat straightforward or at least possible with views and/or taxonomy.

I have an embedded video content type. I want to tag multiple users in a hidden field (as if they were taxonomy terms). The desired result is that a user can go to a URL like /videos/my-classes and it will list all the videos they are tagged in.

I've been reading the following thread, but there doesn't appear to be any applicable options when I try adding a views relationship. I'm looking for an option like "Video Embed: User" or something. I tried adding a user entity reference to the content type, but that didn't seem to help.

Thread: Display content with Taxonomy on User and Content matching

What I am trying to avoid is having the user go to /videos/username but instead /video/my-videos which displays different content for each user.

I'm not opposed to writing a code snippet for my theme, but it seems like there's a solution to this given the tools I already have.


texts: What steps are necessary to build secure database queries from user input?

texts:
Example Drupal 6 query:

$q = db_query("SELECT id FROM {table} WHERE no = %d AND name LIKE '%%%s%%'",
               $_GET['something'], $_GET['something_else']);

Example Drupal 7 query:

$q = new EntityFieldQuery();
$q->entityCondition('entity_type', 'some_entity')
  ->propertyCondition('id', $_GET['something'])
  ->fieldCondition('field_name', 'value', '%'.$_GET['something_else'].'%', 'like');

The $_GET values could be anything the user can technically send. Should additional steps be taken like using PHP-s is_numeric function for numbers and db_escape_string() for strings to make sure the input wont cause any harm or are the queries already secure? Does the same count for other Database API functions?


texts: custom views handler to show dynamic all profile fields

texts:
I'm using D6 and I like to have a view that shows all user profile fields. The situation now is, that you have to tic all  fields that you like to show. I'm using OG profiles and the user is able to add profile fields to it's group. In addition to that, I need a view that get all fields that are belonging to a group (automatic).

What is the starting point for me? Found that .. http://techblog.zabuchy.net/2010/non-database-field-in-custom-drupal-views-2/

But how to start?

pseudo code:

get all field belonging to a group (arg(1))
and disp


texts: WSOD , Autoload.php, Composer, and Two /Vendor directories

texts:
I'm going to try to be as thorough as possible. I have an AcquiaCloud-hosted Drupal site with 3 environments, dev, staging, and production. My team uses Acquia DevDesktop to work on this site.

The original developers setup the site to move the /vendor directory out of /docroot. I believe they also used a module (Drupal-Composer or Drupal Scaffold, maybe?) that claims to have assembled the site in /web but we do not have that directory in our repo, we have /docroot as per usual. Anyway, the /vendor directory now lives in both the repo root and another /vendor directory is in the /docroot directory.

This problem was raised here but no one provided any feedback.

I am getting errors such as the following:

Similarly, when I attempt to use various functions on the site that depend on a library or some dependency, I receive errors. For example, PHPMailer classes are not being loaded:

My project directory has a /vendor folder in the root with an autoload.php pointing to the 3-4 autoload files that composer generates:

and then here:

I get the dreaded WSOD when attempting to use things like Saml_Auth or form mailers. Otherwise, the site "works" in the sense that I can navigate around in content, load the admin panel, make minor configuration changes, etc. Only when a library or dependency is needed, it seems to break. This leads me to believe that dependencies from repo_root/vendor or /repo_root/docroot/vendor are not being loaded properly.

Misc./errata: Core 8.5.2, Drush 9, Composer, behat, circle ci, phing/ansible builds are no longer being used but their configs persist in the repo. Just ignore those files in the photos.

Does anyone have any idea how I can triage this situation and my dev environments working again?

Thanks a million.


texts: Using modules "not covered by Drupal’s security advisory policy"

texts:
I would like to use a Drupal 7 module that is "not covered by Drupal’s security advisory policy", specifically the Conditional Fields module.

It would allow me to do exactly what I need. It looks like this module is pretty actively used and maintained but I am not sure how worried I should be about using a module that I won't get updates about if any security issue should arise.

Any advice? Is coding something like this (using hook_form_alter and states)  myself a safer approach?


texts: Hide a field for that particular row based on value from custom table

texts:
I have a custom module where in a user requests access to view a node. I have a view page which currently lists all nodes and has a button "Request Access" to it. When the user clicks on it, an entry for the same is captured in my custom table for that node id. Then the admin approves or rejects it. If it is approved i want the user to view "Approved" status for that node id and for others it should show "Request Access". The name of my custom table is access_node_custom. I tried using the below code (with some static data):

function access_node_custom_views_pre_render(&$view) {
    if ($view->name !== 'access_node_custom'  || $view->current_display !== 'page_access_node_custom') {
        return;
    }

    $results = &$view->result;
    foreach ($results as $key => $result) {
        if($result->nid == 656){
            $view->field['request_access']->options['exclude'] = TRUE; //Hide request access since this is already approved
        }
    }
}

The problem with this is that it hides for every row on that page. I am fairly new to drupal so I don't know how can i do this. Is it possible to use relationship? or query alter?

Thank you.


texts:
I have a node with a lot of images and I want to convert this images in a
-list. So I created a node.tpl-overwrite page and tried to alter my HTML, but with no result.

 <div class="content"<?php print $content_attributes; ?>>
    <?php
      // We hide the comments and links now so that we can render them later.
      hide($content['comments']);
      hide($content['links']);
      print render($content['field_themes_body']);
    ?>

        <?php
          dpm($content['field_themes_images']);
          //print theme_item_list($content['field_themes_images']);
        ?>

It seems like the dpm of the $content['field_themes_image'] contains a whole array with all kinds of properties... Is it possible to filter out the images path only?

I've looked at the theme_item_list-function, but with no luck (or I did it wrong).


texts: Show administrative description in Views

texts:
I am needing to do a Views report for all webforms on our site (we currently have 27 forms) that can show me the total submission count per form.

The issue I am having is that we need the Views report to also show the Administrative Description of the form but I do not see that as a field option in Views.

Any ideas on how I can achieve this?


texts: Get path of uploaded file inside a Twig template

texts:
I've created a teaser template like this node--type--teaser.html.twig.
Within that template I want to conditionally create a link to a file that was uploaded via the field field_pdf.

How do you extract JUST the path to the pdf in the template.

I've tried {{ file_url(node.field_pdf.entity.url.value) }} but that just brings back an empty path.

If thats not possible, is there a way to get a file path from the fid in twig?


texts: I want to show one content type content in another content type. Like one content type have Title, text field 1, text field 2, picture and i want to be able show in another content type. Is this possible? Thanks.


texts: How do you make a module integrate with the Rules module?

texts:
Rules has so many uses but if another module is not integrated to it, you can not use rules with it. Does anyone know how to integrate a module with rules?

The module I would like to integrate is Metatags.


texts: How to alter the uc_address:city form field?

texts:
I have to alter cities form field in checkout page under delivery section. I have to change it from a textfield to a select options dropdown.

I have managed to do that using a separate template file for checkout page but I
am not able to use #ajax functionality of form field
In Drupal 6 it was possible using hook_form_uc_cart_checkout_form_alter(), but in Drupal 7 the address fields are rendered in a different way, and I'm not able to alter the address form fields as desired

What are other ways of changing it?

I used hook_form_alter() with an #after_build callback; I was able to change the field from text field to select option, but the #ajax parameter attached to this is not working.

It seems like ajax callbacks are attached with the hooks at an early stage. Is there any way to have the #ajax property working?


texts:
I am looking for a module or a hook that allow me to use if conditions with tokens.

For example I want to check if a field is equal to a specific value or text

[if][field_name][eq]hello[then][field_name_alt]

any ideas will be helpful.


texts:
originally posted on stackexchange.  Didn't get any replies.  Then I recently found out there's a specific drupal stackexchange so here i am reposting.  TIA!

I have a drupal site and I plan to serve static site files directly from s3 (rewrite). I need to provide a way for the content manager to upload his images directly to s3 from the drupal admin UI so he doesn't have to send it to me to upload via s3cmd or the aws console. Can anyone recommend a module or method for this?

I've tried s3fs however mounting a fuse s3 filesystem and serving from it was painfully slow. If it worked drupal would think the files are all local and i'd be set.

I found this but not sure if it will get the job done for me: https://drupal.org/project/storage_api

I need a module that would allow the drupal admin UI user to graphically browse for a file (image for instance) to upload to the s3 bucket i intend to serve from.


texts: How to diasplay stock quantity of goods in node-product.tpl.php

texts:
I need to get quantity of goods in stock and display a number in the product page node-product.tpl.php.

Here is what I added in the template, but uc_stock_level() seems not to work properly.

$stock = uc_stock_level($node->model);
if ($stock > 0) {
    print $stock;
} else {
    print $stock;
}

I am using Ubercart 2.


texts: Displaying commerce product with all product variations and attributes

texts:
I’m building a drupal commerce store using product displays that reference multiple product variations. But i need the product display to show all of its product variations with all attributes one after another, not hiding the attributes by AJAX. And each product variation should have its own add-to-cart-button. So it’s a simple, flat design where a customer can see every variation and every attribute at a glance.

I know this could be easily accomplished using views, but for certain reasons views is not an option for me. I need a real node of the productdisplay with its variations.
What’s the best and most performant way to achieve this?

EDIT
According to @nvahalic it’s a mess to solve my issue without Views. So maybe i have to reconsider my decision not to use Views. To clarify, the products will be displayed like this:

+------------------------------------+
| Title Product 1                    |
| =====================              |
| General Text (for all variations)  |
| General Image (for all variations) |
|                                    |
|    Title Product Variation 1       |
|    =========================       |
|    Text                            |
|    Image                           |
|    *Add to Cart*                   |
|                                    |
|    Title Product Variation 2       |
|    =========================       |
|    Text                            |
|    Image                           |
|    *Add to Cart*                   |
+------------------------------------+
+------------------------------------+
| Title Product 2                    |
| =====================              |
| General Text (for all variations)  |
| General Image (for all variations) |
|                                    |
|    Title Product Variation 1       |
|    =========================       |
|    Text                            |
|    Image                           |
|    *Add to Cart*                   |
|                                    |
|    ...                             |
|    ...                             |
+------------------------------------+

As far as i know when using views to build this structure, i will need something like the module Views Field View to achieve the nested structure consisting of fields belonging to the product display as well as fields belonging to the variants. Since the shop will have very long lists of products, i’m concerned about performance issues coming along with this kind of modules.
Or maybe i got it wrong and such module isn’t necessary at all?

EDIT 2
Finally i solved the problem by using the EVA module: i created a view showing the attributes of all products as fields and added am add-to-cart field. This view i attached to my product display – it seems to me this approach is way more performant than using the Views Field View module …

EDIT 3
It is a huge mess: using nested views is not a good idea, because commerce-add-to-cart buttons can not be cached, so caching views does not work as it is discussed here https://www.drupal.org/node/1926888
From my point of view it was a very, very bad choice to use views for this task. Now I can not use views for caching and the module commerce entity cache is not usable neither because the view does not rely on entities.


texts: What is going wrong with the file_field_path redirect for my files?

texts:
I am using the fieldfield_path module to create a redirect for my files as they come in during a migration (this is so that I can give an original path in the migration, and create a redirect, allowing me to redirect at the apache level from the old url to a new one, but also have extra information in the path that wasn't available from the old site path.  The fieldfield path file path is set to publication_documents/pub/[node:field_doc_type_book]/[node:nid] for my book content type public files field.

When I look at my migration messages I see the following message:

Creating redirect from
private://publication_documents/pub/old/1565/filename.pdf to
private://publication_documents/pub/book/37544/filename.pdf

Which is what I would expect, the nodeid of the node the file is attached to is 37544.  Unfortunately when I actually visit /system/files/publication_documents/pub/old/1565/filename.pdf I get redirected to system/files/publication_documents/pub/book/149678/filename.pdf

Which is a page not found error page.  It is a mystery where the number 149678 came from, but I can confirm that the redirect happening is the one actually stored in the redirect table.  I've looked through all of the node and revision ids, file ids, etc. that I could think of as possibly being the source of this mystery integer, but have had no luck so far.  I removed all the migrated data and ran the migration again, but the integer on the redirect is still the same.

What might be happening?  Why is drupal telling me it is creating one redirect, but actually creating another?  I suspect it is actually creating the one it is telling me about, but then replacing it with another, but so far, I don't have any information to prove either theory.

I am using the media module, and wonder if that is somehow messing things up.  I also have pathauto active.


texts: How can I display a user avatar in Drupal 7?

texts: I'd like to know how to display a user avatar in Drupal 7. I want to display the avatar in full size, and as thumbnail.


texts: Trying to create a view of a node that contains the titles of nodes that reference it

texts:
I'm looking for output that looks somewhat like this:

Node title!

Node body, this is the body of the "main" node, other nodes reference it!

create comments link, share links, some flag or something...

Child node 1
Child node 2
Child node 3

The problem I'm having is that I can't figure out a way to do this in views that works with how this is going to be displayed.The main wildcard here is that I'm outputting a list of nodes, not a single one. So using something like an attachment wouldn't work, since that gets appended to the end of the entire view's output, rather than to the end of a row's output.


texts: Getting IMCE to accept multiple file uploads at one time

texts:
I am currently using the IMCE module for uploading files but it only allows 1 file to be uploaded at one time.  We have tried the plupload and the imce_plupload modules together but those modules sometimes corrupt the files once uploaded.
The only other module called "IMCE Multiple Upload" that claims that it can work with IMCE as an add-on module to IMCE and allows multiple uploads at one time costs $36.
I don't know if the "IMCE Multiple Upload" module will work correctly since the demo site only allows 5 files at once and once over a certain file size it scales it down.

Has anyone used the "IMCE Multiple Upload" module with IMCE and does it restrict how many files can be uploaded at once and does it restrict the file size?
Also does anyone know of an alternative way of getting IMCE to accept multiple file uploads at one time.


texts: How to prevent people to ask for registration in Drupal 7?

texts: There is no login block in my website but everyday I see lot's of strange emails are sent they ask for registration. How do I can modify Drupal to reject every registration request?


texts:
I have what is probably a common question ... How do render arrays get parsed into the the twig template - If we have a controller class which outputs a render array, such as:

$output['element1']=array ("#type"=>"markup","#markup"=>"Hello World!");
$output['element2']=array ("#type"=>"markup","#markup"=>"Today is a nice day!");

Now, lets say that we're using the bootstrap framework, hence using row and columns for layout, if we want the array elements to be output in the following manner:

    Hello World!

    Today is a nice day!

How can this be done?  It is clear that Drupal will initially use the page.html.twig template, which will call the region.html.twig template, which in turn will call the block.html.twig template in order to display the render array.  But, the block.html.twig will output the render array as:

 Hello World! Today is a nice day!

Namely,it will not output the div tags - mostly because the block.html.twig doesn't know about them.  And looking at the block.html.twig it appears that the output is only available as 'content':

 {{ content}}

And there is no way of templating the content in the following way:

        {{ content['element1'] }}

        {{ content['element2'] }}

Secondary related query:

What would also be useful, is being able to ascertain which class called the page.html.twig so that one could use the {% if calling_page="page name" %} in the block.html.twig template

Hopefully, you get what I am outining here.  Thanks in advance and please operate upon the premise I'm totally new to Drupal when outlining solutions.


texts:
fmath is an extremely powerful plug-in library for wysiwyg editors.

It provides an editor for mathematical formulas, which generates images that can be used in drupal sites. It processes mathml and latex.

There is a problem though, images are saved on a server using the following php file.

if($_POST["save"]){
   $type = $_POST["type"];
   if($_POST["name"] and ($type=="JPG" or $type=="PNG")){
      $img = base64_decode($_POST["image"]);
      $myFile = "img/".$_POST["name"].".".$type ;
      $fh = fopen($myFile, 'w');
      fwrite($fh, $img);
      fclose($fh);
      echo "http://your_server/capture/img/".$_POST["name"].".".$type;
   }
}else{
   header('Content-Type: image/jpeg');
   echo base64_decode($_POST["image"]);
}

This file is publicly available, and can not be restricted with .htaccess to localhost only (the whole library will not work).

From my understanding the file is called by scripts on a user side via an url, and the image is passed by the POST method. That makes the file very dangerous as it allows anyone to save anything on the server.

Are my suspicions correct?
How can I make this safe to use?

The whole library weights 11MB so I don't feel like debugging it.


texts: entityQuery array instead of orConditionGroup()

texts:
I'd written a query based on the "simplified" version here. And my code looked like this.

$results = \Drupal::entityQuery('node')
  ->condition('type', 'mytype')
  ->condition('status', 1)
  ->condition('field_first.target_id', $anArrayOfNids)
  ->condition('field_seciond.target_id', array($anotherNid))
  ->execute();

The code was working, I know it was. But now I'm getting an "SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens" SQL error.

I tried replacing it with just array(540) and got the proper result. Then I gave it array(546) and got the different, expected response, but as soon as I put [540,560] or array(540,560), I get that error, instead of what i used to get, which was the combined results.


texts: Can I create an "unlimited" values variable?

texts:
I'm trying to create an exclude list of sorts that is configurable via the variable admin interface. I have created lots of single value variables, but never a variable as an array where through the interface the user can "Add" another field/value like you can on nodes with "unlimited" field values.

Can this be done with the Variable module?


texts: How can I include some functions globally?

texts:
I've created a few helper functions specifically for a project and I want them to be available globally.

I know I can include them via composer with the files key. I was wondering if there was a more "drupal way" sort of ...way, to include them?


texts: How to manage a field collection in a table?

texts:
I have a field collection called My links.

My links contains these fields:

Organization Name (Text Field)
Description (Long text with summary)
Link Url (Link Field)

This is a pain to manage because I need to scroll down really often since I have at least 45 links in there.

Is there a way to manage these link in a table format?

Thanks a lot


texts: Views Rules in edited system node template

texts:
For learning purposes, I'm working on a project which uses Rules Links.

My first attempt had a Rules Link on a Node Content template I made after creating a new Content Type (which is infact an 'Apply' link, later to be say created in HTML5). I presume the Rules Link created the entity required into the DB fields as it injected into the Field type available when I looked at the Node Field profile to create new Fields and I presumed it would later work once I set the Rules operations. Anyway, having decided that my overall layout for the said Node was not really what I wanted (simply because I also want some dynamic Views to show on Panel areas) I realised that it was easier for me to edit one of the Node templates for content and create a 'Variant', that all worked fine and appears to be going in the right direction for my overall design and backend operation.

However, when I attempt to put any Rules Link now in the Node template Variant via the Panels designer, I cannot find any entity for reference to my created Rules Link. I presume it would merely be a show in any of the general Panels 'add content' (Panel->Layout->Edit Content) found in the left hand.

Am I a little bit at a loss to whether it's me or the backend doing something incorrect; Am I missing something here for adding Rules Links in the said Node Template 'Panels'?


texts:
I am trying to migrate users table from drupal 7 to drupal 8 for that i have created custom migration module and create two file in config/install folder with the following names

custom_migration.migration_group.open.yml
custom_migration.migration.custom_user.yml

and User.php in Plugin/migrate/source for mapping fields.
The following showing content for custom_migration.migration_group.open.yml
id: open
label: Open Migration
description: Custom Migration user table form drupal 7 to drupal 8.
source_type: Drupal 7
source:
  key: drupal_7
dependencies:
  enforced:
    module:
      - custom_migration

Following Content is from custom_migration.migration.custom_user.yml
id: custom_user
label: Custom user migration
migration_group: open
source:
 plugin: custom_user
destination:
 plugin: entity:user
process:
 uid: uid
 name: name
 pass: pass
 mail: mail
 status: status
 created: created
 changed: changed
 access: access
 login: login
 timezone: timezone
 langcode: language
 preferred_langcode: language
 preferred_admin_langcode: language

When i enable the module it should show migration group in Structure->Migration . But it is not showing. Any idea why?


texts: Settings for users on a new node or block

texts:
I want that users be able to configure some settings on the site for different tasks as shown below.

[Checkbox] Recieve updates from site
[Checkbox] Notify by mail when i get userpoints //user points
[Checkbox] Notify by mail when i recieve a friend request /user relationships

and so on. the above should appear in a new node say node/settings and if a user clicks a check box then only he/she would be notified by mail, for instance.

Is it possible, How?

Appreciate any help because i am at odds


texts: defining node multicolumn layout with twig template

texts:
Sometimes I get lost in all the options I have on the drupal platform.

I am currently creating a site for a choir. I want them to be able to add new concerts. There has to be a page for every concert. I want to use a multicolumn layout for those concertpages. This layout I want to define using a twig template. Each concert would get a standard layout at creation.

I want to be able to override that template for each individual concert. Once the grafic design for promotion material is finished the page has to be inline with the grafic design. But it still has to be editable like a normal drupal-page.

I thought about doing that with a content type. But can I theme that in a multicolumn layout using twig? It seems like I only have a {{ content }} variable in twig.

Am I missing something? It seems like a custom entity would be a better solution since I can define a render array and add the fields in different variables wich I can then use in my twig file.

Maybe I got it all wrong, this is my second drupal project and I'm still learning to find the best way of getting things done.

Matt.


texts: I am working on drupal commons, and using pantheon servers for hosting. The major problem I am facing is the server database config issues. I am not able to change the settings.php file. Also Pantheon every now and then changes their db server password. How can I control this ? is there any server variable for the db instance, port, user id, password ?


texts: programmatically disable menu based on user taxonomy reference fields

texts:
I am trying to programmatically disable menu based on account settings/user taxonomy term field, is there a better way to do it? do I need to use hook menu? to disable already built menu, as I have a lot of users in department that needs to get filtered to only show the menu they can edit

UPDATE :

I wanted to hook the permisssion of user so not all can edit the menu structure, like edit links and so on, like example I allowed permissions manage menu 1, manage menu 2, for role a, then I wanted to hook that menu 1 is only available for user with term reference 1. something like that

thank you!


texts: Getting weird ambiguous column error message in where clause when accessing database

texts:
I am getting an error that one of the columns I am accessing is ambiguous in my where clause. While I understand what that message means, I believe that my code is set up correctly to avoid such a message. Here is my query:

$form_query = db_select('form_permissions', 'perm');
$form_query->join('submission_form', 'sf', 'sf.stage=perm.stage and sf.form_instance = perm.form_instance');
$form_result = $form_query
  ->fields('perm', array('form_instance', 'role'))
  ->fields('sf', array('submitted'))
  ->condition('perm.process', $submission->process)
  ->condition('perm.stage', $submission->current_stage)   <--- complains about this condition
  ->condition('perm.can_create', 1)
  ->execute();

I specify which table column I am interested in so why is this an issue? Is this a bug in Drupal 7?

Thanks


texts:
I want to create a view that will allow the user to pass a filter value using the URL, but if the filter is missing, assign a default value.  The view's path is set to results. I created a view page and added a contextual filter that uses the URL to retrieve the value results/somevalue.  Some value will filter the view based on it's value.  What I can't figure out is if the user browses to the default page, results, how do I set a default value?

I tried creating a second page based on the first, using the same path. When I did this, users could not browse to results/somevalue.


texts:
I want to have a template for a specific page, as I want to add multiple Javascript pulled games to it.

The nid is 34, so to create this page, I would have to create page--node--34.tpl.php, correct?


texts: Fetch values from Field Collection or Multifield on Node to Entityform

texts:
I am working on a booking system where I have a content type of "Company" with an unlimited Field Collection of "Services". The "Services" field collection has 2 fields: "Service Name" and "Price".

I want users to be able to book any of the Services using an Entityform I have created, so that the Node Title, Service Name and Price fields be loaded automatically on the Entityform during submission.

I have tried using tokens and the Prepolutate module by passing the field values in the URL but I can't seem to pass the values from the Services field collection because field collections are entities on their own, and also this is not very secure as the price can easily be manipulated/changed in the URL.

How should I go about this? Or is there a module that load an Entityform from the URL for example http://www.example.com/company/nid/book, with values of fields and fields collection from the node. Every suggestion will be appreciated.


texts: How to capture URL from a webform without using token value?

texts:
I have a Webform as a block. Set to show on a certain content type with a hidden field returning the token value %get[q] to let the admins know from which page the form was submitted from.

Unfortunately it has intermittent errors that I've not been able to duplicate. Is there a better way to capture the URL?


texts:
Drupal: 7.31
Php: 5.5.9-1ubuntu4.3

I am trying to create node type 'recibo_promocion_type', after create nodes of type 'offer_type' (diferent type).
I am using hook_node_presave.
I run the code in the development environment 'run php code', successfully, but the same code within in my personal module does not respond, getting a blank page.
I did debug and the line of code that fails is 'node_save ($node)'.

function nuevo_Recibo_Promocion($nid, $uid, $ruta){

define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
global $user;
$nodeConfigura=node_load($nid);
$node = new stdClass();
$node->nid=0;
$node->type = 'recibo_promocion_type';
$node->uid = $user->uid;
$node->name = $user->name;
$node->title = $nodeConfigura->title;
$node->language = 'es';
$node->field_organizacion = $nodeConfigura->field_organizacion;
$node->field_enlace['und'][0]['url']=$ruta;
$node->field_enlace['und'][0]['title']=$nodeConfigura->title;
$node->field_enlace['und'][0]['attributes']['target']=0;
$node->field_fecha_promocion = $nodeConfigura->field_fecha_promocion;
$node->field_cliente_envio['und'][0]['target_id'] = $uid;
node_object_prepare($node);
$node = node_submit($node);
node_save($node);

}

This is the test code with moc parameters from 'ejecute code php' of dev module, and save node successfully.
The moc parameters was extrated from dpm($node) replace save_node($node) in a module.

//moc paraeters
$ruta='http://...';
$uid=184;
$nid =81;

$nodeConfigura=node_load($nid);
$node = new stdClass();
$node->type = 'recibo_promocion_type';
$node->uid = 1;
$node->title = $nodeConfigura->title;
$node->language = 'es';
$node->field_organizacion = $nodeConfigura->field_organizacion;
$node->field_enlace['und'][0]['url']=$ruta;
$node->field_enlace['und'][0]['title']=$nodeConfigura->title;
$node->field_enlace['und'][0]['attributes']['target']=0;
$node->field_fecha_promocion = $nodeConfigura->field_fecha_promocion;
$node->field_cliente_envio['und'][0]['target_id'] = $uid;

node_object_prepare($node);
$node = node_submit($node);
node_save($node);

the node save successfully.

This is the result to repace 'node_save($node)' for 'dpm($node)' in function  'nuevo_Recibo_Promocion' inside my module:

I tried also:

1)Use drupal_register_shutdown_function but the bug is the same.

2)I have created  a xmlrpc service, and replace instead the nuevo_Recibo_Promocion call function.
The xmlrpc creates successfully the node, but if it's invoked  from 'execute php code' (dev module). if xmlrpc it's invoked  from  from my module, it doesn't created the new node.

$methods = xmlrpc('http://...', array('reciboPromocion.new' => array($nid,$ruta,$uid)));

3) I have disabled all my modules to avoid confict with othes modules (loops Infinite)

4) use try{} catch(exception $e){}... to get the bug.

5) use hock_cron(), but not save the new node.

6) I've tried the user custom permissions, the function node_access($node) before node_save ($node) in two cases: my personal module  and dev console 'Run PHP code'. The result is true in all cases.

The question for  is, why  the process do not shoot any exception, alert, or notify, The result is a don't response and 'blank page' in my web browser.

any suggestion?


texts: Check if referenced field exists in commerce product display

texts:
I have to render different types of product (with different fields combinations) in a generic product display tpl file.
I created an array with all possible field names (they all are referenced product:field_name) which passes through a

if ($content[$my_field]){
  //some code
}

that is supposed to check if the field exists and then do things...

The problem is that it actually checks the existence of the field but shouts out a notice: undefined index warning for every field that is not present.

Is there a way to execute this check in a cleaner way?

Thanks!


texts: All images within my articles have a link of their own: why?

texts:
The article content type has a field to upload images with the article text (body and teaser). I noticed that every image I upload gets its own URL after submitting the article, e.g. http://www.example.com/imagejpg.
This is messing up my Google SEO as each image has its own URL, and it is showing up in the search index for my domain.

Is there any way to stop these images from having their own URL?


texts: Why do I get an error about the constant SODIUM_LIBRARY_VERSION not being found?

texts:
I'm on shared hosting, and I'm trying to install drupal 8 using composer. When I run composer create-project drupal/recommended-project:8.x-dev my_site_name_dir, I get this error.

constant(): Couldn't find constant SODIUM_LIBRARY_VERSION

I also tried without recommended-project, following instructions here but the same thing happened.
phpinfo() suggests sodium is installed.

I read that there may be an issue with the libsodium extension and the Sodium module as described in Module cannot be installed using PHP > 7.0, but this isn't related to core.
Sodium isn't mentioned anywhere as a dependency in the requirements for Drupal, so I'm wondering if Composer is the issue.
What could actually have a dependency on that module? What might be the reason  it isn't finding the constant despite the fact the PHP extension seems to be installed?


texts:
I've been twisting and turning the View module but can't get simple tasks done. Well it should be simple but yet Drupal don't have a good solution ...yet.

How to create 2 columns where column A have an image that spans from top to bottom and column B have 3 rows?


texts:
I want to make my site more user friendly and so I would like to replace select list with an image list.
Is it possible to display ordinary select list as an image list?
Is there a module that would allow me to do so or do I need a custom code for this fetaure?


texts: How do I join across two different databases?

texts:
I have two databases, the normal drupal db and another db to another system. I want to join two tables from these two different dbs. I have already set up the second database using information from here, but I don't know how I would go about doing a join across two databases.

Imagine both have a users table, but the second database also has a field called "telephone number". I want to join the two users table on uid, so that telephone number (and other fields) are also included in the result.

Any ideas on how to go about this? Is it even possible?


texts: How can I display the node count values for taxonomy terms with sorting the result list in descending order of node count?


texts: Split multi-value field across columns in table View?

texts:
I have a Taxonomy with a geographical hierarchy (Region > Province > City > District), which I'm adding to nodes using the Hierarchical Select module. Because I set the field to "store the full lineage", in effect what I get is a multi-value field with tids. In a simple View, this field displays as a comma-separated list of geographical areas in the right order (ie it behaves like a standard multi-value field).

I want to create Views to group and aggregate data by geographical area however, and in order to get this to work, it seems to me necessary to split the values out into separate columns (ie a column for "Region", another for "Province", another for "City" and so on). So far I have successfully managed to do this by using Views PHP to access each value in the array of values for the field and put the appropriate values into multiple columns (in effect, that means four "Views PHP" fields).

This works, but it seems to me a bit clunky and I would really like to know if there is a more elegant way, or even a module, to do this. I would have thought that this is quite a common sort of problem and I'm surprised that so far I've not been able to find anything to do it.


texts: How to make a callback funciton to a drupal behaviors funtion

texts:
I have this Drupal behaviors function:

(function ($) {

    Drupal.behaviors.modulenameSwiper = {
        attach : function (context, settings) {
        if ( location.pathname != '/en/imce' ||              location.pathname != '/fr/imce' ||              location.pathname != '/it/imce'     ) {

        var mySwiper = new Array();
        var mySwiperIndex = 0;

        $('.swiper-container').each(function (){
          mySwiper[mySwiperIndex] = new Swiper ($(this)[0],{
              mode:'horizontal',
              loop: false,
              slidesPerView: 'auto'
              });
          });

          mySwiperIndex++;

    }
    }
  }
 }(jQuery));

I need to call mySwiper object out of the Behaviors callback. there is anyway to make it?


texts: view thumbnail link putting a 0 after my url when clicked - why?

texts:
I created this view with a thumbnail containing a link that leads to the full node. The URL to the full node is the name of the node with a 0 after it. For example instead of localhost/sitename/name-of-the-node the URL becomes localhost/sitename/name-of-the-node-0.

What shows up then is a sort of 'stripped' version of the full node where in my case the node title is missing, the full body text will show up but its hard to style with css and things are weird.

The node type I made the view for is 'evenement' (dutch for event) where I only added a field to fill in event date and a picture upload on top of the basic fields.
In the view which I called 'calendar' under default the following settings

DEFAULT

Basic settings:

Row Style: fields

Fields:

Content: Date (standard)
Node: title
Node: body
Content: image (thumbnail image)
 Then, I checkboxed "Link this field to its node"
Node: AddThis button

No Sort Criteria

Filters:

Node: Published (Yes)
Node: Type = Evenement
Content: Date (contains 2011)

PAGE

Page settings:

Path: Calendar
Menu: no menu


texts: Can I get Entity Cache Tags from a Route?

texts:
If I have a node object I can use $node->getCacheTags() to get the cache tags for the node object, and I can do the same for other entities. Is there a way for me to do something similar with a Route object?

$cache_tags = $route->getCacheTags();

or maybe there's a way for me to do something like this, where $entity is populated with the $user, or $node, or $view, etc. object that is responsible for the current route:

$entity = $route->getEntity();
$cache_tags = $entity->getCacheTags();


texts: Cannot format date for date field in a Views_Database_Connector view

texts:
I am using the Views Database Connector module in drupal 8 to display the data from an external mssql database.  I am running into issues with the date field.  When I am asked to configure this field in the view, I am asked to choose a format for the date.  However, when I go to view the page, I get this error (and stacktrace):

InvalidArgumentException: The timestamp must be numeric. in Drupal\Component\Datetime\DateTimePlus::createFromTimestamp() (line 172 of core/lib/Drupal/Component/Datetime/DateTimePlus.php).

Drupal\Core\Datetime\DateFormatter->format('2009-03-02', 'html_year', '', 'UTC', 'en') (Line: 323)

format_date('2009-03-02', 'html_year', '', NULL) (Line: 177)

Drupal\views\Plugin\views\field\Date->render(Object) (Line: 1144)
Drupal\views\Plugin\views\field\FieldPluginBase->advancedRender(Object) (Line: 224)
template_preprocess_views_view_field(Array, 'views_view_field', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('views_view_field', Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)

I have not been able to figure out how to get the date to be converted to a timestamp so it can be formatted.  I have tried a preprocessor but the template_preprocess_view_view_field always occurs first and the exception occurs before it gets to my preprocess function.  Is there something particular about the date data type in mssql?  Any suggestions how to get the date to not generate the exception?


texts: Subscriptions template: test for imagefield

texts:
I send digest newsletters with the subscription module (using the templates that comes with the module), sometimes containing a small image before the teasertext (positioned with tables/row/column). This is all working well.

However in case there is no image available (because there is no teaser image uploaded to the applicable field or the contentitem doesn't even have a image field with that name) I get an ugly image outline in most email clients.
I would like to test if there is an image available and if not, not adding the first ... leaving only the teaser text.

Can someone explain which "template" code must be used in order to achieve this?

Code used so far:

    Your subscriptions on [site:name] notify you of the following changes since the previous digest:

    {{[subs:items:count]#

    #1 of [subs:items:count] {{[subs:items:index:#0:subs:is-new]?(new):}}{{[subs:items:index:#0:subs:is-updated]?(updated):}}{{[subs:items:index:#0:subs:is-old]?(commented): [subs:items:index:#0:as-node:title]}}

            [subs:items:index:#0:as-node:summary]

    Read more: [subs:items:index:#0:as-node:url]

    }}


texts: Error when trying to edit and save a user field

texts:
When trying to update the settings of an integer field in the user fields, there is an error on saving and the logs show the following error:

  PHP Fatal error:  Call to undefined function element_validate_number() in /var/www/vhosts/**/includes/form.inc on line 1361


texts: How to secure access to a Forena data block?

texts:
I have set up an external database source using the Forena reports module and the PDO driver. This data source has its data security method set to "Use Drupal permissions". The only other option is "Match values provided by a data block".

There is a matching Drupal permission for the data source in admin/people/permissions labelled "Access MyDB data". (Machine name "access my_db data"). The "Access MyDB data" permission has only been granted to a couple of roles.

What I have tried:
I put a line in my .sql file for the data blocks built on this source:

--ACCESS=access my_db data

This prevents anyone from getting any results from the report based on this data block, even the Drupal administrator.

I removed the above line in the .sql file. This allows any logged in user to access the report. It does not respect the permission "Access MyDB data".

How do I set this up so that the access to this data block (and therefore the reports using it) is limited to only those who have the "access my_db data" permission?


texts: How do i use a template file for my content type?

texts:
quite new to drupal here so forgive me if things seems evident for you.i'm building onto an already existing site in drupal 7. the site is a onepager frontpage and from the frontpage there are links to various content types.
now i created a new content type named article.
when i link to such an article from the frontpage i (arrive at an article and) cannot go back to the frontpage through the menu anymore, while it does work with the other content types. I have searched and searched and made sure every setting is the same as the other content types but the links just don't work (they do nothing).
I did see in the templates folder that there are template files for each content type except the one i made. I'm wondering if that is the problem? If so, i don't know what exactly to do to keep it working though. I duplicated a template file and renamed it after node-article.tpl.php, but i guess it doesn't suffice.
can anyone assist?

Thx


texts: How to adjust the login pages with bootstrap?

texts:
Components used:

Bootstrap 3.7.1.
Drupal 8

I would like to adjust the size of the login screen (and related screens) to a size of 6 grids. So I think adding the following bootstrap class

col-md-6 offset-md-3

to

.block-user-login-block

will do the trick. I can add this to the block css.

But bootstrap needs to have .row class just before this. How can I easily solve this?


texts: Storing permanent value in Form while in validation handler

texts:
We can store a permanent value in $form_state in the submission handler, which will be retained against form errors, but I want to know how we can do it while in the validation handler, where I show an error using form_set_error().

In short, I want to show an error in validation with the message "Press submit again to confirm". In this way, if the same form is submitted again it would skip the validation handler.

I can't do it in the submission handler, since it clears the values in the form.

form_set_value() is not able to retain a value.

EDIT (on 28th Dec)

I've found that $form_state['storage'] is works in validator also only if form_state['rebuild] is set to true. Infact this is how we use in submit handler. And if I call form_set_error in the validator form_state['rebuild] is simply ignored even if it is set and the storage value is not retained.


texts:
I want to add extra fields when a node is displayed, the data of this fields are fetched from an external db.

I'm uncertain if I've to use the hook_node_view_alter function or hook_node_view.


texts: How to declare one custom module's dependency on another custom module

texts:
I'm developing a set of site-specific custom modules, and one of them depends on the other one being enabled.

I'd like to declare this dependency in the .info.yml file, but the docs only show how to declare dependencies on contrib projects:

  Dependencies should be namespaced in the format {project}:{module}, where {project} is the project name as it appears in the Drupal.org URL (e.g. drupal.org/project/views) and {module} is the module's machine name.

How do I declare a dependency on a module that is only found in the local codebase?


texts:
I have  PHP 5.6 and 7.1 on my system. I want to use PHP 5.6 for the Drupal 7 projects, and PHP 7.1 for the Drupal 8 projects.

I am having problems getting this setup.
In the documentation I found that I should set an alias like this in my ~/.zshrc.

 alias drush='DRUSH_PHP=/usr/bin/php56 /usr/bin/drush'

The problem is that when I start a new terminal and run drush ev 'print PHP_VERSION', it still prints out 7.1.6.

I tried to alias PHP to /usr/bin/php56 but that also did not work.

I also tried the following suggestions (and many others), but they didn't work.

Drush in a system with 2 PHP-Versions
Drush–alias to run it with another php version

I think this changed in more recent Drush versions, like version 8.1.12 I am using.

Can anyone help me find the correct way to do this in more modern Drush versions?


texts: How can I index all remaining items programatically?

texts: I'm just using the stock Drupal 7 search. Is there a function to index all the unindexed content from my module? And re-indexing? I haven't found this yet if it exists.


texts: What is the purpose of variable_get in multilingual websites?

texts:
I have installed a module and didn't find any possibility of changing the text strings appearing in the web. I went through the code and found the following:

variable_get('chosen_no_results_text', t('No results match'))

The string in the t function had been translated for me, but nothing happened.
As far as I understand, this introduces a variable with a fixed value, so I cannot have it translated for every language, and the variable is seen by all the users, irrespective of their prefered languages. Am I right? Is it a bug? Am I missing something?


texts: Edit "Read more" and "Add new comment" links in teaser

texts:
I'd like to add a couple classes to the "Read more" and "Add new comment" links in my article teasers in Drupal 8.

I'd do this in Drupal 7 by doing something like this in my theme file.

function mytheme_preprocess_node(&$variables) {
  $variables['content']['links']['node']['#links']['node-readmore']['attributes']['class'][] = 'btn btn-primary';
  $variables['content']['links']['node']['#links']['comment-add']['attributes']['class'][] = 'btn btn-primary';
}

But this doesn't work in Drupal 8. I dumped the contents of $variables['content']['links'] and all I got was this:

$variables['...']['...'] array(2)
    '#lazy_builder' => array(2)
        string(40) "Drupal\node\NodeViewBuilder::renderLinks"
        array(4)
            string(1) "4"
            string(6) "teaser"
            string(2) "en"
            boolFALSE
    '#weight' => integer100

So how would I go about adding classes to these links in Drupal 8?


texts: How to link fields from a Content Type to an Entityform field

texts:
Using Drupal 7. Our Recruiting department will be creating events & at these events want to be able to hand a tablet off to an individual so that they can enter info about themselves:

Name
Address
Email, etc...

After content is submitted the Recruiter then can go in & enter "Notes" about the individual.

I'm using Entityforms for that part.

I've also created a content type for Events.

Data would be Event Type (Career Night, College Fair, etc) Location (Rutgers University, etc) Date of Event, Recruiter (Last name) & after the event enter Number of Attendees.

I'm trying to figure out how to relate an applicant to the event that they attended. I'm not having any luck with Entity References.

I'm thinking the related items would be Event Date, Location, Recruiter. I can't figure this out. Any help would be appreciated.


texts: 'Unlinking' a link for users without permission

texts:
I have a link which goes to a page created by a custom module. The module implements hook_permission and hook_menu so that when a user without permission clicks the link they get sent to the page and are shown the 'You are not authorized to access this page' message.

Is there way I can 'unlink'/'de-anchor' the link, so that the link displays as just unclickable black text to those without permission?

Thanks


texts:
I'm looking at creating a private number / license plate application and wondered what the best tools were for the search aspect of it.

I would like the search to have the ability to have the letter A show results including the number 4.  For example a search for "A4" would show 44, AA, 4A, A4. I would like the ability to be able to set the parameters eg A = 4, L = 1 and so on.

What would you recommend I use?


texts: Populate Dropdown list from a web service without code

texts:
I know that in Drupal a drop down list field can be populated with taxonomy terms, but is there a way without having to go custom (custom PHP development) to populate a dropdown list from the results of consuming a web service?

Say I consume a web service that returns the weather for the current week (7 days), I would like to populate the data returned into a dropdown list so that whenever the data is changed at the web service it is automatically reflected in my list.

Is there way to do this in the Drupal UI?

Many Thanks


texts: Access denied on image styles files on Drupal 7.34

texts:
As you can see in the screenshot below, images that are processed through image styles aren't showing up and when trying to display them through their urls, we get a 403 access denied.

It's a fresh drupal install on a Debian 7 with no additional modules

Any ideas are welcome to overcome this problem

Thanks


texts: Uncheck Generate automatic URL alias problem

texts: When I add new content I uncheck generate automatic url, but below, the Url Alias text field where I want to add custom url is still disabled. I'm not able to write my custom url there.