texts: Which configuration settings should be used to prevent "No statistics available" in the Admin Reports?

texts:
When I view the Admin Reports like Top Referrers, Top Pages, Top Users, etc (by navigating to /admin/reports), those pages simply say "No statistics available". I am using Drupal version 7 with an admin account with all permissions.

Google Analytics is successfully collecting this data, so I don't understand why Drupal is not. I can't find any configuration setting to enable these reports. Could this be an issue with my webhost?

I apologize if this post is vague. I just don't know how to go about diagnosing this problem.


texts: field_view_value() with product reference field doesn't display attributes

texts:
I'm trying to render a product reference field using field_view_value() - which works except for the attribute options don't render.  If it's rendered normally on a node, or in views then the attributes display as normal. Any ideas how to fix this?

$product_obj = node_load($nid);
$product_field = field_get_items('node', $product_obj, 'field_product');
$cart = field_view_value('node', $product_obj, 'field_product', $product_field[0]);

print render($cart);


texts: How to tell if a view is cached from generated HTML output?

texts:
I have a view on my page and I've cached it using Views caching. Is there a way to tell that the view is cached from the output or the headers? This question says that Drupal sets the header X-Drupal-Dynamic-Cache but I don't see that in my browser's inspector. I do see the header X-Generator:Drupal 7 (http://drupal.org) so that's nice.

It would be nice to see an HTML comment, like what the Boost module does.


texts: How i can add a new line in my code here?

texts:
HI guys go to THE TEXT THAT FOLLOWS I WANT IT IN NEW LINE and help how to separate that text in 2 lines

 $form['kkkkkk'] = array(
          '#type'          => 'textfield',
          '#title'         => t('blablabla'),
          '#default_value' => variable_get('kkkkkkkk', ''),
          '#description'   => t('sdakgbflabfgdsbf "THE TEXT THAT FOLLOWS I WANT IT IN NEW LINE" fdghhtrjgvfnbhsgf.'),
          '#required'      => TRUE,
          '#size'          => 10,
          '#required'      => TRUE,
        );


texts: Slightly different menus for different domains

texts:
I'm using Domain Access module (http://drupal.org/project/domain) for running few very similar sites out of single Drupal 6 installation/database.

What I need is to have slightly different menus between those sites.

Generally, most items will be exactly the same throughtout all domains, on some of them though I don't want specific items to be displayed (for example, maybe later there would be other requirements too).

Haven't found any module offering such functionality, so considering other options now.

Simplest and easiest solution would be to hide them using CSS, but definitely this is not a good solution.

hook_menu_alter was disqualified as well, for quite obvious reasons.

What I'm thinking about right now is doing it from theme_menu_item() / theme_menu_item_link() level. Haven't looked yet into possibility of basing it on (something like) node access permissions (which actually would mean writing own module for this), going to do it as well, but meantime perhaps someone could suggest even different approach?


texts: drupal gridview drop down menu - showing all menu and sub menus under one parent

texts: I would like to show drop down menus in gridview format. ideally it should show all sub menus and sub sub menues under one parrent. any module which can service this purpose?


texts: How to make product views display also show up for Anonymous users in Drupal Commerce?

texts:
I created a Product listing view with Add to Cart Buttons. The view displays perfectly for the Super User, but it is not displaying for Anonymous or Authenticated users.I do have a relationship "referenced product" but it is still not working for anonymous users.

What I did to solve the problem is to go to the permissions page and give everybody the "view all products" permission. This works. BUT: It might open up a security issue. Please let me know what am I doing wrong?


texts: How do I remove classless divs around my paragraphs?

texts:
Using stable as a base theme, I'm building a theme that will provide styles for paragraph items.

The default output (without any templates affecting this area) seems weird to me, though. Take a look at this simplified version (stripped of data--classes):

As you can see, the wrapping element around all paragraphs, as well as the element wrapping each paragraph lack any classes and are therefore quite useless. Furthermore, for the indivudual paragraph, another div inside them has a class that would actually be useful, but it's too far down the document hierarchy to be actually useful in styling.

Attempting to remedy this by myself by modifying paragraph.html.twig, I can get to the div currently holding the .paragraph class, but nothing above that.

I assume all has it's purpose, but I also think this is a weird default behavior, as there is no apparent need for two nested divs for each individual paragraph in any normal use case. Am I missing something?


texts: Is it possible to queue up a content block within a plugin block?

texts:
I have a plugin block that returns a render array based on taxonomy of the node. I want to make a default custom block appear when there's no taxonomy term selected. I've tried this:

else {
  $block = Block::load('default_cta');
  $render = \Drupal::entityManager()->
  getViewBuilder('block_content')->view($block);
  return $render;
}

Which is how I'd render a content block, but this throws Call to undefined method Drupal\\block\\Entity\\Block::isDefaultRevision(). This post How can I programmatically display a block? describes the difference between a content block and plugin block, and I'm guessing I can't call one within the other. Is there another way to do this without creating the default render array from scratch?


texts: Error line appears when using drush 7.x.5.9 -- 32-bit executable?

texts: I keep getting the line "/[~]/drush/drush: line 49: /sw/bin/tput: Bad CPU type in executable" in drush 7.x.5.9 on OS X 10.9.2 Core 2 Duo. I think it's related to a 32-bit executable running on a 64-bit-capable processor. Any ideas? It has only happened since I upgraded to 5.9.


texts:
I've installed eu-cookie-compliance module in few projects and everywhere it worked as expected but in one project I have problems with loading JavaScript in correct order.
Even if I implement hook_js_alter and set higher weights, eu-compliance JavaScript is loaded before misc/drupal.js and misc/jquery.js. Is there any better way to reorder this JavaScript?


texts: How to add theme from github with composer

texts:
I have a Drupal 8 installation and I like to install a theme from github.com using composer.

It is this theme https://github.com/forumone/gesso

Can anybody help me what I have to add to the composer.json and where?


texts:
I think I might found a bug(?)

Only administrators can create content on my site, so I am trying to
remove the login form from the front page, its okay that the login page
can be accessed at site/user/login, but not on the front page, I have tried quite a few things.

I have followed the guide in https://www.drupal.org/node/13777

Im using the bartik theme, I have sub-themed it, but I have barely changed anything in it, basically just a little css.

And I have tried the following:

admin/structure/block and hide the user login block.
admin/structure/block and completely removed the block.
admin/structure/block and moved it to a specific location and then hiding it based on page.
admin/structure/block and moved it to a specific location and then hiding it based on role.
admin/config/people/accounts and disabled register/login for anonymous users, which I guess works as they can't register, but the login form is still on the front page.
Hide the block with CSS, which works, but then I can't ever login before I change the CSS back.

Adding some images + github link:
Github link: https://github.com/DenLilleMand/christianssite
Imageone(frontpage):

Imagetwo(structureblock):

Imagethree:


texts: why is a day's first page load a white screen filled with characters?

texts:
often when loading our Drupal 7 development site for the first time in the morning OR for the first time any given browser has been used in a while, we get a white screen filled with a large assortment of characters (see example below).

This has been the case for several months and doesn't seem to have corresponded to a particular change we made. It is definitely NOT browser specific; has been the case through multiple D7 core updates; we only work on Win7 so not sure if it would be the same on a Mac. In any case, the very next page load consistently loads the site correctly, but, of course, I'm concerned about end users having an experience like this once the site goes live.

Has anyone else experienced this or know what the cause and cure are?


texts:
I need to change the calendar week view, to be more user friendly.

The website has some dates for events, which are mainly during night; for example, there are events starting at 2AM. It doesn't make sense displaying these events in next day. If the party starts on Saturday night at 2AM, then it could be confusing for the user to display it on Sunday. How can I adapt the week templates to start the day at 5AM (instead 00:00) and finish at 24:00 (instead 24:00)?

And about multi-day dates, how to display them next to the single day dates?


texts: Is it safe to protect the images only with a watermark image style?

texts:
I'm building a website for selling stock photography and I'm looking for a way to protect the images. Here's what I'm using right now:

Imagecache Actions to watermark photos
Private file system for uploading all images
The images are displayed on the front only through image styles with watermarking.

Question: is this enough and are there any ways users could bypass this (e.g. by directly trying to access certain image style)?

Thanks!


texts: How to load field configurations in code

texts:
I have defined fields using the UI, and some more fields using YAML files in my custom module, e.g.:

The field storage is defined in field.storage.node.my_heading:

langcode: en
status: true
dependencies:
  enforced:
    module:
      - my_module
id: node.my_heading
field_name: my_heading
entity_type: node
type: string
settings: {  }
module: core
locked: false
cardinality: 1
translatable: true
indexes: {  }
persist_with_no_fields: false
custom_storage: false

The field instance (which attaches a field to an entity) is defined in field.field.node.my_content_type.my_heading:

langcode: en
status: true
dependencies:
  config:
    - field.storage.node.my_heading
    - node.type.my_content_type
id: node.my_content_type.my_heading
field_name: my_heading
entity_type: node
bundle: my_content_type
label: 'Heading'
description: 'An optional heading'
required: false
translatable: true
default_value: {  }
default_value_callback: ''
settings: {  }
field_type: string

After installing this custom module, how do I get the field configuration in code?


texts: When removing a file it still is present on the machine

texts:
When deleting a node the files attached to that node are removed from the server just fine. However if I edit the node and remove the file there, it stays on the server even after deleting the node.

Is this normal? Is there a way to fix that?


texts: How can I change the node path shown to the user?

texts: How can I change the path part of the node URL from ?q=node/2 into something more meaningsful. I want, for instance, to display it like this: ?q=Services.


texts: check_plain() error when used with variable_get()

texts:
I'm incorporating email notifications into a custom Drupal 7 module, and I'm using the following code for hook_mail().

$subject_template = variable_get('pto_notification_subject', PTO_NOTIFICATION_SUBJECT);
$message['subject'] = t(check_plain($subject_template), $params, array('langcode' => $langcode));
$body_template = variable_get('pto_notification_body', PTO_NOTIFICATION_BODY);
$message['body'][] = t(filter_xss($body_template), $params, array('langcode' => $langcode));

When I do that, I get this error:

  Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1571 of /var/www/mysite.dev/public_html/includes/bootstrap.inc).
  Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1571 of /var/www/mysite.dev/public_html/includes/bootstrap.inc).
  Unable to send e-mail. Contact the site administrator if the problem persists.

If I print the value of $subject_template and $body_template, I see strings, not an arrays.  Using is_array() on both confirms that as well. Any idea why check_plain() could be reading those variables as arrays?

I also tried the following code, but I am still getting the same error.

function pto_mail($key, &$message, $params) {
  $langcode = $message['language']->language;
  $message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
  if (!module_exists('mimemail')){
    $message['headers']['Mime-Version'] = '1.0';
  }
  switch ($key) {
    case 'request':
      $subject_template = variable_get('pto_notification_subject', PTO_NOTIFICATION_SUBJECT);
      $message['subject'] = t($subject_template, $params, array('langcode' => $langcode));
      $body_template = variable_get('pto_notification_body', PTO_NOTIFICATION_BODY);
      $message['body'][] = t($body_template, $params, array('langcode' => $langcode));
      break;
  }
}

Here's the result of print_r($params):

Array
(
    [!request_user_name] => Information Technology
    [!request_pto_type] => PTO
    [!request_amount] => 8.00
    [!request_date_range] => 7/13/2016
    [!request_reason] => Testing....again.
    [!request_submitted] => 7/19/2016
    [!site_url] => http://mysite.dev
    [!site_name] => My Site
    [headers] => Array
        (
            [Cc] => me@myemail.com
        )

)


texts: "Drush sqlc < myfile.sql" doesn't return the site to previously working state. Are there files to be deleted?

texts:
I've backed up my drupal 8 database via the CLI using drush sql-dump > myfile.sql.

I make some changes to the site and break it, then I try to restore it via drush sqlc < myfile.sql.

It works for a bit, until I click something and it messes up again as if there was something written to the files causing it and it is not just the database alone that is the culprit. I get this error:

  The website encountered an unexpected error. Please try again later.

A totally vague error as I'm not sure what is causing it.

Are there any files that are written to the Drupal directory that has to be deleted as well when doing a drush sqlc < myfile.sql restore?


texts: How do I set up a default value for a text field?

texts:
I am trying to setup a default value according to drupal API (http://take.ms/sSbow) in case if the form is empty (before use filled any data) and not successful.
In hook_form_alter() I already added the code via
$form['#info']['filter-field_geoaddress_proximity']['label'] = t('Distance'); and it works well. Hovewer if I try like these

$form['#info']['filter-field_geoaddress_proximity']['value']['#default_value'] = 21;
$form['field_geoaddress_proximity']['widget'][0]['value']['#default_value'] = 21;

nothing happens.

This my debug info:

Array
(
    [operator] => field_geoaddress_proximity_op
    [value] => 2ield_geoaddress_proximity
    [label] => Drupal\Core\StringTranslation\TranslatableMarkup Object
        (
            [string:protected] => Distance
            [translatedMarkup:protected] =>
            [options:protected] => Array
                (
                )

            [stringTranslation:protected] =>
            [arguments:protected] => Array
                (
                )

        )

    [description] =>
)

Could somebody help me? Doesn't matter it is in hook_form_alter() or any other hook.

Thank you.


texts: Exposed filter or facet for a vocabulary listing select list

texts:
I have to create a form with a fulltext search field and a dropdown listing every terms of a certain vocabulary. On submission the form is redirecting the user with the value of both the fields as parameters in path.
I don't know which should be better to use between a facet or a simple list listing every terms of the needed vocabulary?


texts: How do you reorder an entity reference revisions field during hook_node_presave?

texts:
I am trying to reorder some paragraphs based on a text field within them on node save so the author does not need to maintain the alphabetical order manually, but when I save the node all values are lost. I tried matching the array from $node->get('field_paragraphs')->getValue(), but that does not seem to work.

function mymodule_node_presave(NodeInterface $node) {
  if ($node->bundle() == 'page' && $node>get('field_paragraphs')->count() > 1) {
    $values = $node->get('field_paragraphs')->getValue();
    $entities = $node->get('field_paragraphs')->referencedEntities();
    uasort($entities, function ($a, $b) {
      return Unicode::strcasecmp($a->get('field_text')->value, $b->get('field_text')->value);
    });

    $new_values = [];
    foreach ($entities as &$entity) {
    $id = $entity->id();
    $new_value = [
      'target_id' => $id,
      'target_revison_id' => $entity->getRevisionId(),
    ];
    $index = array_search($id, array_column($values, 'target_id'));
    if (FALSE !== $index && isset($values[$index]['subform'])) {
      $new_value['subform'] = $values[$index]['subform'];
    }
    $new_values[] = $new_value;
  }

  $node->set('field_paragraphs', $new_values);
}


texts: How to Rebuild Registry On Admin Form Submit

texts:
I would like to initiate theme registry rebuild(drupal_theme_rebuild) on a particular form submit. This is admin form for my custom settings:

function HOOK_menu(){
 $items['admin/some-url'] = array(
        'title' => 'Custom Settigns',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('my_admin_interface'),
        'access arguments' => array('administer users'),
        'type' => MENU_NORMAL_ITEM,
    );
 return $items;
}

function my_admin_interface($form, $form_state)
{
    $form['some_settings'] = array(...);
    return system_settings_form($form);
}

The form works well and the settings are being saved, however. The changes involve theme functions, so I need to rebuild the registry whenever the form is submited. What is the best approach? Can I attach to form element function drupal_theme_rebuild or there is hook I can use to call  drupal_theme_rebuild(). What is the best way rebuild theme registry after a form is processed and new settings saved. Thank you for your help


texts:
I am using simplenews_scheduler in Drupal 7 to set up a weekly digest of new content. I am getting the following error on the screen and scheduled newsletters aren't going out, even after running cron. When I send it right away or send it as a test, it goes out and renders just fine.

  Notice: Trying to get property of non-object in
  simplenews_scheduler_node_page() (line 600
  sites/all/modules/simplenews_scheduler/simplenews_scheduler.module)

For reference, here is lines 598-601, referenced in the error:

foreach ($result as $row) {
    $node = node_load($row->eid);
    $rows[] = array(l($node->title, 'node/' . $row->eid), format_date($row->date_issued, 'custom', 'Y-m-d H:i'));
  }

I'm not sure this error is related as it seems to go only to loading editions already sent.

Drupal 7.65, simplenews 7.x-1.1, simplenews_scheduler 7.x-1.0-beta2

Does anyone know what could be causing this error or an alternative to sending a scheduled mailing? The module makes a copy of a base node each for each edition so it's kind of nice.


texts: Menu view does not render when editing profile2 profile

texts:
I am using profile2 and "Menu Views". Why would a view that I have in the menu not return any results at all when editing a user's profile (at the url /user/XXX/edit)? The menu view works on every other page of my site.

Maybe it's because I am theming the profile editing page? I can actually display the menu theme that i'm trying to display on my site's menu on the page itself by putting code within the theme, but no matter what I do it will not display in the menu on this page.


texts:
I have a food recipes site and it has a search feature on home page.

My Questions are :

Once the user search for some thing, they "continue to narrow down the results" . Is it possible with views exposed filters ? or i should be looking into Solar search for  Faceted navigation and Relevancy tuning .

Another Search Interface .


texts: Is there a implementaion of the foundation framework for panels?

texts: I recently heard about the foundation framework and I wondered if there is an implementation for panels.


texts: How to give an 'editor' role rebuild/clear cache permission?

texts: I'm setting up an "editor" role for a D8 site. I noticed there's no "Flush all caches" in the Tools menu. I don't see any permission setting related to caches. How to enable cache clearing/cache rebuilding for non-admins?


texts: Unable to manually install the http_proxy module

texts:
We are behind a corporate firewall, so the first thing I do with new Drupal 7 is to manually download, unzip, & use Drush to enable the http_proxy module ($ drush en http_proxy.) Once that is configured, I can then run cron, do drush dl xxxx modules etc. without firewall issues.

For my first Drupal 8 venture, I updated to Drush 8.1.10; downloaded the Drupal 8 gzip file from the http_proxy project, then copied & unzipped the file to /modules/contrib/http_proxy/ > on my server.

When I try to enable the http_proxy contrib module, I get the following loop -- never get the module enabled.

Is there some special trick with Drupal 8 for manual module installation?

$ pwd
/apps/drupal-sites/TEMS/modules/contrib

$ cls
[drupal@drupaldev1 contrib]$ drush --version
Drush Version   :  8.1.10

$ pwd
/apps/drupal-sites/TEMS/modules/contrib
$ ll -R
.:
total 4
drwxrwxr-x 2 drupal 4096 Nov 17  2012 http_proxy/

./http_proxy:
total 36
-rw-rw-r-- 1 drupal  2446 Nov 17  2012 http_proxy.admin.inc
-rw-rw-r-- 1 drupal   308 Nov 17  2012 http_proxy.info
-rw-rw-r-- 1 drupal  2015 Nov 17  2012 http_proxy.module
-rw-rw-r-- 1 drupal 18092 Sep 17  2011 LICENSE.txt
-rw-rw-r-- 1 drupal   735 Nov 17  2012 README.txt

$
$ drush en http_proxy
http_proxy was not found.                                                                                [warning]
The following projects provide some or all of the extensions not found:                                                  [ok]
http_proxy
Would you like to download them? (y/n): y
Install location /apps/drupal-sites/TEMS//modules/contrib/http_proxy     already exists. Do you want to overwrite it? (y/n): n
Skip installation of http_proxy to /apps/drupal-    sites/TEMS//modules/contrib/http_proxy.                         [warning]
http_proxy was not found.                                                                                [warning]
The following projects provide some or all of the extensions not found:                                                  [ok]
http_proxy
Would you like to download them? (y/n): y
Install location /apps/drupal-sites/TEMS//modules/contrib/http_proxy     already exists. Do you want to overwrite it? (y/n): y
Project http_proxy (8.x-1.0) downloaded to /apps/drupal-    sites/TEMS//modules/contrib/http_proxy.                 [success]
Project http_proxy contains 0 modules: .
http_proxy was not found.                                                                                [warning]
The following projects provide some or all of the extensions not found:                                                  [ok]
http_proxy
Would you like to download them? (y/n): y
Install location /apps/drupal-sites/TEMS//modules/contrib/http_proxy     already exists. Do you want to overwrite it? (y/n): y
Project http_proxy (8.x-1.0) downloaded to /apps/drupal-    sites/TEMS//modules/contrib/http_proxy.                 [success]
Project http_proxy contains 0 modules: .
http_proxy was not found.                                                                                [warning]
The following projects provide some or all of the extensions not found:                                                  [ok]
http_proxy
Would you like to download them? (y/n): n


texts: How to hide menu settings at content creation for specific content types

texts:
I'm adding menu items programatically. Is it possible to get rid of this for specific content types?:

In my situation it's just one more way to break something, and is totally not needed :) .


texts: Embed a collection of form inside a form

texts:
With Symfony2 I can embed a collection of form inside an another form (subform inside form).
http://symfony.com/doc/current/cookbook/form/form_collections.html

I would like know if it's possible inside Drupal 8 please, The documentation (Drupal 8 - Form API) don't talk about that.

Thanks.


texts:
I used Views with 6 fields. I want to overwrite the output for 4 fields, and add "more >>" under one fields output, and make the "more" link to the node. I know that creating 4 template files will get that, but creating 4 template files is too boring.

Is there a way to overwrite the 4 fields in one file? If I can, could you make me an example?


texts: Drupal7, draggable menu reordering missing, weight dropdowns instead

texts:
My client cannot see the draggable arrows next to menu items in the list view, while I can. I checked the cookies and it appears he is missing a cookie that I have in my browser:

  Drupal.tableDrag.showWeight

I'm not sure if this is relevant, but it looks quite promising.

We are both using Google Chrome 13.

Has anyone experienced this problem before, is there a way to force Drupal to regenerate the cookie?


texts: The pager on a form doesn't update upon first submit of the form

texts:
I have a form with filter checkboxes, submit button, results in tableselect and pager.

When I set some checkboxes and press the submit button, a query should be reexecuted, data should be placed into the tableselect and pager should be updated, because new data size can be different with old one.

When I do it the first time, query is executed successfully, tableselect also is updated without problems. But the pager doesn't want to be updated.
And to update the pager I have to press the submit button second time.
But it occurs only I pressed the submit button after the page with the form has been loaded.

Could you clarify me, how can I update the pager after first submission of the form ?

Here is a fragment of my code with the tableselect and the pager.

$q = \Drupal::entityQuery('node');
        $q = $q->condition('type', 'my_node_type')
            ->condition('status', 1);

        $pager_params = [];
        if ($event_types != []){
            $q->condition('field_art_der_veranstaltung', $event_types, 'IN');
        }

        $events = $q->sort('created', 'DESC')->pager(10)->execute();

        $nodes = Node::loadMultiple($events);

        $rows = [];

        foreach($nodes as $node){
            $rows[$node->id()] = [
                'nid' => $node->id(),
                'title' => $node->getTitle(),
            ];
        };

        $form['nodes_container']['nodes'] = [
            '#type' => 'tableselect',
            '#title' => $this->t('Events'),
            '#options' => $rows,
            '#header' => $header,
            '#empty' => $this->t('No events found'),
        ];

        $form['nodes_container']['pager'] = [
            '#type' => 'pager',
        ];


texts: How to migrate users from old drupal d6 site to new drupal 7 site?

texts:
I need to migrate users from drupal 6(old site) to drupal 7(new site) alongwith User Profile from Profile module

I am looking at documentation given in migrate module as follows:

https://www.drupal.org/node/415260

  On Subsequent pages at After adding new migrations, or making changes
  to the arguments of previously-registered migrations, if you want them
  to be recognized by Migrate, you need to:

  Clear the Drupal cache, so any new classes are added to the Drupal
  cache registry. Perform the registration, either with drush
  migrate-register or by visiting admin/content/migrate/configure and
  clicking the "Register statically-defined classes" button.

I have created migrate_xyz.info ,migrate_xyz.module and migrate_xyz.migrate.inc files
As mentioned above when I move to admin/content/migrate/configure i get a blank screen

Is this the right way to go for migrating users from drupal 6 to drupal 7?
Or should I use some other module like migrate_d2d


texts:
I created a website for my small company and I wanted to share it on social media site. Doing so, I noted I get the Lorem Ipsum dummy text as meta description.

How do I change that text?


texts: Enabling a contributed module under certain path only

texts: Is it possible to enable a certain custom module under specific path only e.g. /store, and not load under other sections of a website? I am using Drupal 7.


texts: Directly adding data in MYSQL tables made through drupal

texts:
I have a simple three fielded (name, address, country) content in drupal. I have a csv containing 1,000,000 row lines of data. I need to fill up  all drupal content type I made with the csv data.

First, I used FEEDS module but the importing is unacceptably too long. I tried to insert the data directly into MYSQL (ex: field_data_field_name and field_data_revision_name). It is successfully inserted into MYSQL but it does not show/update in the DRUPAL content.

How to make the Drupal synchronize with the newly added data in the table of MYSQL?


texts: Ubercart 3.x catalog page (terms categories) theme?

texts: How to change output theme for categories page in Ubercart 3 for Drupal 7?


texts: Rules not marking all registrations to complete when commerce order is complete

texts:
I am using the RedHen raiser profile which comes with Drupal Commerce and entity registration set up and ready to go. In my set up users can 'register for an race/run event' The process is they choose the number of 'tickets' they want. Based on this number entity registration shows that number of registration forms. User completes the registration forms, then hits the checkout process which tallies up the number of registrations for the order.

A single order can have multiple registrations.

I have a rule to mark all registrations to 'Complete' when the order is finished.

When I use the 'When an order is first paid in full' event only one registration from the order gets marked as complete.

When I use the 'Completing the checkout process' event all registrations are marked as complete.

From what I understand using 'Completing the checkout process' isn't safe because technically a user could get a failed credit card transaction and the completing the checkout process would return as true.

Below is the export of my rule using the completing the checkout process.

{ "commerce_registration_complete_upon_full_payment" : {
"LABEL" : "Set Registrations to Complete upon Full Payment",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "Commerce Registration" ],
"REQUIRES" : [ "commerce_registration", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"DO" : [
  { "commerce_registration_set_state" : {
      "commerce_order" : [ "commerce-order" ],
      "registration_state" : { "value" : { "complete" : "complete" } }
    }
  }
]}}

My question is: How can I mark all registrations in the order to complete when the order is truly complete?


texts: Video host URL different in full content page links than in View links

texts:
Background: Site in question has a custom content type "video record" containing many custom fields including a URL to brightcove.com-hosted video. (Note, the site is not using any Brightcove-specific modules.) A thumbnail image activates the link in both the full content view of a page and also in a View displaying a smaller selection of the fields from this content type. In both cases, the link is opened in a modal window generated by the module "lightbox2."

Problem: Thumbnail links from the View work as intended. Links from the full content page do not work, although they were working at an earlier point in site development. Unfortunately we don't know at what exact point, in the course of core or module updates, this functionality was lost.

Additional Info: Looking at the links in Firebug, we see an obvious difference: The ones that work (from the View of fields drawn from this content type) include a string beginning with "bcpid1235797793001?bckey= ..." and ending with a string of type "&secureConnections=true&secureHTMLConnections=true" that exists in the URL field of every node of this type. The ones that don't work are lacking both strings.

The Question: The link in the View and the one in the full content page must draw from the same URL field, as there is only one such field for each content item. In the case of the full content type, why might it be stripping out parts of the original URL and delivering a result that doesn't work?


texts: Custom exposed view filter plugin drupal 8

texts:
I am totally new to drupal 8 I have custom view field plugin created to render the user type permission(anonymous or authenticated) for each node displayed in view.

for that i used the content access module to get permission for any node.. here's the code

/**
*
* @ingroup views_field_handlers
*
* @ViewsField("node_access_level")
*/
class NodeAccessLevel extends FieldPluginBase {
  public function usesGroupBy() {
  return FALSE;
}
public function query() {
 // Do nothing -- to override the parent query.
}
protected function defineOptions() {
  $options = parent::defineOptions();
  $options['hide_alter_empty'] = ['default' => FALSE];
  return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state)
{
  parent::buildOptionsForm($form, $form_state);
}
public function render(ResultRow $values) {
 $id = $values->_entity->id();
 $nid = Node::load($id);
 $operation = 'view';
 $roles = content_access_get_rids_per_node_op($operation, $nid);
 $user_roles = Role::loadMultiple();
 $role_names = array_map(function ($role) use ($user_roles) {
  return $role == 'administrator' ? '' : $user_roles[$role]- >get('label');
 }, $roles);
  return implode('/', array_filter($role_names));
 }
}

Now this works perfectly ...and gives me a node access filed in every view and display the the access in column i specify. now i want to create a exposed filter for it.. i have updated the hook view_data and using this code..

/**
* Filter content types specified in page manager config
*
* @ViewsFilter("node_access_level_filter")
*/
class NodeAccessLevelFilter extends ManyToOne {
  public function init(ViewExecutable $view, DisplyPluginBase $display,  array &$options = NULL){
  parent::init($view, $display, $options);
  $this->valueTitle = 'Allowed event titles';
  $this->definition['options callback'] = array($this, 'getOptions');
 }
 /**
 * Helper function that generates the options.
 * @return array
 */
 public function getOptions(){
  return array('Public' => 'Public', 'Logged In'=>'Logged In');
  }
 }

the filter is field is available and i have the desired dropdown.. But ut doesn't filter the content.
Doesn't the filter works on same title.Also does my filter know which field to filter on. How can i do that..
Can any1 help. do i need to update some query or what to do.


texts:
any module available, to implement a work flow when user is trying edit the user profile fileds (custom fields). Following is my use case

1) User can edit the profile field , but admin approval is required to update it
2) Admin can either approve or reject the profile update
3) If it is approved need to change the user role , and need to send an email to the user
4) If rejected , need to trigger an email again

Thanks


texts: Help with a dynamic select list of flags for webform

texts:
so I've been trying to implement a 'sample request' feature on my site. I had tried to use the webform views module, which worked except that I couldn't add checkboxes to the view that displayed and webform views doesn't play well with the latest release of webform.

I found this Sample Request w Views, Flag, and Webform tutorial, which is basically exactly my use case.

I've created my own module, and am stuck with some of syntax in the view and options parsing array function. The article mentions that I need to reference the title of the nodes 'owner' but I'm not 100% on how this applies to my implementation.

I've altered the code so the function names reflect my custom module, my predefined view of my flag, but I can't get the list to show up in my predefined lists options. I think this is because I don't have the right field referencing my node's title, but I'm not sure. Also the dpm() statement didn't fire.

I know this is a lot, thanks in advance.

 function webform_hook_select_options_info() { $items = array(); if (function_exists('_MODULE_user_flag_sample_requests')) {
 $items['MODULE_user_flag_sample_requests'] = array(
  'title' => t("Sample Requests (User Flag list)"),
  'options callback' => '_MODULE_user_flag_sample_requests',
 );}return $items;} function _MODULE_user_flag_sample_requests() {$view = views_get_view('webform_flag_views', TRUE);$view->set_display('webform_options');$view->execute();$options = array();dpm($options);if ($view->result) {$row_class = $view->style_options['row_class'];$attributes = $row_class ? " class='$row_class'" : '';
 foreach($view->result as $item) {
   $options[$item->nid] = '<a' . $attributes . '>' . render($item->field_field_img[0]['rendered']) . ' ' . $item->field_ref_node_title . ' (' . $item->node_title . ')' . '</a>';
 }}else {
 $options[0] = t("Nothing");}return $options;}


texts: How do I add repeating dates programmatically?


texts: What is the cleanest way to export one of the view page in D6 to D7?

texts:
What is the step by step procedure for exporting a view in d6 to d7?

Views in D7
Also I have a content of type 'abc' .When creating a view I

show -> content of type 'abc'
Now for display format i use fields
How can I add user uid to the fields.!
I tried adding relationship but could not get through?

The image I have shown contains the fields in d6 which has user uid even though it has content type 'abc'


texts: How to programmatically set role based permissions on a field?

texts:
How do I programmatically set role based permissions on a field?

For example, I have field_my_field, for which I want the following permissions:

Owner can view and edit
Role X can view and edit
Role Y can view only

Looking in the database, the role_permissions table looks like it's what contains the data, but I'm confused about the actual permissions, as they're very close to natural language. e.g. 'access site in maintenance mode' although field ones make more sense:

Edit own field_my_field (owner can edit)
View own field_my_field (owner can view)
Edit field_my_field (can edit any)

I guess it's something along the lines of granting the permission to a RID, and identifying the module which interprets the permission.

Note: I'm trying to do this in another module with PHP - not in the UI. The Field Permissions module is great, but I need to do this in my code.


texts: Drupal Commons 3 and Original Drupal Core Updates

texts: I'm may be planning to switch over to Drupal Commons 3. When the original Drupal core gets security updates, will I be able to get those updates in the Drupal Commons or do I have to wait for Drupal Commons to release their own patch? I'm not sure if Drupal Commons modifies the original Drupal Core's code. Sorry if this question is already answered in an FAQ somewhere but I couldn't find the answer and I'm pretty new to Drupal.


texts: Upgrading to  Drupal 7.7 produces a fatal error: What can I do?

texts:
I have upgraded my local site to Drupal 7.7 from Drupal 7.4, following the instructions in How to upgrade Drupal 7 to Drupal 7.2.

Before I could use update.php, visiting my site got me this message on every page of the site:

  Fatal error: Class 'DatabaseConnection' not found in C:\Users\Developer\Documents\Sites\accountablog\includes\database\database.inc on line 17

Doing a database restore did nothing to alleviate the problem.
What can I do to fix the problem?


texts: How to force caching to work for View with filter by date offset?

texts:
Faced with a strange situation: if a View uses filter "Post date" (or similar) with an offset (eg, "> = -1 month"), this View won't cache.

Example: I create a simple View with Block display.

Field: "Content: Title"
Caching: "Time-based | 1 hour/1 hour"
Block caching: "Cache once for everything (global)"

Of course, global setting "Cache blocks" is on.

If I place this block on a page, it is cached properly.

I want to filter nodes for a certain period of time. I add filter with an offset from the current time: "Content: Post date (>= -1 month)". And this block will no longer be cached! Every time I load a page with this block, there is a new call to the database ("SELECT node.title AS node_title ..."). In addition, the table "cache_views_data" is filling with multiple records like "my_view:block_1:results:1a2s3d4d" and "my_view:block_1:output:m0n9b8v7".

How could I force caching of this block to work?


texts: Rules: Do action on the field of referenced node

texts:
I have an "Authors" Content-type, that users can add to their "Article" node while adding a new content as Co-Authors.

Note that it's a seperate content-type not users.

in "Authors" content-type I have an "Email field" which contains the email of the co-author.

What I want to do is using rules, send an email to the referenced node's email field

I juggled around in rules but couldn't really make it work, I'd really appreciate a step-by-step process of rules to achieve this, thanks.


texts: taxonomy terms view with custom alphabar (for Spanish)

texts:
I have a lot of views displaying taxonomy vocabularies with alphabar, the problem is that all the alphabar are by default showing the order for English alphabet, Spanish has ñ and accented letters, at both the alphabar as in the views, words starting with this letters are sent to the back, for instance, alphabar is like this:

......w | x | y | z | ñ | á | é | í | ó | ú

the ñ should be placed after n and those letters with accent shouldn't appear, they should be included within the corresponding unaccented letter

same for order in the view, for instance words are ordered like this (fictional words for the example)

awto
axma
aypa
azor
años
aísi
aóko
etc.

when correct order should be like this:

aísi
años
aóko
awto
axma
aypa
azor

Any idea on how to solve this? Thanks in advance!


texts: How to access data from external MS SQL database tables in a Drupal site running on MySQL

texts:
I am currently working a academic medical department that uses a lot of MS SQL databases because faculty set them up - making us the maintainers :(

We also recently launched Drupal 6 site on LAMP, with the goal to move from what was supposed to be a .NET shop to PHP and MySQL ... go open-source!

My problem: Fetch data from external MS SQL database tables into Drupal which runs on MySQL, more specifically integrating Views 2 with this external data and dynamically show it on the site.

What I have found out so far:

People have tackled this problem since Drupal 4, but no one is owning it and so ... no stable solution.
Drupal can only run one type of db driver per site. Either MySQL/PostgreSQL/etc ... given you have the driver.
The MS SQL drivers that are there are not stable and still only solve the problem if my site would already run on MS SQL.
The are interesting modules that rely on the schema module to build table definitions and enable access to external MySQL data. (Table Wizard, Data API)

Right now: Looking into how the Data API module can be used for my purpose by creating a plugin for it for instance.

Any thoughts that would help me in how to access external MS SQL tables would be very appreciated.


texts: Is it important to reset the $user object when accessing global $user?

texts:
I see that some developers reset the $user object in a manner similar to the following:

function my_example_callback($args) {
  global $user;
  $account = $user;
  $user = user_load(1); // Bypass access checks with User 1.
  $data = views_embed_view('my_view', 'page', $args);

  // Do things..

  // Reset the $user to the original value.
  $user = $account;

  return $data;
}

My question, is this really necessary? If so in what situations?


texts: How to add properties to ConfigurableLanguage config entity?

texts:
I need to add some properties to the ConfigurableLanguage. I need to have them editable when editing or adding a language and when getting language object from language manager service.

I can handle altering forms, but what about storing those properties and having them available with Language objects?

I was tempted to extend ConfigurableLangue and use hook_entity_type_build() to replace ConfigurableLangue class with my own implementation. However I'm not sure if works for config entities too (I've used this method with content entities). Nevertheless I've noticed scattered around core few calls to static ConfigurableLanguage::createFromLangcode() which returns instance of ConfigurableLanguage class. So extending ConfigurableLangue won't solve my problems.


texts:
I am trying to find a field (ideally, for use with Entity Forms), or a webform module that allows me to poll users.

I have found several modules like "Fivestar" and others that do basic polling, but I want to be able to do relative/comparative ranking.  Essentially I want to be able to give users a list of options (say A, B, C), and allow them to rank in order (1, 2, 3) by their opinions.  Ideally this could be done via a draggable table.

For what it is worth, it appears to be on the roadmap for the pollfield module (https://drupal.org/project/pollfield), but that module doesn't appear to be supported.

Any suggestions or leads would be greatly appreciated.


texts:
I am looking for a simple and effective way to implement template for specific block IDs.

From what I read in Author information lost after saving node and Drupal 6 Template Suggestions, I came up with the following code, which doesn't seem to work:

function mytheme_preprocess_block(&$vars) {
  array_unshift($vars['template_files'], 'block-' . $vars['region'] . '-' .   filter_xss($vars['id']));
}

From the Drupal documentation it should block-module-delta.tpl.php.

Delta is the block ID, that's ok
Module? What's the module here it's a custom block created by adding a block.


texts: is it possible to have multiple image styles for one uploaded image in drupal 8

texts: I have my main story pages. I have one image style set on the content type display page for 880 x 495. I also want to have a image style set for thumbnails sizes of these photos. But as I see it I can only have one or the other. Is there a way to apply multiple image styles to the same uploaded photo field in drupal 8?


texts: I can not access admin/people/permissions, even the link to permissions in the backend-menu is not visible. But I am logged in as admin! So what can be the problem here?


texts: Entity reference view depending on other field

texts:
I have a custom content type that contains an entity reference field (field_referencefield) and one more field as select box (field_triggerfield).

The values of field_referencefield should depend on the selection of field_triggerfield. This should happen in the create node form. I.e. If I change the selected item in field_triggerfield during node creation, different values for field_referencefield should be available. Maybe this can be achieved using views reference.


texts: FullCalendar links open a new tab, don't want that

texts:
I have D7 with FullCalendar (7.x-2.0) installed. When viewing a month view and clicking on an event, the event opens in a whole new browser tab (no matter what browser I'm using).

I don't want that, I want to stay in the same tab.  I read at http://arshaw.com/fullcalendar/docs/mouse/eventClick/ that I could change the "self" value from False to True.  See below,I did that in fullcalendar.fullcalendar.js and now the link opens itself in the existing tab AND a new tab both.

How do I get this to work the way I want?   Thank in advance for any help you can give me.

var options = {
  eventClick: function (calEvent, jsEvent, view) {
    if (settings.sameWindow) {
      window.open(calEvent.url, '_self');
    }
    else {
      window.open(calEvent.url);
    }
    return false;


texts:
So I want to execute a VBO using drush, taking advantage of vbo-execute command to change my workflow state in my views, based on few resources I found this is the command I'm using:

drush vbo-execute list_of_node_for_expire  action::workflow_vbo_given_state_action argument:1

and I end up with this error:

  in field_sql_storage_field_storage_write() (line 514 of
  /modules/field/modules/field_sql_storage/field_sql_storage.module).
  PDOException:

  SQLSTATE[23000]: Integrity constraint violation: 1048
  Column 'field_workflow_states_value' cannot be null: INSERT
  INTO {field_data_field_workflow_states} (entity_type, entity_id,
  revision_id, bundle, delta, language, field_workflow_states_value)

  VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1,
  :db_insert_placeholder_2, :db_insert_placeholder_3,
  :db_insert_placeholder_4, :db_insert_placeholder_5,
  :db_insert_placeholder_6); Array (
      [:db_insert_placeholder_0] => node
      [:db_insert_placeholder_1] => 34924
      [:db_insert_placeholder_2] => 34924
      [:db_insert_placeholder_3] => listing
      [:db_insert_placeholder_4] => 0
      [:db_insert_placeholder_5] => und
      [:db_insert_placeholder_6] => )

I have no idea why it's giving me such an error, I'm not even sure if it has something to do with VBO or not, but using Views UI, I can execute my VBO with no errors.


texts: Multiple problems after updating to 7.54

texts:
I am working on a D7 site with the latest stable version of Commerce and several Commerce Contrib modules. I recently applied the core 7.54 update from 7.53 and it appears to have caused several problems with my DC set up; specifically 1) the Store Admin UI; 2) Cart Shipping Calculations; 3) the addition of Coupons; 4) the system message list (particularly for cart actions doesn't clear, and builds up).

First, all of these symptoms seem to be related to 7.54 because I have the same code base (same module versions) on a test server without the issues.

Commerce Admin UI whatever is happening has broken part of the commerce store ui. I cannot add line items to an order (not coupons, not products, not shipping). When I select one of the line item options and click "add line item" the spinning icon appears but it stops. The same behavior occurs regardless of which line item type I choose. I can confirm that this functionality is preserved with 7.53. This seems to be caused by an ajax error "Invalid Form POST Data".

Commerce Shipping I have three commerce shipping services, two flat rate, one based on the Postal Code and Weight Module. When a user proceeds through the cart checkout process, the Shipping calculation is not performed and the user can proceed to payment without shipping charges being applied to the order. I receive the follow watchdog error: "Invalid POST data" from ajax referred  by mysite.com/checkout/294/checkout. If the user were to go back to checkout page, the shipping charge is calculated.

Warning: Missing argument 1 for addressfield_default_values(), called in /home/phislub9/public_html/sites/all/modules/commerce_shipping_postal_code_weight/commerce_shipping_postal_code_weight.module on line 81 and defined in addressfield_default_values() (line 374 of /home/phislub9/public_html/sites/all/modules/addressfield/addressfield.module).
Warning: Missing argument 2 for addressfield_default_values(), called in /home/phislub9/public_html/sites/all/modules/commerce_shipping_postal_code_weight/commerce_shipping_postal_code_weight.module on line 81 and defined in addressfield_default_values() (line 374 of /home/phislub9/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined variable: field in addressfield_default_values() (line 375 of /home/phislub9/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined variable: instance in addressfield_default_values() (line 375 of /home/phislub9/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined variable: instance in addressfield_default_values() (line 376 of /home/phislub9/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined variable: field in addressfield_default_values() (line 408 of /home/phislub9/public_html/sites/all/modules/addressfield/addressfield.module).
Notice: Undefined variable: instance in addressfield_default_values() (line 409 of /home/phislub9/public_html/sites/all/modules/addressfield/addressfield.module).

I am led to believe that this is an issue with core version 7.54 because these errors don't occur on the 7.53 codebase.

Commerce Coupon Adding percentage based coupons also fails with the "Invalid Post Form Data" notification in watchdog. Coupons can be input but they are not applied when submitted. The form simply clears.

System Message Box Unclear if this is related, but the system message box also seems to be affected. The system message box keeps every cart action in the box, leading to a larger and larger box. This clears after flushing the cache as an admin, but users do not have this option and therefore cannot clear the message box.

I'm not sure what else to add here, other than recently the server has been throwing PDO errors and crashing with the mysql server going away. It is a large codebase (over 100 modules).

UPDATE the module suggested in the comments here worked. Truncating the cache tables did not work.


texts: Disqus comments block no longer loading, was working before update

texts:
After a recent update, loading Disqus through a block in my node template file no longer works. I know my Disqus settings are correct as it has been working for the past year with no issues. I recently upgraded to version 7.39, but am unsure from what version. The code that I use to load the Disqus block is:

$block = module_invoke('disqus', 'block_view', 'disqus_comments');
print render($block);

If I print the contents of the block array, it is empty.

print_r($block); => Array ( [subject] => [content] => )

Things I have tried:

Disabling Disqus and enabling it.
Changing location back to content area produced no results. Switched
back to block and nothing.
Turning on testing mode
Using default options

Is anyone else having difficulties with Disqus not loading? My next step is to uninstall and reinstall Disqus but wanted to chech if anyone had any other suggestions before I do so. Thanks!


texts: How to separate Custom Line Items from the Add to Cart form in Drupal Commerce

texts:
First of all, I am familiar with the module Commerce Custom Product, allowing one to add a custom line item field to a product. This works great for a single product - allowing you to do things with Rules etc.

What about when you have a bunch of products? Imagine a fertilizer business. They sell Nitrogen, and phosphorus (which contains nitrogen). A farmer will tell the business that he wants a certain blend. say 10N - 5P, and he wants 10 ton of it. At this point you need to use Rules to determine how much contributing Nitrogen comes from the phosphorus so that you can make the proper blend - which is in this case, 6691 kg of N, and 3309 kg of P - so you need to use a line item field.

What I am looking to do is create a view displaying these products and utilizing the module editablefields for the line item field 'Blend'. The only way to do this is to make something that looks like this, however views now shows each product having its own editable line item AND the add to cart button. .

I imagine one could 'hide' that button under the line item with CSS, but the add to cart button that the 'Quantity' field adds (in the footer) only triggers 1 product id to fire. If you remove the 'add to cart form' from each line then then it will fire all items in the view - and give the quantity requested - but then you cannot have your custom line item show up. Its a catch 22.

Basically, I need to pull the custom line item out of the 'add to cart form' and still be able to use an editable field with Rules OR have the add to cart button on the footer work for all items where the field Blend is > 0. I dont mind getting dirty with custom code either.


texts: How to display a list of nodes in a block?

texts:
I have a custom block and I want to output a list of nodes of a certain type.

This is what I have so far:

public function build() {

$nids = \Drupal::entityQuery('node')
  ->condition('type', 'my_content_type')
  ->execute();

$nodes = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->loadMultiple($nids);

    return array(
      '#markup' => $this->t('How to display list here'),
    );
  }
}

How do I list the nodes by title and ordered by newest at the bottom of list?


texts:
I have an image field type configured to accept an unlimited number of values.

Using the File (Field) Paths module I have set the file name field value to [node:title].[file:ffp-extension-original]

This is fine if you upload one image because it is renamed to my_node_title.jpg for example.

If you upload several images, they are renamed to my_node_title.jpg, my_node_title_0.jpg, my_node_title_1.jpg, my_node_title_2.jpg and so on.

Is there a token I could use or create that would allow me to add a serial value rather than the default _0, _1, _2? For example my_node_title_a.jpg, my_node_title_b.jpg, my_node_title_c.jpg etc.

I'm looking at the Custom Tokens module at the moment but not having much success.


texts: How to get Drupal 7 to search attached PDF and Word documents

texts: From what I have read it seems like you have to use Solr to have PDF and Word attachments indexed and returned in a search.  I have Solr working with Drupal but I think I need Tika working on Solr in order to do the document indexing.  There is very little documentation I can find for Tika.  Does anybody know where a good source for this is?  Is there a better/easier way to have search in Drupal index attached documents?


texts:
I have a custom module which prints html in hook_block_view. The text that my hook_block_view returns(in block['content']) might contain links and mail addresses.
Is there a drupal(or PHP) function that wraps the links/mail id in  ?


texts: Can I output a node CCK value in a Views header in Drupal 7?

texts:
I am using Panels to display a View on each node of a content type.
I am using an override of  views-view.tpl.php to theme the output of the view.
I need to display a CCK value from each node that the View appears on in the header area of the View.
The CCK field I need to output is not a field called by the view so I can't use a token replacement in the "Header" area of the View GUI.
I can't code the header into the content type node template because then it will show up even if the View has no results.

I have tried:

print $my_cck_field[0]['display_url'];

and

echo field_view_field('node', $node, '$my_cck_field');

in views-view.tpl.php and I get no output.

Is it possible to access the CCK data for the node a View appears on from inside views-view.tpl.php ?


texts: Search user by field value using Drupal Search Api

texts:
I have a set of users with field_first_name and field_last_name, and i want to create a user search using the search api, to search for users using those fields, but it doesn't seems to be working.

Here is my code:

$query = Index::load('default_index')
      ->query(array(
          'offset' => 0,
          'limit'  => 12,
      ))
      ->keys($text)
      ->addCondition('search_api_datasource', 'entity:user')
      ->execute();

It's not fetching any of my users per name. I am missing something?


texts: Want to allow a form on another domain to submit registration to a drupal form

texts: I know this is probably a bad idea/imposible, but have to ask.  Is there a way to allow a form on domain "example.com" to submit to the user registration form on "example2.com/user/register".


texts:
I create a field with date format for my content and I set date and time:

2017-12-23 21:45:36

Now when I want to print with these codes:

function mytheme_preprocess_node(&$variables) {
    $date = $variables['node']->get('myfieldname')->value;
    $variables['date'] = $date ;
}

or

{% set date = node.myfieldname.value %}

and use {{ date }} in my template, print:

2017-12-23T17:15:36

( 4:30 minutes difference )

How can I fix it in Drupal 8?


texts: I don't want ajax submit / callback validate form '#required' => TRUE,

texts:
I have form with static fields and dynamic fields as follow:

fieldset

textfield00 (require = true)
textfield01 (require = true)

fieldset

textfield02

fieldset

add textfield
submit button

so, everytime add textfield pressed, it will add new/duplicate textfield02.

with add textfield code as follow:

$form['fields']['modules']['add'] = array(
      '#type' => 'submit',
      '#name' => 'addtextfield',
      '#value' => t('Add more TextField'),
      '#submit' => array(array($this, 'addTextfieldSubmit')),
      '#ajax' => array(
        'callback' => array($this, 'addTextFieldCallback'),
        'wrapper' => 'wrapper',
        'effect' => 'fade',
      ),
    );

the adding field is working fine, the only problem i have here is: because textfield00 and textfield01 is mandatory, if i pressed add button, it will send me an error message 'mandatory fields' before i can add new textfield.

so how can i 'bypass' the requried validation, everytime i press add textfiled and only validate 'required = true' when i press submit button.

Thank You,
AnD


texts: InvalidArgumentException... Class not Found in Custom Module

texts:
Here is the simplified error:

  InvalidArgumentException: Class "\Drupal\prepcart\Controller\PrepCartController" does not exist. in Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (line 24 of core/lib/Drupal/Core/DependencyInjection/ClassResolver.php).

Full Stack Trace:

  The website encountered an unexpected error. Please try again later.
  InvalidArgumentException: Class "\Drupal\prepcart\Controller\PrepCartController" does not exist. in Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (line 24 of core/lib/Drupal/Core/DependencyInjection/ClassResolver.php).
  Drupal\Core\Controller\ControllerResolver->createController('\Drupal\prepcart\Controller\PrepCartController::content') (Line: 74)
  Drupal\Core\Controller\ControllerResolver->getControllerFromDefinition('\Drupal\prepcart\Controller\PrepCartController::content', '/cart') (Line: 91)
  Drupal\Core\Controller\ControllerResolver->getController(Object) (Line: 132)
  Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
  Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
  Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98)
  Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
  Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
  Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
  Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
  Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
  Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Relevant information: Drupal Core 8.1.8 (I know 8.2 is out but this shouldn't matter I believe - we are pinned to this version due to Lightning)

And here is the relevant files involved:

PrepCartController.php

<?php
/**
 * @file
 * Contains \Drupal\prepcart\Controller\PrepCartController.
 */
namespace Drupal\prepcart\Controller;
use Drupal\Core\Controller\ControllerBase;
class PrepCartController extends ControllerBase {
  public function content() {
    return array(
      '#type' => 'markup',
      '#markup' => $this->t('Hello, IHM!'),
    );
  }
};

To make life easier this is the directory structure:

drwxr-xr-x   170B Oct 18 07:05 ./
-rw-r--r--   222B Oct 18 06:36 ./prepcart.info.yml
-rw-r--r--   195B Oct 18 07:05 ./prepcart.routing.yml
drwxr-xr-x   102B Oct 18 06:53 ./src/
drwxr-xr-x   102B Oct 18 06:54 ./src/Controller/
-rw-r--r--   349B Oct 18 06:54 ./src/Controller/PrepCartController.php

For some reason the module won't show on the modules page but I can interact with it fine on the CLI using drush?

Trust me when I say I have been ALL over Google and Stack for this. Major love to whomever can help me here.


texts: A menu block won't show up for second language

texts:
I have 3 separate menus in my header. They are not connected. I don't used secondary menus.

My site is bilingual: english + spanish.

All 3 are created using menus and placed in the same region using blocks. They are all translatable: checked Make this block translatable. And they all have translated strings edited already.

However, when I switch to Spanish one of the menu dissapears and won't show up. I check in the DOM and is not build at all.

Another mention: the menu that won't show up is a category menu: it points to the a page that display article based on the specific category.

Can someone give me a clue?


texts: Building something like an affiliate shop?

texts:
We want something very much like Amazon in that some providers define their products in a (site-)global catalog and customers can buy from this catalog.
Customers and providers have the standard features expected from such a system (history, various reports etc etc).

A little peculiarity is that there are no payments or shippings in this system. We are responsible for gathering the orders from customers and notify the providers. The rest is not up to us.

Which modules do you think we should use to implement such a system ? (Drupal 6)


texts: Drush newbie question: I've copied the policy.drush.inc file from drush examples and saved into my local drush folder, then cleared drush's cache - how do I confirm Drush is using that file (other than attempting to overwrite a production database with a local one!!)


texts: How can I programmatically delete a user?

texts:
I'm new to Drupal development and am way over my head on this one. My company runs a subscription-based site offering market research to corporations. A company pays for a subscription and is granted a certain number of users. The person designated as primary user has the ability to add the remaining users themselves. We now need to add a function to allow them to delete a user who is no longer with their company. In doing so, we need the following to happen:

Delete the record from "users" database table
Change the author on any node created by the deleted user to "Anonymous"
Send an email to our internal support address letting them know that the user should be removed from other non-connected systems

The previous developer created a custom module for account management that allows adding users under several different circumstances. For example the user is completely new to the company adding it, which means they need to be added to our other unconnected systems as well, as opposed to providing a Drupal account to a user who is already in our other systems.
Currently a lot of stuff is being done with JavaScript using Drupal.parseJson to process the request based on the segments of the URL clicked. This was done for the sole reason of being able to update the page with the user list without a complete refresh. I personally don't care if this new function works that way, or if it needs to hit the server and refresh the page. I just need to find a way to do everything in the above list with a single click.

I've looked at the API and found user_delete, but it requires two params - $edit and $uid. The uid is no problem, but all I can find about $edit is that it's "an array of submitted form values." We're not using a form, though; our user lists are static text, and the actions all occur onclick of an href (at this point); so there's nothing being submitted. Is there any way I can fake the values of $edit? Or is there another way to do this? I'm reading about hook_user() and thinking that I'd call user_delete() somewhere to do the actual delete, and then my hook_user() implementation would handle the rest with the $op = delete param. But before I worry about how to get the other stuff happening, I need some guidance about how to call user_delete().

Is it even worth it to use user_delete()? Would it be less trouble to just write my own queries to delete the user record and change any content records to "Anonymous"?


texts: How do I display a field twice in a node's display?

texts:
In my full node display I want to show the same field twice, in a different mode each time.

Specifically, I have a collection of images, I want one up top and the rest below in my already existing gallery view of the node. What I don't know how to do is to show the field for my image twice in a single node display. Is there a module that will allow me to do this with a minimum of fuss?


texts: Notifications from Workbench included content type

texts:
I added a new content type for my drupal 7 site and I have a form in this content type. It has the workbench enabled in this form so that the moderator can approve the submissions and close the forms if they are complete.

The functionality that I am looking to implement now is mailing the user upon the status change of the form. i.e, if the form changes from draft to closed, the user should be notified. I looked for modules or related content for implementing this, but could not find any. What is the best way to do this? Please let me know.

Thanks in advance.


texts: Remove "submitted by" text on teaser only

texts:
I read on How do I remove the "submitted by" text on node display? where you can remove this in the content type settings for the node itself, but is there a way to only change the teaser so it does not display "submitted by" text?

I'm looking for a non-preprocess function or module way to do this; I can't use my theme to deal with it.

I was hoping to avoid using Computed Field module for something so trivial.


texts: Theming the node edit forms  to open them within Lightbox

texts:
I'm trying to display all the node edit forms neatly within Lightbox, without any of the excess content I don't want: no sidebars, footer, header, nothing but just the content. So I created a page-node-edit.tpl.php file.

I have two problems daunting me, but for now I'll only mention the first since its more important.

From any page, clicking on the "edit" link for the node doesn't activate the Lightbox like it should; instead, it clicks through the link as normal.
With jQuery in the header I added a "del" attribute for the Lightbox to the links, but the box still doesn't activate. I tested the Lightbox on a link I hardcoded into the page, and it activated just fine. For elements generated by Drupal, like the node edit link/button the problem seems to be timing.

I think the "del" attribute needs to be built with the page, with the link, rather than appended onto it. The catch is, the link lacks an id and class, so I don't see how the hook_alter_link() function can help me.

I'm willing to try anything. Perhaps someone has opened a node/edit form within Lightbox before.


texts: How can i send a mail to specific user when workflow state is changed or changed to particular state?

texts:
I want to send a mail when workflow state will change from creation to pending,from pending to approval and from approval to published. How can i achieve this. I have tried with rules but it can't be done using same.
I am using drupal 7.34 .


texts: Views paragraph fields in block Twig template

texts:
I understand that I can use content['#view'].field['field_name'].value(rowcount) to get a value of a field.

But how can I refer to fields of a paragraph field, that is in a view block in a file like "block--views-block--NAME.html.twig"?


texts: How to find which content types have comments enabled?

texts: I just want, quickly, to know which content types have comments enabled, without having to go from content type to content type and view the configuration page of each, especially if there are more than fifteen.


texts: How can I remove only submitted time from node view?

texts: I only need to remove the published time from the submitted by field while viewing the node. Is it possible to do with display suite or there are other different approaches?


texts: Should I use t() in a hook_menu's description?

texts:
I have always used t() for hook_menus title and description like this:

$items['some-path'] = array(
    'title' => t('My Page Title'),
    'description' => t('This is a description about what my page is for'),
    'page callback' => 'profile_user_page',
);

This makes sense to me so users can translate the title and description into different languages if required.

However this comment on a module review on DO says:

No, that's wrong, don't do that - descriptions in hook_menu() should never use t().

What is the reasoning for this and is this actually best practice?

Also if this is true then should we not use t() for the title as well?


texts: Use a different confirmation url on completed webform submission in email confirmation link

texts:
When a user submits a webform submission, they get redirected to a confirmation page, in my case its node/40. Now if they also have to click on an email confirmation link, it also sends them to the same confirmation url node/40.

How can you set a different confirmation url for the one in the email?


texts: I am wondering if there is a method to translate the appearance settings section for each theme, for example the logo URL.


texts:
I am doing some processing in hook_boot since I need that code to run on every page, irrespective of whether or not they are cached.

As a result, jQuery is undefined when I add inline JavaScript to the page.

function hook_boot() {
  drupal_add_js("jQuery('document').ready(function() { //do });");
}

The idea is that we will potentially load a lightbox on every page after processing in hook_boot.

The only way I can see round this is using variable_set and then retrieving that in another hook (e.g hook_node_*). However, that might not be sufficient since we need it to run on every page.

How would you get round this?


texts: How do I format a picture field as raw source url in a view

texts: I have a view of users, I'm displaying a number of fields, I want to output the path to the image, without rendering any of the html around it, I cant seem to figure out how to do this.


texts: How do I change the date format to make them appear as May 12?

texts:
I want to view the date as "May 12" (month day).

What should I type in the custom format for date in this case?


texts:
I would like to have an image/phrase appear on profile pages according to the user's role.

For instance, an editor will be identified as such, below their profile photo.

Drupal 6 had a "badges" module. But there doesn't seem to be a similar one for 7. Is there a workaround?


texts: Form block: how to choose which fields are being displayed?

texts: I created a form block using the form block module to allow users to post a certain content type and fill out the form without leaving the page. I don't remember how I chose which fields to show. Currently it only shows the title and the submit button but I would like to add another field and change the label of the button. Can I do that with this module and if so, how? Thanks!


texts: How to place custom menu in user profile

texts:
I have created a user menu as shown below

I am using Edit Profile and Me alias module and the menu system is as below

Edit Account : user/uid/edit
Edit Profile : user/uid/edit-profile
Logout : user/logout

This works fine but I am not able to display it on http://localhost/user or http://localhost/users/uname (alias to the former url). I wanted to show this menu only on that page.

In the 'Visibility settings' of the block, using 'Only on listed pages' option I tried various like user, users/me, http://localhost/user, http://localhost/users/me, but the menu is not appearing on the user page. When I check it with other pages, it works fine. Any idea what might be the cause?


texts: Getting the apartment cleaning and dish washing to work properly with Omega Theme?

texts:
I have enabled the setting under themes for the option, "It also helps you to clean your appartment and wash your dishes." Although double and triple checked, there appears to be no change.

I looked through the code to see if there was anything I could fix but unfortunately I'm a little light on my life-theming capabilities. I haven't yet been able to integrate Drupal with reality as of yet.

Am I missing an extra setting or is this a known bug?


texts: How to Associate Drupal content type with CiviCRM groups?

texts:
I have created the 10 contents in Drupal. This contents are Article content type and also created the new group(group name: students) in civicrm.

Now I want to associate these content with the student group in civicrm.

could you please anyone tell me how to achieve this one ?


texts:
I have enabled the following modules on the site: VotingApi, Like&DisLike, Rest, RestUI and other depending modules

I use POSTMAN as my client and write my GET and POST request from it.

I have Resource "Content" and "Vote" enabled with all methods, auth and format.

I have created a REST Export view of the content and vote.

When I try to GET and/or POST to create a content I was able to do it successfully.

But when I use POST to vote on the content, I get a 403 response. I have provided a correct credentials on it, with header same as content has.

In Drupal browser logs, it says:

Type    access denied
Date    Friday, June 30, 2017 - 07:12
User    Anonymous (not verified)
Location    http://example.com/entity/vote
Referrer
Message /entity/vote
Severity    Warning
Hostname    172.17.0.1

Here is my POST request:

{
    "type": [
        {
            "target_id": "like"
        }
    ],
    "entity_id": [
        {
            "target_id": 2
        }
    ],
    "value": [
        {
            "value": 1
        }
    ],
    "value_type": [
        {
            "value": "points"
        }
    ],
    "user_id": [
        {
            "target_id": 1
        }
    ]
}


texts: How do I sort or filter a View by proximity using Search API location?

texts:
I am trying to set up a Solr Search View with Search API Solr and Search API location, witch is sorted by proximity an can be filtered by proximity.
To achieve that,

I created an search index, which indexes a geofield as latitude/longitude (under admin/config/search/search_api/index/INDEX_NAME/fields):
I created a View for the mentioned Search index and was able to add a proximity filter as contextual filter:

It is also possible to add the indexed Lat/Lon field to the field section of the View and set up a formatter showing the distance to a certain geolocation:

But there wasn't any field I could add to the sort section or the filter section of the View, that filters or sorts by proximity.
What do I have to do, to filter and sort a Search API Solr View by proximity?


texts: Why are some fields output wrapped in div and others a span?

texts:
I have been working with a View and I noticed an inconsistency in the way fields are output (unformatted list).

Most of the fields appear below their labels, but one (Post date) appears on the same line.

I looked at the source and I saw that the date was wrapped in a span and the other fields were wrapped in a div:

    Last Name:

Thacker

    Post date:
    Wednesday, April 9, 2014 - 14:39

Why is this happening?  Is it important for this to happen?  How can I change this so that everything is wrapped in a div?


texts: How do you add a FiveStar widget to a (non-node) form using hook_form_alter?


texts: Using multiple taxonomy vocabularies for views filters

texts:
I need to display nodes in a view, based on a combination of multiple taxonomy terms, in multiple vocabularies.  For example, for car sales, one vocabulary lets the visitor select one or more colors, and another selects one or more model types.

I assume I can do this by exposing filters, but how do I group them as check boxes in a sidebar instead of on top of the view?


texts:
I just noticed that bots have been taking over my Drupal website for quite a few weeks. There are over 600 pages of content. I only noticed now because the website is on hold (still available online) at the moment. I just got a message from the hosting company that the maximum disk space has been reached, which came as a total surprise.

I've tried changing password but it's still uploading. I deleted the Basic page content type because all the content was created with that content type, but now they are using a different content type, and the content is still there even though I thought it would remove all the content when I removed basic page.

How can I stop them from creating content?


texts:
I have a block that displays on term pages. I need to print the term ID in this block.

I can see the term in the url (if I turn off pathauto) is something like this: mysite.com/bslb22/taxonomy/term/3

So is there some php that can get the ID from the url? Thanks


texts: Adding constraint to existing drupal commerce order item type field

texts:
I want to add a constraint to an already existing order item type field but the field settings say "There is data for this field in the database. The field settings can no longer be changed.".
Currently the max. field length is 255 chars. I want to limit it to 100 chars and issue an error in the form if that number is exceeded. I would be happy if I could just control what's submitted through the form without necessarily changing anything in the database.
Is there a way to do this?
Thanks,
P


texts:
At the moment I'm having some struggles with the location module in Drupal, well I'm not really sure that it's the location module that is causing the problems.

The best I can explain it with a little code. There is a module which connects to a backoffice and gets venues with lat / longitudes.

I do the following:

    dpm($node->field_address[LANGUAGE_NONE][0]);
    node_save($node);
    dpm($node->field_address[LANGUAGE_NONE][0]);

Before updating the node the values are in the object

    array(6) {
      ["street"]=>
      string(16) "Street 1"
      ["city"]=>
      string(7) "Middle earth"
      ["postal_code"]=>
      string(7) "12345"
      ["latitude"]=>
      string(8) "52.000"
      ["longitude"]=>
      string(7) "4.000"
      ["location_settings"]=>
      array(1) {
        ["form"]=>
        array(1) {
          ["fields"]=>
          array(2) {
            ["latitude"]=>
            array(1) {
              ["default"]=>
              string(8) "52.000"
            }
            ["longitude"]=>
            array(1) {
              ["default"]=>
              string(7) "4.000"
            }
          }
        }
      }
    }

After saving the node the lat / long is reset to int(0).
The lat / long in the location settings is still in tact.

I've search a long time to debug this, i was thinking maybe there's a hook that resets the value, but I just can't find it. I'm fairly new to Drupal so any help will be appreciated :)

Thanks!


texts:
I have a a kind of conditional field for a sign up form where the user can optionally sign up with a mobile number or an email address.

I'm trying out a custom form validate eg.

  function signup_validate($form, FormStateInterface $form_state) {
    $mobile = $form_state->getValue('field_mobile');
    $email = $form_state->getValue('field_email_address');

    if ($email[0]['value'] != '' || $mobile[0]['value'] != '') {
      $form_state->clearErrors();
    }
  }

Now clearErrors();  obviously clears all errors for the form even if other fields are invalid, I want to know how to clear the error only for field_mobile or field_email_address


texts: How to Add "Add to cart" Button in product categories display

texts:
I display my products through the category menu, so that when you click it, it shows the list of all the items in that category, ie:
http://website/product-category/pasta

I want to have an "add to cart" button below the image and descriptions of every single items.

How can i do that?

thank you.


texts:
I am unable to debug this because when I print the display object I get a memory error from the size.
so with something like this I can get the display title.

function mailnow_views_pre_render(\Drupal\views\ViewExecutable $view) {
  $displayObj = $view->getDisplay();
  $displayName = $displayObj->display['display_title'];
}

I can get the machine name with $view->current_display == 'companies_page'

But I want to be able to get the display type for instance "Block" or "Page"


texts: How to make a required / not required one field depending on value of second field (Drupal in registration form)

texts:
Below is an example of code that makes the first field not required in the form

<?php
    function мой_модуль_form_alter(&$form, &$form_state, $form_id){
    $form['field_website']['und'][0]['#required'] = FALSE;
    }
?>

$form['test']['und'][0]['value']=test;

But I need to check the content in the second field after sending the form, and if it coincides with the value of "test", then the first field became not required.

if($form['test']['und'][0]['value']=='test'){
    $form['field_website']['und'][0]['#required'] = FALSE;
}


texts: Best practice for caching CSS libraries?

texts:
Adding stylesheets (CSS) and JavaScript (JS) to a Drupal 8 theme it says:

  Some libraries you load may not be needed on all pages. For faster performance don't load libraries where they are not being used.

At the same time, if you have many different files to load for each page, this will slow down the speed for each page load.

How big should the library be before you should consider to load it in a separate library?

How does the database caching system work? Will each library be cached in a separate CSS file? If I have page X and Y where i only need some CSS library on page Y, will both of them share CSS file A and then the other also have CSS file B? Or will these pages have only 2 different CSS files?


texts: How to apply header and footer or layout to all pages in a panel enabled website?

texts:
I have decided to use the Panels module and the Precision theme to implement my website. I have designed a front page (using a Panel page) and it has a nice header and footer.

I have also created a user for testing purposes, but when I click on the link in the email to reset the password, I get something like this:

I have some editors (i.e., with a specific user profile) who must be able to create node instances (i.e., tip articles), but without proper layout for standard Drupal pages, the screens are ugly and not functional.

The Precision theme does not come with much CSS and layout. How can I implement some minimum layout on all standard Drupal pages and eventually move the header and footer to those pages too? The header and footer are implemented as mini-panels.

I am still new to Drupal. What is the proper strategy here? Thanks.


texts:
I have a URL like www.example.com/test/rss.xml, and I want to import this XML automatically in Drupal 6. I created the content type as in rss.xml, but I am not able to import automatically. I tried the Feed module for this, but I am able to upload manually, not automatically, when I need it to update all the feeds from rss.xml automatically.

Does anybody have an idea about this?


texts:
I have a list which is built by consuming an API. The data that comes from response is not stored in Drupal which mean I am using views to create the list. The list is a paged one which shows 10 items at every page. How can cache each page of the list?

What I am thinking of is setting the cache name with a variable of the page.

\Drupal::cache()->set('cache_demo_page_'.$page, $posts, CacheBackendInterface::CACHE_PERMANENT);

This will lead to a lot of cache entries as there will be 100s of such pages in many lists across the site.

What should be the best way to do this?


texts:
Currently, my sessions table is 1.6gb with 3,956,161 total rows. I think the sessions does not expired. I have a default settings in my settings.php as follows:

ini_set('arg_separator.output',     '&amp;');
ini_set('magic_quotes_runtime',     0);
ini_set('magic_quotes_sybase',      0);
ini_set('session.cache_expire',     200000);
ini_set('session.cache_limiter',    'none');
ini_set('session.cookie_lifetime',  2000000);
ini_set('session.gc_maxlifetime',   200000);
ini_set('session.save_handler',     'user');
ini_set('session.use_only_cookies', 1);
ini_set('session.use_trans_sid',    0);
ini_set('url_rewriter.tags',        '');

is the variable above related to sessions table? If yes, what is the recommended settings to expire the session after 2 days?

Update:

I just found that this is due to OS limitation of ubuntu which I am currently using. This was explain at this drupal module: https://drupal.org/project/session_expire

The problem is, Session Expire module is still in alpha release.

Is there any other module that can do this same?


texts: How to add css files based on breakpoint in library?

texts:
We have the following mytheme.breakpoints.yml file and a simple library mylibrary that is added through our mytheme. Within the mylibrary there are two libraries, one that is optimized for desktop small and another for mobile breakpoints.

How would I add the mobile css file only for when the browser's breakpoint is less than 756px, but load desktop small breakpoint when browser's breakpoint is greater than 756px?

mytheme.breakpoints.yml

mytheme.mobile
  label: mobile
  mediaQuery: 'all and (max-width: 756px)'
  weight: 1
  multipliers:
    - 1x
mytheme.desktopSmall
  label: desktop small
  mediaQuery: 'all and (min-width: 756px)'
  weight: 1
  multipliers:
    - 1x

mytheme.libraries.yml

mylibrary:
  version: 1.0
  css:
    theme:
      css/some/path/desktop-small.min.css: { /* load only for min width > 756px*/ }
      css/some/path/mobile.min.css: { /* load only for max width < 756px*/ }

Adding Use Theme Breakpoints as Media Queries for Theme CSS Libraries for reference.


texts: Update form attributes with javascript and get them on submit

texts:
Hi i have a textfield form with attribute of "data-updated" the default is 0
If user clicks on textfield and fill it, "data-updated" changes to 1 with jQuery.
On form submit the attribute remains 0 even if it changed to 1, how can i fix it?

Here is the code:

    $form['name'] = array(
        '#title' => t('Name'),
        '#type' => 'textfield',
        '#attributes' => array('data-updated' => 0, 'onclick' => array('jQuery(this).attr("data-updated", 1);')),
    );

And here is the submit

print_r($form_state['complete form']['name']['#attributes']['data-updated']);
die();

I always get 0 even if the jQuery update the attribute to 1 :/


texts: Allow access for anonymous to custom user view mode

texts:
I made a custom view mode with display suite for the user entity. It is called "user_teaser" and shows some fields that may be visible for Anonomous user. Unfortunately currently anonymous users cannot see it because of the general "View user profiles" permission which they have no access to.

Which hook should I use to bypass this permission and allow anonymous to see my custom view mode?

I tried hook_entity_view_alter() as below, but this is called already too late I think as it is not even called when the access to the user profile is blocked.

function MODULE_entity_view_alter(&$build, $type) {
  if ($build['#view_mode'] == 'user_teaser') {
    $build['#access'] = TRUE;
    $build['user_image']['#access'] = TRUE;
  }
}

So I would need a hook_entity_access_alter or hook_user_access_alter or a hook_entity_access_query_alter, but they don't exist.

(edit) I found now some lead that might have a solution: How to change access callback of user entity when entity module is installed? (how to make sure my alteration is the last)


texts:
I'm using rules module in my site (drupal 7), i want to create a small form to the user to change his password without going to (account editing page).

This form contain 3 textbox (old passowrd, new password, confirm new password).

Can i make this form using rules?
or is there another module can help me with that?
Thanks a lot.


texts:
I have checkout function which uses drupal_goto to redirect to the confirmation page after validating all info. I want to redirect to the confirmation page before all validation. Then in the background I need it to complete all validation and email me any errors.

Problem is, drupal_goto calls drupal_exit so all further code stops running. I can implement my own goto function without the exit but then it won't redirect until all validation is completed. I need validation to run in the background after the redirect.


texts:
I'm working on my first Drupal site.

Using FileViewer I can load a PDF saved in a field, for viewing of various types. I haven't found something that does the same for Word Docs, Excel, etc.

Does anyone know of something that works in Drupal 7 to load documents other than PDF like FileViewer does inside a browser? Or like Scribd does (Scribd is hosted. I am behind a firewall with limited access for users. So I don't want to use a Scribd like service.)


texts: Drupal 7 inserting space before inline HTML tags upon rendering

texts:
Whenever I try to use , , , or  tags (or probably any other inline tag), Drupal inserts a space before the HTML tag. This does not happen within the node but rather upon the HTML rendering.

For instance:

2342 in the body field

is rendered as

234 2 on the page

Any idea why this would be or what I can do to eliminate the space that is being added? I have TinyMCE installed on the site, but (long story) it is disabled so that I input everything in raw HTML.


texts: Commerce Kickstart and product variations

texts:
I am relatively new to Drupal and I am trying to build an eShop with Drupal Commerce Kickstart.

One of the good features is the ability to have product variations and attributes in variation type which affect the price of the product.

Unfortunately, I have not managed to make it work correctly.

My main issue is that the "All Products" page show only main products and not the variations and that on this page the facets of the attributes that are in variation type are not show-up. They work only the facets that are for the attributes of the content type of the product.

If I do not find a solution soon, I will forced to give up these two very powerful features of Drupal Commerce and simply have products without variations.

How can I achieve what I want?


texts: Retrive specific deleted nodes and re-import

texts:
Some nodes (from two different CTs) have been deleted accidentally and there is no way to restore them.

The question: is it possible to retrieve and import these very specific deleted nodes from our backups without making a full database restore, and having the reassembled nodes back to the UI, is there any method/technique that will work ?

One of our CTs consists of many many fields (~80) of any possible type image, link, entity/taxonomy reference, integer, text, file and Boolean.

I have already looked at the Node export but it depends on the uuid module and I don't have that installed.


texts:
How does one get a patch tested in core and attached to an issue queue (with the pretty red or green styling)?

Is it automatically done when you attach a patch? Or do you have to have an account to the qa.drupal.org server?


texts: Safe way to login a user programmatically

texts:
I know that with the following code we can login a user programmatically.

$username = "someuser";
$password = "somepass";
$uid = user_authenticate($username, $password);
if ($uid) {
 $form_state = array();
 $form_state['uid'] = $uid;
 user_login_submit(array(), $form_state);
}

But is it not a security risk to store the username and password in variables like above?

Is it the safe way or is there any other method for username and password to get?


texts: How to add a dynamic cart link to the user menu?

texts:
Commerce already defines two menu items in the Navigation menu:

Shopping cart - 'cart' - enabled by default, static
Shopping cart - 'cart/my' - disabled by default, dynamic

'cart/my' uses a custom title callback, 'commerce_cart_menu_item_title' that builds a dynamic menu link in the form: Shopping cart (2 items)

If I want to add a new menu item for the shopping cart to the User Menu, what's the proper way to do this? Do I first need to duplicate a menu item, then override the duplicate?

Ideally, I would be able to set my own title callback so that I can optionally build a dynamic menu in any format I choose.


texts: How to show a view inside another view on only first row?

texts:
I need to display a view inside another view and I'm using Views field views module, It works well, but I need the field (view) only appears in the first row result of the view page, like the following.

View page - results

Title node 1
Image node 1
View field 1 (this should appear only here)
Title node 2
Image-node 2


texts: Implement Twig format in view exposed filter

texts:
I have search view UI with two filter criteria.

Basically, to output contents in the page we write {{ page.content }}, which I currently used.

What I want is to slice the page.content in divs. Search filter will be displayed in, say

 and its result will be on

.

I found this: Twig Field Value, but confused how to implement it the right way.

In the image below, they are in called in {{ page.content }}, so I want to separate the search filter and its result.

Anyone knows how to properly write search UI and its specific fields(as an output) with twig format?


texts: Followed the How can I link an image of a jCarousel to a certain link? page but need further help

texts:
I followed the instructions on linking hyperlinks in jcarousel found here:
How can I link an image of a jCarousel to a certain link?

The problem is that I don't have the Formatter drop down field in my view.

Attached is a screenshot of what I see.

These are the choice I have when adding a link to the view. It appears to be the same link as what is in the original instruction: