texts: How to pass different parameters to the same form function based on different urls

texts:
I have a custom model containing two paths. Each path goes to the same function. I wanna to send to each page arguments specific parameter and reception on the function then pass the hidden value to submit function.

  $items['parkingcalculator_normal'] = array(
    'title' => t('Parking calculator'),
    'description' => 'Parking Calculator Page',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('parkingcalulator_form',0),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
  $items['parkingcalculator_valet'] = array(
    'title' => t('Parking calculator'),
    'description' => 'Parking Calculator Page',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('parkingcalulator_form',0 ),
    'access callback' => TRUE,
  );
function parkingcalulator_form($form, &$form_state , $type){...}

but the function does not take the parameter and does not pass the value in the hidden form type to

function parkingcalulator_form_submit($form, &$form_state ,$type)


texts: How do you add validation (constraints?) on a paragraph? Compare two fields

texts:
How does one go about adding validation (contraints?) on a paragraph?

I need to compare two entity reference fields on submission. If one field has a certain entity referenced, the other cannot have certain entity references.

I'd be interested in restricting the autocomplete options as well, but that simply won't be enough as I need to ensure that they user doesn't manually enter another entity value.


texts:
function test_menu()
{

    $items['test'] = array(
    'page callback' => 'test_test',
    'title' => 'test',
    'menu_name' => 'navigation',
    'type' => MENU_NORMAL_ITEM,
    'access callback' => true
    );

    return $items;
}

function test_test()
{
    echo 555;
}

when I access to url /test, i see '555', but how to render the layout itself and in the content of the page show '555'?


texts: how to get information about discounts on product?

texts:
Short: I have commerce product and commerce discount that affects this product's price. I want to presents details of this discount to users in shop.

Long story: I use Drupal Commerce with Drupal Commerce Discount which is based on Rules. Discount module is used for configuring promotions on products. Some of promotion (configured discounts) are time-limited ie. they ends on 11.11.2015.
I would like to get information about discounts that affect product when displaying details. First of all I need to display information how much time is left before discount ends.

Is there any way to get information about active rules on product level?


texts:
I'm using Conditional Rules module, there some conditions inside the loop I need to break out of. However, there's no action in rules for stopping/terminating the loop.

I tried a custom rules where I tried the following but it does not work:

function my_module_break_rules_loop() {
  return FALSE;
}
function my_module_break_rules_loop() {
  return 0;
}
function my_module_break_rules_loop() {
  break;
}

The break works but display with this error message:

  PHP Fatal error:  Cannot break/continue 1 level in

Any one know how to stop/terminate the loop?


texts: Drush on Acquia Dev Desktop is terribly slow

texts:
I'm running version 2, built Jan 9 2020, on a Windows 10 machine. I'm opening the command line via the dev desktop interface (via the small, black command line icon), and all drush commands run terribly slow. A drush cr can take 1-2 minutes, drush uli the same. Even a simple drush status drags.

I've learned that another colleague has the same issue, but still others don't, so I wonder if something isn't installed correctly. I also have lando installed but not running.

What do I have to do to troubleshoot or solve this?


texts: What determines who can view an unpublished node?

texts:
The Node Access documentation explains that there are three things that affect node permissions, used in this order of preference until an answer is received: an overriding bypass node access permission; hook_node_access (used on single nodes and not in listings); hook_node_grants (which compares against the node_access table).

What I can't see is how (un)published content is handled. The only default implementation of hook_node_access is node_node_access which you can see completely ignores the 'view' mode, answering only for create/delete/edit modes.

The hook_node_grants docs say explicitly that (un)published content is "not handled by the system".

But there are the checkboxes in the user permissions table for view published content and view own unpublished content etc. Where are these implemented?


texts: How to save single value from a select field?

texts:
I have webform module with multiselect field (Checkbox) User can select all the three.

  PR|Print Required
  DP|Digital Print Required
  TP|Print has been taken

If user selects the last option then, only that option must be saved after submitting even if the other options are selected. If other two options are selected then as usual those options should be saved.

In General,
If the user selects the first two options, it should accept the first two options. If user selects third option, then it should save the third option not other two options(If user selects). Example: If user selects all three options, then it should save only the last option.If user selects the last option i.e., Print has been taken, then it should save that irrespective of other selections.


texts:
anonymous user add's product or things into cart but when clicking view the cart is empty.
when we check cart directly its has selected value.
but order does not show when going back to catalog

how can i fix this??


texts:
On my d8 site I have AdvAgg CSS/JS Validator, AdvAgg Minify CSS, AdvAgg Minify JavaScript, AdvAgg Modifier and Advanced CSS/JS Aggregation enabled.

I have standard settings used in the AdvAgg config. For JS specifically, I am using JSmin + and delivering gzip'd assets.

Under admin/config/development/performance, if Aggregate JavaScript files is unchecked, my JS files are delivered from the js/optimized/ folder and JS runs correctly. When I check Aggregate JavaScript files on, assets are now placed from /js/ and javascript is broken.

Further, when I paste the optimized file name in admin/config/development/performance/advagg/info, for e.g.: js_nrTZ3IQttmDSsRueLl0pyxRvunHefp0r1WyIh5cFezg.js AdvAgg cannot find the file (but it can when aggregation is turned off).

Perhaps this all makes sense since aggregating JS files is a Drupal feature, but I've been down every related question/comment thread on google (changing .htaccess, adding tmp folders, changing folder permissions etc) and cannot find a fix for: AdvAgg is on with standard config, Aggregating JS files is on and javascript is broken. There are no obvious errors in the javascript console or drupal error log either.

EDIT

Here is what the file paths look like with aggregation on:
<script src="/sites/energyforum/files/js/js_tvBcOK6c8zbgb2_h2fxvH7fqhBBhGUnfOtQvWyXg1AM.js"></script>

The files are actually there, e.g.:

Here is what they look like with aggregation turned off

<script src="/sites/energyforum/files/js/optimized/js_dxIVcwvQ00owLGoUGPTfRYXU-T5rnj8Xi0cXfb3Kn58.0EvW5goc0mi1CLAZ226j56yYkdNjFXiaCYoOaoBMbKg.js?v=3.2.1"></script>

And, of course, there are many more of them (and javascript works)


texts: Display a representation of a Word Doc in the browser

texts:
Or, how could I embed JPG/PNG representation of Word Doc's first page in the browser window?

I've a client who requested to display an uploaded Word Docs (form a File Field) to the browser. Might there be a way to create an PDF or JPG of the first page of a word document to stand in it's place?

Or, might there be a module or recipe that has covered this type of request?

Background: The Word Docs are internally created and not uploaded from the general user base. So I'm not worried about content from hundreds of users. It's internal documents that are available for download anyways. They would just like a visual cue to help users more quickly find what's needed.

Update: As suggested from a comment, I'm expanding my search Stack Overflow. I'll update as I stumble upon any potential answers.

Using Unoconv - this may work but I don't want the overhead of running a full office suite on a web server.

Though I'm still holding out for a community based solution.


texts:
So I am running this Drupal 7 website, I just checked users list and got surprised with this:

As you can see the usernames are spam and their emails are also spam. But I do not get it how they did that and even get themselves an admin role. Also log shows they even enabled the php filter module. Also the registrations are disabled so how? Even if the users where registered via site register form it would show its 1 week old or so, not the 44 years.

I don't get it. What should I do? Also I have User Protect module installed.


texts: Try to theme a specific page using template.php and a sub theme

texts:
I have a theme called 'progressive'. It has a sub theme called 'progressive_sub'.

I'm trying to exclude items from being displayed from a particular page in D7 (latest as of 12.2.15).

I have the following useful files:

/sites/all/themes/progressive/progressive_sub/template.php

This contains:

<?php

/**
 * Implements hook_preprocess_page().
 */
function progressive_sub_preprocess_page(&$variables) {
  $path = request_path();

  if ($path = 'node/131') {
    unset($variables['page']['header']);
    unset($variables['page']['sidebar']);
    unset($variables['page']['footer']);
    unset($variables['page']['bottom']);
    unset($variables['page']['top']);
    unset($variables['page']['content_top']);
    unset($variables['page']['sidebar']);
    unset($variables['page']['bottom']);
    unset($variables['page']['footer']);
    $variables['theme_hook_suggestions'][] = 'page';
  }
}

You can see that I'm trying to remove a heap of regions from this page (page.tpl.php) template, in this case when /node/131 is called.

I also have:

/sites/all/themes/progressive/progressive_sub/templates/page.tpl.php

which has all the usual including:

<?php print render($page['content']); ?>

My problem is that I cannot get this page.tpl.php to load when I'm viewing /node/131

Is there something that I'm doing wrong?


texts: Debugging what has been submitted in a form

texts: I would like to like to be able to print out what has been submitted in my form in the submission form. How can I achieve this?


texts: Select fields in multiple tables / change output value / compare fields

texts:
i want compare (=) two fields in two tables. In the first field, i have only a nid (e.g. 55) and in the second field, the value is formatted with "node/%" (e.g. node/55).

How can I created the join query for compare these two fields ?

I have tested this with this code without success :

$uid = arg(1);
$query = db_select('field_data_field_users', 'alias1');
$query
    ->condition('user_id', $uid, '=')
    //->addExpression('node/(fdfur.entity_id)', 'alias2'); // > not functionnal
$query->join('menu_links', 'ml', 'ml.link_path = alias1.entity_id');
// ml.link_path = alias1.entity_id > node/55 = 55 > no match...
$query
    ->fields('alias1', array('entity_id'))
    ->fields('ml' , array('language'))
    ->fields('ml' , array('link_path'))
$results = $query->execute();

Here an image that explains my problem

I start from the user id and I want to get the datas of the menu links. The first db_select in the custom table is ok, i get the related nids with the user ids, but I can't to get the datas of the menu link.

Have you any idea to resolve my problem ?

Thanks for your help.


texts: Recursive Drush make, working with different git branches

texts:
Setup

For every site we make a custom Drupal install profile is created, copies of which are built using drush make (through Aegir, though that should not make a difference).

There is a top-level build makefile for downloading Drupal core and our install profile, and the install profile contains a makefile specifying Features to download, each of which have a makefile specifying their dependencies (either custom modules in private git repos or contrib modules).

The build makefile (build-SITENAME.make) specifies the install profile like this:

projects[SITENAME_profile][type] = profile
projects[SITENAME_profile][download][type] = git
projects[SITENAME_profile][download][url] = git.hostname:drupal-sites/SITENAME_profile

Then the install profile's makefile will specify a bunch of Features to download, for example:

projects[blog][type] = module
projects[blog][subdir] = features
projects[blog][download][type] = git
projects[blog][download][url] = git.hostname:drupal-features/blog

Which will then download custom and contrib modules and so on.

The above setup has worked well for a couple of years.

Problem

The problem occurs when trying to use git branches for managing different stages of development, e.g. development, staging and production; and having CI automatically manage Drupal sites for each branch. If a build is triggered for the development branch, drush make has to get the correct branch for every one of our repos it downloads.

Given our multi-repo and recursive makefile structure, how would drush make be used to recursively download the correct branch from our git repos?

Things already tried

drush make allows downloading from a git branch, which seemed good
for our use-case. For example, for each makefile (in the build,
install profile and Features repositories) a line is added that
looks like:

projects[blog][download][branch] = development

When the branch of the repo being downloaded matches the branch of the
repo the makefile is in, custom modules specified in the
development branch of the 'blog' Feature will be downloaded from
that module's development branch. Great!

However, this causes problems merging the branches of any repo containing a makefile (given our setup that's quite a lot), we will have to be extremely careful not to accidentally merge [branch] = development into master on any of them.
Checked drush make documentation for a command-line option to specify the default branch for git repository downloads. Found nothing.
Searched the Internet for people with similar quandaries, it seems many are dumping all the dependencies for whole projects into single make files, but that breaks the modularity of Features.

Note: I'm not polling or asking for discussion. I believe there's something silly I'm missing and/or something everyone else is doing that I'm not.


texts: Kernel test fails with 'Error: Call to undefined function drupal_valid_test_ua()'

texts:
My kernel tests are failing with:
Error: Call to undefined function drupal_valid_test_ua()

/Users/joachim/Sites/drupal-core-composer/repos/drupal/core/tests/Drupal/KernelTests/KernelTestBase.php:273

I'm running from the repo root with:
vendor/bin/phpunit web/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php

and phpunit.xml is configured with:
<phpunit bootstrap="web/core/tests/bootstrap.php" colors="true"

This is a configuration that normally works on D8, but here I'm on D9, and I'm symlinking the core repo in as a Composer file repo.


texts: Passing path arguments to a form builder

texts:
I'm trying to understand how to port the following D7 code to Drupal 8.

function x_menu() {
    $menu['x/form/test/%/%'] = [
        'page callback' => 'drupal_get_form',
        'page arguments' => ['x_form_test', 3, 4],
        'type' => MENU_CALLBACK,
        'title' => 'Test Form',
    ];
    return $menu;
}

function x_form_test(&$form, $form_state, $arg1, $arg2) {
    return $form;
}

From what I can glean from the documentation of the Routing and Form API, the new way to connect a path to a form is to put this in x.routing.yml:

x.form_test:
    path: 'x/form/{arg1}/{arg2}',
    defaults:
        _form: '\Drupal\x\XFormTest'
        _title: 'Test Form'

and then create a form class XFormTest that ultimately descends from FormBase.

However, it's clearly impossible* to add extra arguments to an inherited function signature like public FormInterface::buildForm(array $form, FormStateInterface $form_state)

How can I read $arg1 and $arg2 in XFormTest::buildForm(), preferably while still pointing the route at the form rather than putting a Controller around it?

(Routing API: https://www.drupal.org/node/2092643)

*Update: Maybe it's not so much impossible as that I'm not doing it correctly.

My function declaration

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

class XBBCodeHandlerForm extends FormBase {
  public function buildForm(array $form, FormStateInterface &$form_state, $format = XBBCODE_GLOBAL) {
  }
}

generates the following fatal error:

PHP Fatal error:  Declaration of Drupal\xbbcode\Form\XBBCodeHandlerForm::buildForm()
must be compatible with
Drupal\Core\Form\FormInterface::buildForm(array $form,
Drupal\Core\Form\FormStateInterface $form_state)
 in /home/arancaytar/software/web/drupal/modules/xbbcode/src/Form/XBBCodeHandlerForm.php
on line 161

Edit: I misunderstood the fatal error; it wasn't caused by the extra argument but by changing the value argument $form_state to a reference argument. PHP does allow adding optional arguments to overriding functions, apparently.


texts: Drupal 8 - taxonomy term field without "title" attribute

texts:
I have a simple view block with exposed the taxonomy term linked to the taxonomy page, but I have noticed that the attribute is missing, I tried to rewrite the term but every attempt went wrong.

What I need is simple, this is the view generated field:

Events

I want to add title="Events", like this:

Events

But I can't find any solutions in Drupal 8 view!


texts: Create relation N:N and specify properties for each relation

texts:
I have two content types: "Car" and "Options".
My cars can have different options, so I could associate options to a car with References Module. But my problem is I'd like to specify the price of the option for each car/each relation.

Example:

Seat    - Airbag - 100 €
Citroen - Airbag - 88 €

The relation is not only a node reference, it has "metadatas".

For the moment, I plan to develop my own module, maybe "Relations" module will be the solution, but I tried it with no success.

How can I solve this problem?


texts: What are the implications of changing the default language?

texts:
On the official docs about Install a language there is a warning:

  Never change the default language, otherwise things will break!

I wonder what exactly this means because there is no explanation about it.
I have searched and only found this.

I changed the default language and updated the translations about two weeks ago and haven't seen any warning or error yet but I'm still looking for some documentation since the site is going on production.


texts: What's the best way to have users edit specific section of user profile?

texts:
I plan on using Panels module and Profile2 module to organize and create profile fields.

For example left column of panels will have user picture, user name, bio field, 4 social media link fields.

I'm wondering if there's a way to have users click on the section or field and be able to edit that area rather than one long edit page.

Is QuickEdit module an option for this?


texts:
I have hook for user_search_execute and node_search_execute for both user and nodes but
 i want to merge both into mymoduel_search_execute but only node_search_execute uses index not user_search_execute like below :-

    /* node search execute */

    function node_search_execute($keys = NULL, $conditions = NULL) {
        // Build matching conditions
        $query = db_select('search_index', 'i', array('target' => 'slave'))->extend('SearchQuery')->extend('PagerDefault');
        $query->join('node', 'n', 'n.nid = i.sid');
        $query
            ->condition('n.status', 1)
            ->addTag('node_access')
            ->searchExpression($keys, 'node');

        // Insert special keywords.
        $query->setOption('type', 'n.type');
        $query->setOption('language', 'n.language');
        if ($query->setOption('term', 'ti.tid')) {
            $query->join('taxonomy_index', 'ti', 'n.nid = ti.nid');
        }
        // Only continue if the first pass query matches.
        if (!$query->executeFirstPass()) {
            return array();
        }

        // Add the ranking expressions.
        _node_rankings($query);

        // Load results.
        $find = $query
            ->limit(10)
            ->execute();
        $results = array();
        foreach ($find as $item) {
            // Render the node.
            $node = node_load($item->sid);
            $build = node_view($node, 'search_result');
            unset($build['#theme']);
            $node->rendered = drupal_render($build);

            // Fetch comments for snippet.
            $node->rendered .= ' ' . module_invoke('comment', 'node_update_index', $node);

            $extra = module_invoke_all('node_search_result', $node);

            $uri = entity_uri('node', $node);
            $results[] = array(
                'link' => url($uri['path'], array_merge($uri['options'], array('absolute' => TRUE))),
                'type' => check_plain(node_type_get_name($node)),
                'title' => $node->title,
                'user' => theme('username', array('account' => $node)),
                'date' => $node->changed,
                'node' => $node,
                'extra' => $extra,
                'score' => $item->calculated_score,
                'snippet' => search_excerpt($keys, $node->rendered),
                'language' => entity_language('node', $node),
            );
        }
        return $results;
    }

i want to combine both queries into one even search url anything else.

please help..


texts: How do I install a 3rd party PHP library in sites/all/libraries - can I just plonk it in there?

texts:
For example, according to the Drupal module s3fs, I can -- to quote their README.txt :-

  2b) If you don't have drush, go to to
  http://aws.amazon.com/sdk-for-php and click the orange "AWS SDK for
  PHP" button. On the page you're sent to, click the "aws.zip" link.
  Extract that zip file into your Drupal site's
  sites/all/libraries/awssdk2 folder such that the path to
  aws-autoloader.php is sites/all/libraries/awssdk2/aws-autoloader.php

So, yeah, that's effectively: downloading the library, and plonking it sites/all/libraries and that's it. But it doesn't work! I get:

  Unable to load the AWS SDK. Please ensure that the awssdk2 library is
  installed correctly.

I've tried everything else in the README.txt : drush installer, specific version of AWS SDK, permissions...


texts: How do I hide a table column in a view depending on role?

texts:
I have created a View that outputs a table with an edit column (that has a link to edit the item for that row). When you hare logged in as an administrator, you see the column and the edit links as I would like. However, when viewing the table as an anonymous user, the edit column still appears even though the edit links are not being displayed. I would like the entire edit column to be hidden from all users who do not have the role to view them.

I thought I might be able to hide the column if I set the table settings to hide column if there is no output, but that didn't work. I suspect it didn't work because there was output, but its display is being suppressed by the users role. Can someone confirm if that is how it is supposed to work (it may be a bad assumption on my part)?

I have tried Googling for a solution to this, but I can't find any solution that applies to Drupal 8 (only Drupal 6 and 7).

Thanks.


texts: Meta Tag are not display on some of pages

texts:
I adding meta tag on my site, but some of page showing page title as a Meta title,  I want to change it with other name.
But I don't know why it is not showing/Working on some of pages .

I observed that some page that connect with View those pages are only fail to add Meta tag.

Anyone know what is issue. Why I'm fail to add meta tag.


texts: Customizable combo select multiple and autocomplete

texts:
My client wants an input element for a custom form to behave like this:

Dropdown checkbox multiple
Autosuggest field

So if we have a list of countries (Spain, UK, USA), it can display all the elements, and allows to select several of them. And if it is a long list of countries, you could search by entering the few letters, and only those items which match the entered letters would appear.

As for the first behaviour, I have found the following module "Dropdwon checkboxes". As for the second one, I haven't found any module so far, but in the wild there is this example (see example: Filtering mode: (filter existing list) ).

Any idea on how could I get the result? Maybe injecting some custom Javascript (jQuery) code into the multiple checkbox customized with the first module, to add the autocomplete capabilities?


texts: Creating entity fields based on the fields from another entity

texts:
I've been trying to create a data structure that resembles something like:

            +-----------+-----------+-----------+
            | Service 1 | Service 2 | Service x |
            +-----------+-----------+-----------+
            |  Price 1  |  Price 2  |  Price x  |
+-----------+-----------+-----------+-----------+---------------+
| Feature 1 |    Yes    |    Yes    |    Yes    | Description 1 |
+-----------+-----------+-----------+-----------+---------------+
| Feature 2 |     1     |     6     |    20     | Description 2 |
+-----------+-----------+-----------+-----------+---------------+
| Feature x |    No     |    No     |    Yes    | Description x |
+-----------+-----------+-----------+-----------+---------------+

I've created a content entity Services, which has the following fields:

Service Name
Price
Feature 1
Feature 2
Feature x

This works great, until I realise that I'm not including the descriptions of each feature.

Drawing on my knowledge of database normalisation, I intend to extrapolate the description and feature to its own content entity, Services Info. I think that would probably work just fine, with one small exception, I now need to maintain the list of features in two entities, something I'm loathed to do.

Is there any way I can get Drupal to synchronise the fields across two tables? So that if/when I add more features to the Services entity, it'll appear in the Services Info entity, waiting for me to input a description for it?

Or, if there's a better, more Drupally way to approach this problem, then please feel free to chime in!

UPDATE:

I realise that my question might not be clear enough, so I thought I'd explain what I'd do if I weren't using Drupal to make this...

I'd have the following SQL tables:

tbl_services:

SERVICE NAME (FK)
FEATURE NAME (FK)
SERVICE FEATURE VALUE

tbl_services_info:

SERVICE NAME (PK)
PRICE

tbl_services_features:

FEATURE NAME (PK)
FEATURE DESCRIPTION
FEATURE RECOMMENDED

... Now I'm looking at it, I guess I'm missing an entity..? Which if I introduced I could have them reference each other correctly?

If I were to implement it this way I'd also have the issue of not being able to REQUIRE that ALL SERVICE NAMEs have ALL SERVICE FEATURE VALUEs declared for ALL FEATURE NAMEs... Could I? Or would I just have to create a custom input form for the entities?


texts: menu_navigation_links() generate a error

texts:
I'm try listing a menu navigation links with menu_navigation_links() function, but is generate a follow error:

  Notice: Undefined index: localized_options in menu_navigation_links() (line 1860 of /home3/xptoboxc/public_html/drupal/includes/menu.inc).

My code:

$html .='
';
foreach (menu_navigation_links('navigation') as $menu => $link) {
    if(!empty($link['title']))
        $html .= '
' . $link['title'] . '
';
}
$html .= '
';


texts:
I've got a question regarding drupal/core and drupal/core-recommended. So drupal/core-recommended uses fixed versions of the packages, which the corresponding core version was tested with. And yes it does make sense that this prevents bugs introduced by version differences of let's say different versions of symfony packages for example.
But on the other hand, let's say you install a dev version of a modul or any other third party library with composer, which explicitly needs a different version of a symfony component than drupal/core-recommended, these locked versions of the core dependencies will cause trouble, as the third party library/the module could not get installed due to version conflicts.
So how would one deal with this kind of situation when using drupal/core-recommended?


texts:
I am using D 7.28 with Boostrap theme (https://www.drupal.org/project/bootstrap).
I am using the theme's 'Main menu' to display my links. The language switcher works well for me (changing homepage, Hero banner block and navigation into the appropriate language).

I would like to move the language switcher to the 'Main menu' and display it as an item only showing the inactive language.

Could anyone please provide instructions how to do it?


texts: Statuses (Social Microblog) module integration with organic group?

texts: Looking for an integration with Statuses (Social Microblog) module and Organic Group module. Please share some keys if any one experience with it.


texts: Mobile browser to be assigned different background

texts:
I'm trying to get my site to operate differently depending on if the browser is a phone or a computer etc... I understand that this is most likely done using the sites.php file but I've been unable to get this working, and have an open question on SO about it.

Broad Question

This question is a little more specific and is to tied me over while I battle the broader issue out. I would like to remove the current background image when a mobile browser turns up. I thought something like the following would do it (same CSS file)

body {
 background-color:blue;
}

@mobile {
 body {
 background-color:green;
 }
}

but this doesn't appear to make any difference when using my HTC desire using Dolphin.


texts:
How can we categorize things on our site without using taxonomy. I have learned Taxonomy but want to know how to categorize things without Taxonomy.
Can anyone help me Please.


texts: How can I use tokens for Addressfield values without using Addressfield_tokens?

texts:
I would like to use the Town/ City field as a token for Pathauto. I thought the Addressfield_tokens module was perfect for this, but Entity Tokens breaks Pathauto's patterns control panel; the issue seems to be common and unresolved.

I'm wondering what other options I might have for extracting the Town/ City value from Addressfield and using it as a token in a Pathauto pattern?


texts: How to use Views PHP to rewrite results of a field?

texts:
I am using Views PHP  to rewrite fields in Views.
I can access all variables BUT those that have a build mode. In my case, I have Content: Node field (which can be build according to any display), which should is accessible using the variable $row->nodefield. However, the content of that variable is always empty. I have tried with other variables, and every field with a build mode will not be rendered in Views PHP .

Is this a design issue or am I missing something?

I'm using Drupal 7 and Views 3

EDIT

Using dpm() on available values return the following:

dpm($row)

dpm($data)


texts:
I have an open layers view that displays the numbers of reports for each country.

Can i display it other way for instance with dynamic circles markups :
3 reports : small circles , 50 reports : medium circles etc ...

example:
http://reliefweb.int/


texts: Display a field only when dependee image field has more than three images

texts:
I have a content type "Product", and on its view node, I want to display a field(which is a select list), only when my other field, which is dependee for this field and is an image field, contains more than three images.

Any suggestion will be appreciated.


texts:
In older versions of Webform (Drupal 7), the function webform_component_insert() can be used to add fields to a webform, for example inside a hook_node_insert() implementation, so they are added when the webform is created.
Does anyone know how to do that in Webform 6.x? I would like to add fields to webforms automatically after they are created.


texts: Drupal 6 Views "No result behaviour" use a view

texts:
With the Views module for Drupal 7 you can set a "No result behaviour" that uses another View rather than just text. I can't see the same functionality in Views 2 for Drupal 6. Is it possible to extend Views to do this?

The motivation for this is that we have a home page driven by a View that displays the recent contents from a user's groups; if the user hasn't joined any groups yet then we want to display a different View using content from all groups.


texts: field_get_items gives me an array of node IDs. Can I filter these by type without using node_load()?

texts:
I have an entity reference user field for more than one content type. I need to filter the node IDs by content type without using node_load(). Is it possible?

If not, how badly would it affect performance to send the user ID to a view and filter them there?


texts: Difference between a bundle and a content type

texts: Can somebody explain to me the difference between a content type and a bundle? Is the latter just a bundle for the entity node?


texts: Replace integer field value with stars in twig template

texts:
I have a Drupal 8 site with a node type exposing a "difficulty level" field which is an integer choosen from a list (1 to 5).
Current onsite display is : "difficulty: 3". I would like to replace the value "3" by three black stars and two white ones to picture "3/5" (done via CSS background images).

In field--field-difficulty.html.twig I have replaced item.content by:

{% for i in range(1, 5) %}
  {% if (loop.index <= item.content) %}
    *
  {% else %}

  {% endif %}
{% endfor %}

But this keep giving me five * displayed, just like if the {% if %} statement was always true.
Can someone give me a hint on this please ?


texts: How to display only content assigned to a user?

texts:
I have created a content type with a CCK field named 'executor' of 'User reference' type. So the admin can select a different user as an executor in creating content.

I want to create a page using views to display all tasks a user is assigned to as executor. But I don't know what I should put in fields and filters.


texts: How to change the HTML output of link to image file?

texts:
With Manage Display of image field, I set 'Link image to' to File.

so when user clicks the styled image, will link to original file, I want to change the html output of the link. How may I do so?


texts:
I have sql, where I need to select data for this month and data for previous month. How to do extraction od previous month data?

In my block in build() functionI have this:

//...
if ($what == "en_flip_per_month"){

    list($m, $y) = statistics_data_for_block('monthname', 'year');

    $sql = $connection->select('node_field_data', 'nfd');
    $sql->addExpression('COUNT(nfd.nid)', 'counting');
    $sql->where("nfd.langcode='en'");
    $sql->where("FROM_UNIXTIME(nfd.created, '%M' ) = ".$m."");
    $sql->where("FROM_UNIXTIME(nfd.created, '%Y' ) = ".$y."");
    $sql->groupBy('nfd.langcode');
    $sql->orderBy('nfd.created', 'DESC');
}
//....

and in my .module file I have this:

function statistics_data_for_block($m='', $y=''){
    $month = '';
    $year = '';

    //current
    if ($m == "month"){
        $month = "MONTH(CURRENT_TIMESTAMP)";
    }
    if ($m == "monthname"){
        $month = "MONTHNAME(CURRENT_TIMESTAMP)";
    }

    if ($y == 'year'){
        $year = "YEAR(CURRENT_TIMESTAMP)";
    }

    //... SOMETHING FOR PREVIOUS MONTH ...

    return array($month, $year);
}

So, I need a way to extract MONTH, MONTHNAME and YEAR of (CURRENT_TIMESTAMP - 1 month).

There was this one solution - use of SET and DECLARE, but how can it be done in Drupal 8 dynamic query?

Thanks


texts: How to include an image in the user registration using the module Services

texts:
As the scheme would be to post a picture in the picture user or field in another field custom image. I tested with the following scheme and get nothing. The other fields in the record, user, password, custom text fields do not have any problem, but the images do not get anything. This is the Json object built for the image:

www.xxxx.com/endpoint_services/user/register  (Method POST)

{"name":"test"
,"mail":"test@example.com","pass" :{ "pass1" : "123456", "pass2" : "123456" },
 "field_categoria": {      "und":  { "tid": "1" } },
    "field_cif": {   "und": [  { "value": "xxxxxxx" }  ]  },
  "field_imagen_usuario":{"und": [
    { "filename": "testExample.jpg",
    "filepath": "public://testExample.jpg",
     "filemime": "image/jpeg" ,
     "file": "/iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQ...." } ] } }

All other fields work perfectly, but the image is no way to get it to. I can do to resolve this?

(I also replaced by "target_uri" "filepath" and does not work)


texts: Is it possible to build a high-traffic Drupal community website without hacking?

texts:
I would like to find out from anyone that has built a high traffic Drupal community website ( a website with at least 500,000 visitors a month, with anywhere from 10,000 to 20,000 authenticated users at any one time ), is it is possible to create this kind of site without having to do a high level of hacking to make Drupal scale?  Can standard Drupal scale without a lot of query and other types of hacking / coding?

Can I install Drupal, configure the modules I need, and then add more hardware and functionality (APC, Varnish, Memcache, etc) without having to do query hacking?  How do people deal with Drupal's high number of database queries without hacking, or is there no way around having to hack?  If you have built this type of community site with numerous authenticated user, what were the biggest hurdles and stumbling blocks when it comes to performance and scalability?  I already know about auth cache and pressflow.


texts: Question about template_preprocess functions

texts:
i noticed there exists a template_preprocess_field function on the Drupal website, but i added in my template.php files just this...

function mytheme_preprocess_field(&$variables, $hook) {
   kpr($variables);
}

my question is, is the drupal function running too? in the system somewhere as well as my preprocess function?,

they seem to both be running. any insight would be helpful, thanks


texts: Improving UX with views exposed filters: automatically selecting certain options based on a profile value

texts:
Background

On my site, users input their birthday, from which I use a computed field to calculate their age.  Then, based on that age, I use rules to add a taxonomy term to their profile to classify  them into one of the following age groups:

20s
30s
40s
50s
60s
70+

I have a view that allows members to search other members' profiles, and on this view I have an exposed filter for the taxonomy vocabulary age group.  The exposed filter widget is converted from a dropdown box to a list of checkboxes using the Better Exposed Filters module.

What I want to do

This works well, but I want to further improve the UX by automatically checking boxes based on the user's age when he or she visits the page.  Ideally, I want to automatically check the box for the user's own age group (e.g., a user in his/her 20s will automatically have the 20s box checked, while a user in his/her 40s will have the 40s box checked).

What I tried

I have no way how to implement this smartly.  One possibility that entered my mind is creating a panel with variants for each age group and then cloning a view once per age group and then using views rewriting functionality to rewrite the query strings for all of the views to check the appropriate boxes...  but this would lead to a huge amount of duplication and be very difficult to maintain.


texts:
In the Drupal site I inherited, the Admin menu is missing both Modules and Appearance, making really hard to do anything. I've been tackling this issue periodically for months to no avail.

How can I add Modules and Appearance back to the Admin menu?


texts:
I have an installed SSD on my Ubuntu Linux machine. It's blank, partitioned, and formatted. I'd like to install my Drupal sites on it so I can work on them locally there. However, the only way I've found to install Drupal so far on Ubuntu is in the /var/www/html folder (and only 1 site there at a time at that).

Anyone have a suggestion (or a tutorial! - dare to dream) for installing multiple Drupal 7 sites on a SSD on Ubuntu Linux for local development?


texts:
I am setting up a site for a non-profit organization (using Ubercart to accept donations) and I want to change "order" to "donation".

I started in with the stringoverrides module. I was searching around trying to find all the occurrences of "Order" and putting in a string over ride that changed it to "Donation". I found this to be extremely clunky, time consuming and error prone.

I looked at the source of the string overrides module figuring that I could find how it was actually performing the override and then hack together my own solution to programmatically do some sort of search and replace on it. After looking at that and the source for the t() function I realized it wasn't going to be that easy.

Is there a way to easily pull a list of all the t() calls that include the text "order" in them? I could then pretty easily generate a .po file by doing a bunch of search and replace type operations.
Is there a way to programmatically change all occurrences of 'order' to 'donation'?
Is there some other obvious way that I haven't thought of?

P.S. I am proficient with custom module development in Drupal but don't have much experience in l10n_update or i18n with Drupal.


texts: How to best handle "sudo: no tty present and no askpass program specified"?

texts:
I have custom Drush commands that contain shell commands with 'sudo' included. This results in an error when calling with remote alias to execute on remote instance:

drush @remote-alias custom-command-with-sudo

From research in google.com, I understand there is not tty session loaded when doing ssh user@ssh-server causing the error:

sudo: no tty present and no askpass program specified

https://unix.stackexchange.com/questions/48554/sudo-over-ssh-no-tty-present-and-no-askpass-program-specified
https://askubuntu.com/questions/271186/how-do-i-resolve-the-tty-problem

Can I configure drush to include -t flag when its doing ssh -t user@ssh-server. I understand this will load tty session and solve problem, am i wrong?...in short, how do you best overcame this issue? Thank you

UPDATE:
I followed instructions from similar question referred by Clive

Added following line in .drush/drushrc.php:

$options['ssh-options'] = '-o PasswordAuthentication=no -i $HOME/.ssh/id_rsa/lamp_vbox';

Then I run in debug mode by adding --debug and this is what it shows:

  Calling proc_open(ssh -o PasswordAuthentication=no -i /Users/owner/.ssh/id_rsa/lamp_vbox margots@lamp-vbox 'COLUMNS=179 drush  --debug --uri=dev-metronic --root=/home/websites/dev/metronic --verbose  deploy-asset '\''@dev-metronic'\''   --ver=0.3 --asset=metronic --env=dev 2>&1' 2>&1);
          Starting Drush preflight. [0.06 sec, 1.51 MB]

From the log, I conclude that the settings are being passed, however. I still get the error, so I wonder what could be the problem and how to solve it.

I'm using: Mac 10.9, Drush Version   :  7.0-dev


texts: View sorting becomes arbitrary with grouping field?

texts:
The setup:

A view that lists out nodes containing study abroad Program information. Its format is Unformatted List. There is a Grouping field of Country (which is a field on the Program content type). The list is sorted by Country (asc) and then Program title (asc).

There are exposed filters (via Better Exposed Filters) for a few of the fields from the Program content type... one of which is Country. These filters are exposed in a block that's included on the view page.

The Problem:

When you perform a search via the exposed filter block with multiple Countries selected, the sort order seems arbitrary. The grouping (by Country) works, but the Countries are listed out of order... not alphabetical asc or desc... just arbitrary.

Worth mentioning: any other search using any of the other exposed filters, but not selecting any Country values, works fine.

What's going on here? Why does sort get wacky when searching by Country... which, coincidentally or not, is also the grouping field?


texts: Problem with views edit link not appearing

texts:
I have created a view (block) that has contained in its fields user account information (including content profile fields). Along with that, there is an edit link to edit the profile information. The problem I am experiencing is; when logged in as a regular user, the edit link does not appear. When logged in as user 1 it does appear. I thought this would be a permission issue but I can't see what should be checked. I think I have enabled all the necessary permissions. Aren't users enabled to edit their profiles by default?

Here is a screenshot of the view's settings:

I am using Drupal 6.26 and views 6.2.16 and displaying this view in a panel. Any suggestions as to what I may be missing?

Thanks.


texts: Problem with Google Analytics module: "undefined index"

texts:
I use "Google Analytics" module (version 7.x-2.1 = up to date) and I get the following error message:

  Notice : Undefined index: value in googleanalytics_page_alter() (ligne
  217 in
  .../www/sites/all/modules/google_analytics/googleanalytics.module)

Any idea how can I solve it? Perhaps some manual modifications in the googleanalytics.module file?


texts:
This is something I've struggled with for a long time in Drupal. I'm guessing it's a relatively easy answer but I haven't been able to find an elegant solution. Here's the problem:

Let's say I have an e-comm site with Categories, Coupons and Products(all are CCK content types). Each Category can have any number of Products and Coupons. I'd like the ability to have a menu within my Category node that will allow me to select any of the existing Product and Coupon nodes. Also, not necessary but ideally I'd like the ability to change the order of Products/Coupons within the Category.

Is this possible? Or, is there a better way to do this?

Thanks in advance.


texts: I want to add some JS to a particular page.  In template.php, do I simply need to check request_path() in my preprocess_page() function in template.php?  Is that the best way to do it?


texts: Why do PAreview/codesniffer gripe about missing "scope modifier"?

texts:
I am writing a simpletest file for my Drupal module. It works OK, but when I use PAreview (automatic tool based upon PHP codesniffer to check correctness of Drupal code), I get the following error flagged: `No scope modifier specified for function "setUp".

My function setUp looks like this:

function setUp() {
  parent::setUp('realnamereg');
  variable_set('user_email_verification', FALSE);
}

Changing into into a public function fixes it:

public function setUp() {
  parent::setUp('realnamereg');
  variable_set('user_email_verification', FALSE);
}

Do anyone know why PAreview/code sniffer complains about this, and whether making the function public makes any difference?


texts: Scheduler Module crontab job does not publish content

texts: When running the Scheduler lightweight cron through crontab, I am getting a message that the lightweight cron has activated and completed in my D8 log, but content is not publishing. When running the lightweight cron through backoffice, items publish correctly. I've checked the cron log to see if the cron is encountering errors, and am seeing no issues. Is there something I am missing in my crontab command that is causing the cron to run but not update publish status on any of the scheduled nodes?


texts: I18n translation of site_name not working

texts:
I have installed i18n, changed settings.php according to this guide, set language detection to url and cleared cache.

Then on site config page, I set the url prefix to English and all UI changed to English. Then I updated the Site Name to something English.

Then I repeated the above steps for a local language.

But it looks like changing the url path prefix each time gives me identical results regarding Site Name, i.e. the Site Name is changing each time I update it, no matter which language path is chosen.

What am I doing wrong?

P.S. In table "variable" the site_name is just one. I never used i18n before, no idea how it should look here.


texts:
My Cache-Control header is always set to must-revalidate, no-cache, post-check=0, pre-check=0, private on the front page as well as every other page.

I've gone to configuration>performance and set Page cache maximum age to 5 mins, and I've gone to every view and set time-based caching to 5 mins as well.

There are a lot of articles about what to grep for in modules that might disable caching on a page, but these are all for Drupal 7, and I'm on Drupal 8.

What should I be looking for in my D8 modules that might be killing my caches?  If I don't fix this header, CloudFront won't like my pages very much.

EDIT: The poll module was invalidating my caches on pages that were showing poll results, but that didn't turn out to be my main issue.  After disabling the poll module, I was still getting must-revalidate, no-cache, post-check=0, pre-check=0, private, but only on my Firefox Developer Edition (with browser caching disabled, though that probably doesn't matter) while all other browsers (including regular Firefox, with or without caching disabled) are returning max-age=300, public as they should.  I'm concerned, does this mean users can bypass caching under the right circumstances?


texts: How to hide "Delete Site" link for a user rather than Admin?

texts:
I have website created in Drupal LMS "Openscholar". Its a academy site and there are various,they have there on vsite where they can add content as per there role.When user logged in ,there is a link to "Delete Vsite" available on his/her profile,

Therefore,my issue is that he can delete his account without concerning Admin.I tried to hide it using "Display:none" in CSS but it will hide Delete link for admin too. Thus, i want to know how to resolve such issue ?


texts: Which html div classes are relevant when styling Views in Drupal 7 (for CSS)?

texts:
Generally, I wish to be able to style Views output on my site, but I am unsure which div classes and classes from other html elements to select in CSS to style.

There are many nested divs with classes and some to me seem like housekeeping/ancillary ones that should not be effected, e.g.:

General advice requested please: in the form of: technique, experiences, guide, tools, books and examples.

I've also considered Semantic Views for this aim, but this appears to be not yet in beta for Drupal 7 (i.e. unstable). Also View Element in Chrome browser or firebug - but not sure how much benefit these would have.

Also considered a mix of answers from:

How to design a page created using Views
Complicated views layout
How to create a list of FULL Nodes without titles (Views)
Customising the first item in a view

But would prefer a more general approach and one which doesn't require adjusting theme php code.


texts: Hide price and add to cart form for purchased product

texts:
I'm using Drupal 7 and Drupal Commerce.

I need to hide the price and the add to cart form when a product was bought by the current user.

I found the solution for the add to cart form, but not for the price.

I imagine that it is necessary to use the function hook_entity_view_alter, but my code doesn't work. Here he is :

function mymodule_entity_view_alter(&$build, $type) {
  $purchased_product = mymodule_get_users_purchased_products();

  $line_item = commerce_unit_price[LANGUAGE_NONE]['0']['amount'];
  $product = commerce_product_load($line_item->commerce_product[LANGUAGE_NONE][0]['product_id']);

      if (in_array($product->product_id, $purchased_product)) {
        $build['product:commerce_price']['#access']=FALSE;
      }
    }

Function for load the purchased product :

mymodule_get_users_purchased_products() {
      $purchased_products = &drupal_static(__FUNCTION__);

      if (!isset($purchased_products)) {
        global $user;
        $query = db_select('commerce_order', 'corder');
        $query->join('commerce_line_item', 'li', 'corder.order_id = li.order_id');
        $query->join('field_data_commerce_product', 'prod', 'li.line_item_id = prod.entity_id');
        $query->condition('corder.uid', $user->uid, '=')
              ->condition('corder.status', 'completed', '=')
              ->fields('prod', array('commerce_product_product_id'));
        $result = $query->execute();

        $purchased_products = array_unique($result->fetchCol());
      }

      return $purchased_products;
    }

Do you know where from comes the problem?

Thanks for your help


texts: Set a different home page for each role?

texts: The Front Page module only appears to work with anon\auth users and I need it for other roles. Any ideas on how to accomplish this?


texts:
Use Case: User wants to clear his comments to rewrite it.

When the User is populating the Comment field, I would like to offer a Clear or Cancel button that will remove the content.


texts:
In a Drupal 7 site, I want to give users with a certain role the permission to manage some (but not all) blocks. More specifically, only want to allow editing the blocks provided by the Nodeblock module.

I can probably do a lot with hook_form_alter, but maybe there is a cleaner way (or even a module) to specify edit permissions on the block level.


texts: How to automatically change a Content type field value based on Date field?

texts:
I'm using Drupal 7, I have a content type, where I have two fields for project allocation:

Status(Active/Inactive)
End Date

If the "End date" is less than current date, then the "status field" should be Active(By Default, Status will be Active) and if it exceeds current date, then that particular "status field" value in Content type should automatically change to Inactive.

Now, how can I automatically change the field value without any Button trigger?


texts:
Is there any way to alter the default Drupal 7 image fields to allow a browse server option along with the default upload file option? Kind of like imce or ckfinder but for image fields instead of content (text) fields.

It seems like this could be pretty useful and I don't really see any modules that offer this kind of functionality.


texts: Is there a function in Drupal 7 to pull all instances of a specific content type to store in an array? Ex: Say I have a content type called "us_states" and I want to pull each instance of that type (with it's saved data so the title, description, and the custom content I created) and store them into an array. How should I go about doing that?


texts: how does entity_load and entity_save work with mongodb

texts:
Apologies if the question sounds too ambiguous, I am trying to migrate my nodes to MongoDB with the contributed MongoDB package's MongoDB Migrate module and am having trouble in migrating my node type comprising a few date and a few serialized fields where none of my field values get saved in mongo but are set as null, but are present in the MySQL table (where node_load populates the object with the respective nid when not using mongo as the storage config).

This issue, however does not occur for newly created nodes with mongo field storage and their complete data is present in the record. Only in case of migrated nodes the title and created date alone are present with all field values set to null.

I looked into the contributed module's code to identify and debug this issue. The code for migration in mongodb_migrate.drush.inc seemed elegant and fairly straightforward where the initial drush command mongodb-migrate-prepare checked for mysql fields in the field config table and updated them as mongodb field storage and prepared a list of entity types to be migrated, the second drush command mongodb-migrate gets entity data through entity_load, a record is created with an id of the nid and entity_save is performed.

Following the readme.txt I added the line

$conf['field_storage_default'] = 'mongodb_field_storage';

prior to running the migration. Logging the loaded entity object after enabling the mongo and mongo migrate modules themselves along with the above line did not seem to load the field data in my case though I did not seem to misread the ReadMe.txt

I tried to identify how the entity_load uses MySQL during the migrate and entity_save uses MongoDB for the node and fields by looking into the core's entity.inc load function and the field API's field_attach_load calls the respective storage function to load field value but could not grasp the same. Also if all nodes along with their fields are saved in a single record in MongoDB why entries would be required in MySQL's node and node_revisions is another aspect I am yet to understand. Some insight on the same would be of much help for me to understand the process and fix my issue.


texts: Add more info to entityreference autocomplete widgets

texts:
I'm using a simple entityreference field with "autocomplete" widget on a content type.

When I start to search something, the autocomplete function returns me only the title of the node. Is there a way to add some information? I would like to add created time, or nid.

I tried to create an "entityreference" view as widget, but It useful only to select contents with filter or others configurations.

How can I do?


texts: Creating a periodic report in Drupal 7 or 8

texts:
I have the following use case: users have to report quarterly on their project used an unified form. For example, project 1 is implemented by organization X with contact person John and has to deliver 10 pcs. of A and 15 pcs of B; project 2 is implemented by organization Y with contact person Mary and has to deliver 20 pcs. of A and 3 pcs. of C.

I want to have a report for John and Mary to fill every three months, containing the name of project and submitting person, reference period, item and how many was delivered during the reporting period, as well as accumulated delivery from the project start. Further, I would like to retrieve summary reports on how many items of A. B and C were delivered so far by projects X and Y, and export the information to calculate further stats (i.e. % delivered by project and item, etc.).

The Q2 report for John and Mary should be pre-populated with the information on delivery for Q1 so far, contain fields to add the new performance and sum the new totals for their respective projects. Similarly, in Q3 the reports for both should contain the delivery for Q1+Q2 on their respective projects.

For most of the functionality described, it would be sufficient to use Webform for the reports and Views for accumulating the results; however, I have not found a way to add in a new webform instance representing the Q2 report the data from the Q1 report on the same project.

Could anyone suggest a solution, ideally without programming?


texts:
I had defined a new workflow which has 3 states and I want to assign it to a content type. I had tried to make a workflow file type in manage field but when I try to edit it I can not choose my workflow type.

I only can select "-Select a value-" but my workflow type defined don´t appear.

Thank you in advanced.


texts: How to provide free tagging ability when saving nodes using services

texts:
A content type is going to be saved , this type contains a taxonomy term reference field named field_ucectgry . I'm developing an app so the user can create new node types remotely. Services module is used to provide a REST service for that.

Now for filling field_ucectgry during node creation I must pass the term ID , but the problem is that this field must has free tagging ability which means new tokens for this field is accepted.

So , how can I provide the ability of free tagging for my program?

PS: this is the structure of the field in node :


texts: how to create a static view page which gets result from a content type?

texts:
Good day,
I am wondering how do i create a static page, which displays the result of content types data?
its like this: a user will fill a content type called "books" and insert data into fields like (author, type of book, published,localization).
the type of book will be a taxonomy, which will determine if the book is a magazine, novel or a research.

think of the result page as an excel file, which will have a book, and its sub categorized into field of result numbers.

my point is, i want to create a static page, which will show result of the following:

how many research books available. (a field will be based on taxonomy term)
what are their localizations, foreign, or local.

i know the a math operated result could use views_calc module, but i wanted it as an independent page viewing the report, not to mention that not all will require math operation.

so once a user fills in the content types field, result is updated to the static view page automatically (like a report) to tell what and how many books types were inserted and what are they. please refer to the pic.

to clarify further, in database coding, i would execute my intended report for 1 result as from content type like this: "select * from books where type="magazine" and published= "yes"

so result will show how many magazines published, as in the pic.

i heard about forena module, but it seemed bit too complex for my task, which i think is simple. but im not sure.

im new to the web development era, i used to do basic java SE so im trying to avoid coding everything(which is my last option).

hope i made it clear.
Thanks in advance


texts: My company wants to change the domain from domain.com to domain.org, how would we do that according to moving the theme, all files, modules, etc. and keeping the Drupal integration intact?


texts:
I'm using the "navigation" menu as my admin menu. I want to create a "report" menu link with sub-menu links for "report - content", "report - comments", "report - users". A view is generating those.

What I would like to do is not show those sub-menu links in the navigation menu. I can do that by unchecking "Show as expanded" for the "report" menu link.

What path do I have to enter for "report" that will show the sub-menus. Do I have to code that?


texts:
i'm working on a problem for a while and still found no answer.
I'm using the Webform Plugin to show a contact form on my site.

The current structure is:

<form>

...

...

...

...

</form>

Is it possible, maybe with a hook because i want to apply it to a special form, to get this HTML structure:

<form>

...

...

...

...

</form>

I want to split the form items into two rows.

Thanks for hints and tips!


texts: Is there a way to output the machine name of a taxonomy term?

texts:
I've been to figure out how I can output the machine-name of a taxonomy term on my entity field to my twig template. using .label prints out the name of the taxonomy term. .id get a numerical value, was actually hoping to get the machine term instead. Using kint I can't seem to find it

{% for themes in node.field_themes %}

        <span>{{ themes.entity.id }}</span>
{% endfor %}


texts: Is there a way to enable Basic Auth for only one specific type of node?

texts:
Can't really find much useful in the way of googling.

I have a special content case on my site where I have created a page template which displays a series of blocks in my theme code. To apply this template to this particular page, I made a custom node type for it. However, this content is (and should be) restricted only to users with a certain permission, which I accomplished via the Content Access plugin.

I want to use wkhtmltopdf to output a PDF of that page for internal use. The only way I think I can get the node instance to allow wkhtmltopdf to view it is to run wkhtmltopdf with the --custom-header flag with an Authorization header. I need this to happen once per day, and was thinking of setting up a cron task to run wkhtmltopdf nightly on a Linux system (so far I have just been testing it manually on a Windows system where the node had no permission requirements and everything seems fine).

I know that enabling basic auth for certain paths is a thing I can do using a plugin, but this content is not defined by a plugin and is just a node I created using the Drupal interface.

Is this possible, or do I have to tear it down and start over and build a new custom plugin?


texts: CCK text field does not appear in views fields nor filters

texts:
I have a CCK text field in my TOC. However, it is not displayed for selection under the views fields nor the views filters.

I tried clearing cache and refreshing the module list with no luck.

Any hint of what could be happening?


texts: I want to redirect the user to profile page after they log in. i tried with some modules but those could not help. i am using D7 version of drupal and tried with login modules


texts: How I can alter reCAPTCHA script tag in html_head

texts:
The reCaptcha module adds a Javascript with hook_captcha(). I want to add another attribute "type" to this script tag. I can't find a hook to achieve this.
Here is the code from the recaptcha.module (line 118):
$captcha['form']['recaptcha_widget'] = [
        '#markup' => '<div' . new Attribute($attributes) . '></div>',
        '#suffix' => $noscript,
        '#attached' => [
          'html_head' => [
            [
              [
                '#tag' => 'script',
                '#attributes' => [
                  'src' => Url::fromUri($recaptcha_src, ['query' => ['hl' => \Drupal::service('language_manager')->getCurrentLanguage()->getId()], 'absolute' => TRUE])->toString(),
                  'async' => TRUE,
                  'defer' => TRUE,
                ],
              ],
              'recaptcha_api',
            ],
          ],
        ],
      ];

When I try to access the script tag with e.g. hook_page_attachments_alter() or any other hook_preprocess_xxxx() it is missing. I also tried to increase my module weight.


texts: Inserting previously uploaded images into WYSIWYG editors

texts:
I'm having a photo sharing feature on the site where users upload photos which are saved as nodes.

I want to be able to have them insert any of their previously uploaded photos into articles nodes and comments.

I haven't decided on TinyMCE vs. CKEditor plugins yet.

I want to do the same for videos they have uploaded.
 I haven't tried IMCE yet but don't like the "windows explorer" like UI. Same with CKFinder

Our old community site has such a feature for the TinyMCE editor but I'm not sure how they did that.


texts:
I have this array

{% set icons = { 1: 'glyphicon glyphicon-asterisk',
                 2: 'glyphicon glyphicon-plus',
                 3: 'glyphicon glyphicon-minus',
                 4: 'glyphicon glyphicon-euro'
                 }
%}

I want to loop through it and print like this

<li{{ item.attributes.addClass('pos' ~ loop.index, icons[loop.index]) }}>


texts: Flags - show a flag marker even if user cannot modify it

texts:
I have been able to set up a flag with Advanced forum to allow users to mark comment in  a thread they started as an accepted answer. It was simple to set up and works well.

However, it seems Flag only alters a comment if the user has permissions to set/unset the flag. I want a tick to appear on a comment which has been flagged which any (even anonymous) users should be able to see. How do I go about doing that?


texts: How to make the permissions of a module more granular?

texts:
Assume a (contributed) D7 module, say module ABC, comes with only a few permissions (which can be set on the typical /admin/people/permissions page). For example:

Administer module ABC.
Access (view) "all results" produced by module ABC.

Whereas "all results" can be found within a site via a combination of URLs (with corresponding menu items also) like:

ABC/SomethingX (X=1, 2, ...).
ABC/SomethingElseY (Y=1, 2, ...).
node/*/ABC.

Which site building techniques can be used (without hacking the module), to grant access to such URLs as in this example:

Access to ABC/SomethingX is allowed for anybody.
ABC/SomethingElseY is only allowed for authenticated users.
node/*/ABC is only allowed for authenticated users.
For any URL that is only allowed for authenticated users, its corresponding menu item should be visible to anonymous also. This to show such users that such menu item is available, but with some type of Drupal message to inform them that login is required to actually use such link.

Real world situations (use cases):

The question about "content access + menu block => not shown all links in menu block": by using the Content Access module access to selected nodes is restricted (of course). But how can menu items corresponding to such selected nodes remain visible for anonymous users anyway?
The Visitors module: replace 'ABC' by 'visitors' in the example above, and assume that you want to grant access to "some" reports (= ABC/SomethingX) for anybody, but not to "some other" reports (= ABC/SomethingElseY).

If permission Access (view) "all results" produced by module ABC would be set to "authenticated", then anonymous users cannot see any URL. While if that permission would be set to "anybody" (= either "anonymous" or "authenticated"), then anonymous users also have access to (eg) ABC/SomethingElseY (which is not what is desired).

How can menu items corresponding to ABC/SomethingElseY remain visible for anonymous users anyway?


texts:
I have inherited a drupal site with a few modules.
They're not exactly written according to best practices... they return html code instead of renderable arrays. In other words, they do this:

function custommodule(){
 $output = '<p> Some output. </p> <p> Some more output. </p>';
 return $output;
}

Instead of this:

function custommodule(){
   $args = array( arg1, arg2 );
   return theme('sometheme', $args);
}

The output is supposed to be displayed in the content region. However, since plain html is returned that is not wrapped in a node or anything like that, the output gets scattered all over my page... for example, the text Some output. appears above the navigation, Some more output. appears underneath the footer, etc.

By the way, the page-array has the returned markup (the $output from above) in this place:

page['content']['system_main']['main']['#markup']

Whereas for example a typical article would have its #markup in

page['content']['system_main']['nodes'][$nid]['body'][0]['#markup']

So I guess drupal doesn't realize I would like my output to be in the content region?

Is there any way I can safely render that unpleasant html?

Thanks a lot in advance!!


texts: Drush db connection issues after upgrading to MAMP 4?

texts:
Upgraded to MAMP 4 yesterday and cannot get Drush to connect for the life of me. I believe I had a similar problem with MAMP 3, but the following fixed the issue. No luck this time.

sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock

Any ideas? I have Drush installed globally with Composer. Here's the error:

    Command pm-update needs a higher bootstrap level to run - you will   [error]
need to invoke drush from a more functional Drupal environment to run
this command.
The drush command 'pm-update' could not be executed.                 [error]
Drush was not able to start (bootstrap) the Drupal database.         [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for
details.
 * connect the database through a socket. The socket file may be
wrong or the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.

Drush was attempting to connect to:
 Drupal version         :  7.50
 Site URI               :  http://default
 Database driver        :  mysql
 Database hostname      :  localhost
 Database port          :
 Database username      :  root
 Database name          :  ba_dev
 PHP executable         :  /usr/local/bin/php
 PHP configuration      :  /usr/local/etc/php/5.5/php.ini
 PHP OS                 :  Darwin
 Drush script           :  /Users/ja/.composer/vendor/drush/drush
                           /drush.php
 Drush version          :  8.1.3
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Users/ja/Sites/ba/public_html
 Drupal Settings File   :  sites/default/settings.php
 Site path              :  sites/default


texts:
How do I add a custom region in the bootstrap theme using Drupal 8?
I have installed a Bootstrap theme and now I want to add a custom region before the Header region.  What should I add in the theme .info file? How do I render it in the page template?


texts: Colorbox popup opens additional parent window

texts:
I have a popup window that uses colorbox, inside of the popup I have a link that open a second popup:

<a target="<?php print $target; ?>" class="colorbox-load"
ref="<?php print url(REPLACE_PATH_REPIN.'/'.$node->nid); ?>?width=800&height=880">

The problem is: when I click on this link it seems that I have open additional parent window, anybody knows why?

Thanks!!


texts: Use Display Suite token field in custom block type template

texts:
I have a custom block type, which uses its own theme template.
I have a display suite token field link_card_edit_block
It just uses HTML and tokens to create a link.
I want to use that field in my block type template.
Without the custom template, the field shows up.
If I add {{ content }} in the custom block template, the field shows.
But I can't figure out how show that field individually.

Here is what I have tried:

{{ content['#block_content'].field_link_card_edit_block.value }}
{{ content['#block_content'].field_link_card_edit_block[0] }}
{{ content['#block_content'].field_link_card_edit_block }}
{{ content.field_link_card_edit_block.value }}
{{ content.field_link_card_edit_block[0] }}
{{ content.field_link_card_edit_block }}

All of them produce nothing.


texts: jQuery scripts not working on my Drupal theme

texts:
This script from JSFiddle that works: https://jsfiddle.net/ryXFt/704/

Does not work in my Drupal theme (yes, it does load, I can see it via Firebug). All I do is just wrap up the code to match Drupal rules.

(function ($) {
  Drupal.behaviors.yourBehaviorName = {
    attach: function (context, settings) {
        $("#block-menu-menu-mobile ul li .nolink").click(function() {
            $('html,body').animate({
                scrollTop: $(".region-front-calander").offset().top},
                'slow');
        });
    }
  };
})(jQuery);

When clicked, console gives TypeError: $(...).offset(...) is null for line that contains scrollTop: $(".region-front-calander").offset().top},

HTML

                                    Calendar


texts:
I want to use some math function in the field.
Is there any editor to support all of the mathematics functions?
For Example log,Radical and etc?


texts:
Notice: Undefined property: FieldCollectionItemEntity::$field_wa_thick
  in _get_details() (line 385 of ...../er.module).

  Warning: array_key_exists() expects parameter 2 to be array, null
  given in _get_details()

The error is on the following line:

$wt = ((array_key_exists('und',$li[$li_id]->field_wa_thick))?$li[$li_id]->field_wa_thick['und'][0]['value'] : NULL );

What may be the reason for the following error above??


texts:
In my site it was not required to add color to text or change its size, but now we want to add formatting to our posts.

So I tried to configure CKEditor's Toolbar to add text formatting options in Drupal administration page, and after I added that, I see no changes in my CKEditor, new options weren't added.

How could I add that options?

Thanks in advance for your help


texts: Can't connect to remote DigitalOcean database

texts:
I am attempting to connect an existing Drupal 8 site to a DigitalOcean managed Database.

The connection info I've received from DigitalOcean:

username = digitaloceanadmin
password = password
host = nameofmydbcluster.db.ondigitalocean.com
port = 25060
sslmode = REQUIRED

I've made the adjustments to settings.php:

$databases['default']['default'] = array (
  'database' => 'dbname',
  'username' => '...',
  'password' => '...',
  'prefix' => '',
  'host' => 'dbclustername.db.ondigitalocean.com',
  'port' => '25060',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

However, I'm getting the following error:

PDOException: SQLSTATE[HY000] [2054] The server requested authentication method
unknown to the client in ...

More errors when I drush cr:

In Connection.php line 416:

  SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

In Connection.php line 416:

  PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]

I am running Drupal 8.8.1 with php7.2. The DB version on remote is MySQL 8.

Any help would be greatly appreciated.


texts: Removing divs added by render and node.tpl.php

texts:
I'm trying to build an HTML5 template for Drupal 7, and I'm quite particular about clean code. I want full control over the HTML and CSS which for the most part I get using my own custom theme. In other words I have an HTML5 and CSS set I want to use exactly as is in Drupal. I'm not too clued up on how the whole pre-process function thing works.

When I use 'print render($page['content'])' in my page.tpl.php file it adds

And then when I add 'print render($content)' in the node--custom.tpl.php it adds

I don't want any of these divs. How do I get rid of them?


texts:
When I create a new article in Drupal 7, there's a field to upload an image that will be associated with the article.  That image can only be uploaded directly from my computer.  Is there a way to make it so that Image fields will accept a link instead of a direct file upload?

Thanks!


texts:
Drupal 8.9, Webforms 5.x
I have a load of forms that are all basically the same, except for the confirmation URL (a download link, essentially) and some minor tweaks to the handlers.
In an effort to reduce duplication, I've been looking into the possibility of using variants for this. I can create all the variants easily enough, but I'm at a loss as to how to include these on the correct pages.
The form itself is included in the layout of the content type as a block and I can specify a specific variant there via default submission data (as per image) but that's a single variant for the whole content type rather than a specific variant for a single page.

What's the best way to do this? Is it actually possible with variants at all? Or perhaps there's some other solution I've missed


texts: Field for if the current user is a member of the organic group

texts:
I am working with Services module to create an API. I have created a View that shows list of Organic groups.

Now I need to add a field which will show if the current user is member of the group or not. Can anyone please tell me how to do this?


texts: Drupal 7 hook_validate not called with custom form template

texts:
I received a pretty strange problem trying to customize custom form's template. So while form's template stay untouched (drupal core's form template was used) validation works just fine, but when I add some specific templates to my theme, validation just not working at all. Submitting a form just doesn't gives anything - MYMODULEFORM_form_validate and MYMODULEFORM_form_submit hooks are not called after form been submitted.

function MYTHEME_theme ()
{
    $items['MYMODULEFORM_1_form'] = array(
        'render element' => 'form',
        'path' => drupal_get_path('theme', 'MYTHEME') . '/templates',
        'template' => 'template_1_filename',
    );
    $items['MYMODULEFORM_2_form'] = array(
        'render element' => 'form',
        'path' => drupal_get_path('theme', 'MYTHEME') . '/templates',
        'template' => 'template_2_filename',
    );
    $items['MYMODULEFORM_3_form'] = array(
        'render element' => 'form',
        'path' => drupal_get_path('theme', 'MYTHEME') . '/templates',
        'template' => 'template_3_filename',
    );

    return $items;
}

When I print out $form variable inside the template file #validate and #submit elements are present and correct. Do you have any ideas what can cause this problem I just stucked at this. Thank you!


texts: How to override form element templates from custom module

texts:
I have a custom field with some radio inputs and the following (widget-)output right now:

  <input />

For every radio single radio input(In my case 5 times - back 2 back). Can I remove the outer
 without actually touching any themes (neither the stable theme nor my custom theme) ?


texts: Migrating orders doesn't migrate total values

texts:
Has anyone tried migrating commerce orders? I had problems tracing the tables that was used by commerce order.

Initially, I've already mapped commerce_order_total and commerce_order_total:currency_code (in the ui: http://prntscr.com/9a6bid). My query from the source database also outputs correctly. My problem is after migrating, commerce total values were not migrated (http://prntscr.com/9a6cko).

Am I in the right track? Please help.

I'm also confused why commerce_line_item is needed in commerce order and order_id is needed in commerce line item. I'm really confused.

Are there any existing useful links regarding this?

Thanks for any help!


texts:
I am trying to get Views to display files I have uploaded to my server using the Media module.

My end-goal is to display the 5 most recently uploaded pictures (from any album) in a slideshow on the front page (using Views Slideshow).

My website as a whole will be my personal photography-website when it's complete. The way I have everything set up so far is: I created a new content type for my pictures called Photos. Next, I create a new piece of that custom content and upload pictures to it. The organization structure is that, each new piece of Photos content behaves like an album--containing a set of images pertaining to it's title.

For example, if I wanted an album specifically dedicated to landscapes, I would create a new Photos piece of content, and upload all my images of landscapes to it.

The problem I have right now is, I can get Views to display my custom content type and scroll through it, but because each individual picture is wrapped inside a Photos content, the View will display every single image in that album 'per-slide'. How do I get Views to only display the five most recently uploaded Media files? (As opposed to what it's doing right now, displaying the five most recently added Photos albums.)

(Using Drupal 7)


texts: AJAX HTTP error on wsclient REST service

texts:
I'm trying out the wsclient in Drupal 7 and whenever I attempt to test the the transaction to another API using REST I get the following error:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /system/ajax
StatusText: OK
ResponseText:
Fatal error:  Call to undefined method HttpClient::__getLastRequestHeaders() in /home/dmwbm/www/sites/default/modules/wsclient/wsclient_tester/wsclient_tester.inc on line 143

Looking at the error it appears that this is an attribute required by the SOAP service. The SOAP examples are the only ones that work and the REST ones do not.

A friend suggested running this suite on simplytest.me so that I could isolate what is conflicting in my drupal install. Wouldn't you know, this message is output on this clean Drupal install.

Googling I see this error in a bug fix from two years ago. I must be doing something wrong in that this error should have been fixed by now and shouldn't show up in my install or simplytest.me. What obvious thing am I overlooking? thx, sam


texts: move $messages div to inside the form tag

texts: I would like to move the $messages div for any webform type away from a div but instead add it inside the  tag. I've started with THEME_preprocess_page(&$variables) in my template.php but I am stuck because the $variables doesnt set which element (or id/classes) the $messages should be placed in. Any suggestions/help would be appreciated. Thanks!


texts: I created a block view and am having trouble controlling the out put. Theme developer tells me the candidate template file is views-view-fields.tpl.php that file doesn't look like any of the others I have worked on. I have found the only control I have over the output is through the view settings itself. Why can't I format the output like any other block or page?


texts:
In hook_mail() I might discover that some part of the email couldn't be generated (maybe when trying to load a variable from an external system it fails).

How can I cancel the sending? I don't want to send an email with an error message in it.

Example code:

function mymodule_mail($key, &$message, $params) {
  switch ($key) {
    case 'some_email':
      $foo = Something::fetchSomething($params['bar']);
      if (!$foo) {
        // I don't want to send this email any more
      }
      else {
        $message['body'][] = t('Important information about @foo.' ['@foo' => $foo]);
      }
      break;
  }
}

Does that make sense? Or should all parameters be loaded and processed before hook_mail() and in hook_mail() you assume to always have those params available?


texts: Prevent users from editing or viewing their own profile

texts: What is the best way to disable access to the user's profile for viewing and editing? Basically users can create an account but won't be able to edit or view their own or other users' profiles.


texts: What is "alias" in db_select() function?

texts: Beginner Drupal Developer. The drupal API didn't provide info for what purpose the $alias must be used in db_select? And what is that anyway?


texts:
I help manage a site with about 20-30 staff/trusted users and thousands more regular authenticated users. We would like to be able to allow our staff to embed Storify entries in their blog posts without exposing ourselves to undue risk.

We have Media, with add-on modules for YouTube and Vimeo embeds, but there is no Media: Storify module. We tried Media: oEmbed paired with the third-party Embedly service which can provide a Storify post in oEmbed format. However we could not get this to work. Possibly because of this bug.

We also tried the StoryPal module, but it doesn't seem well maintained and produces a WSOD. We are apparently not alone with this problem either.

Has anyone found a good solution for Storify embeds or maybe know how to get the above solutions to work? Thanks for all advice!


texts: (Views) How to style an image field conditionally based on term

texts:
I have a Drupal website in which there is a content type named Article. In that content type, there is a taxonomy field called "Topic" which is term reference field pointing to a vocabulary called Topics.

Example article URLs:

mysite.com/topic-term/the-article-title
i.e
mysite.com/books/100-days-around-the-world
or
mysite.com/culture/chinese-and-medicine

Every article has a main image field called "image". The problem starts from here.

I want to style the main image for the articles classified under the term "books" differently; i.e., I want the image to have greater height than width.

The only way that I could think to do that is to make a new view for it. I tried to make such a view, but it only rendered the first article of books. The following screen shot shows the View settings:

The real problem, indeed, I don't know a view that render the articles content page! When I contacted the theme author, for previous modification request, they told me to do it by coding in node--article.tpl.php! So I have only two ways:

Creating a view that could be able to render articles by the access way described above mysite.con/topic-term....
Using code in node--article.tpl.php that set conditionally a style for the field image if the article topic term equals to books.

I don't know how to get what I need using the two approaches.


texts: Using hook_form_alter to change exposed filter from a textfield to a checkbox

texts:
While Views in now in Core in Drupal 8, Better Exposed Filters, a popular module for Drupal 7, is not yet ported to Drupal 8.  So I need some way to do some of the same things.

I have an underlying Numerical field, and have configured an exposed filter that matches a value of 1 when the field has a value of > 0, and 0 otherwise. This works, but Views renders the field as a text field.  This is very ugly, and you'd think it would be simple enough to change the form field in the exposed filter form to a checkbox.  You'd think that changing the '#type' via hook_form_alter would do the job.

Except, this does not work. I've tracked the problem down to code in ViewExecutable::_build($key), around line 1269:

$rc = $handlers[$id]->acceptExposedInput($this->exposed_data);

If I change the '#type' of the form field to 'checkbox', $rc is always TRUE, even if when the type was still a textfield, $rc would be FALSE. This pretty much guarantees that the view will never return any matching rows.

The problem appears to be that the array ViewExecutable::$exposed_data have values of 1 (rather than the correct value of '') once type is changed to 'checkbox'.  Since ViewExecutable::$exposed_data has access "public", I still haven't figured out where in the code the wrong values get assigned.

I'm not sure why it's so hard to do something that is normally very simple using form_alter.  Any ideas as to how to get around this problem will make me (and my client) very happy.


texts: How so I execute $query->orderBy('FIELD(node.nid, 5,12,3,6)', 'ASC')?

texts:
I am currently converting code from Drupal 7 to Drupal 8. So far I am unable to find resources on how to convert the call to orderBy() which uses an expression.

$query->orderBy("FIELD(node.nid, '5,12,3,6')", 'ASC');

Based on D8 Select::orderBy, it only accepts alias or fields.

What is the code I should use in Drupal 8?


texts:
I have an app that has multipla page tabs. One of the tabs has a form that does a search. The issue I am running is that when I do a search on the form, and then go to a different tab, and then come back, it does the search again. How can I make it so that when I switch tabs and come back that the form is in its default state.

Thanks much for the help.


texts: Body classes still showing 'page-node-#' instead of title or menu word

texts:
I'm trying to get either the title of a page or the menu entry to be listed as a class in the body tag. I came across a posting here utilizing this code:

function THEMENAME_preprocess_html(&$vars) {
  $path = drupal_get_path_alias();
  $aliases = explode('/', $path);

  foreach($aliases as $alias) {
    $vars['classes_array'][] = drupal_clean_css_identifier($alias);
  }
}

flushed all caches but my body tag still looks like:

<body class="html not-front not-logged-in no-sidebars page-node page-node- page-node-47 node-type-page section-content">

So instead of that page-node-47, I'd like to see 'about-us' or whatever the path or title of the page is. I guess the path would be a better option for a class name but I'm not picky on that matter right now.

I do have Pathauto and clean urls installed and working. And in my html.tpl, I do have this:

<body class="<?php print $classes; ?>" <?php print $attributes;?>>


texts: How to create a view of Users and use uid field with Display Suite view mode

texts:
I have been able to create a view of Users with format of Fields. I added user fields, and and found the UID field as well which I can use to link a field to the user's profile page.

However, I prefer to output views with the Content format and create a view mode for the view. For users, there is no Content format, and I assume the equivalent is User format.

However, when I created my display mode on the user profile and set it to a display suite layout, I found that there is no UID field (I did see Username, but that wont help). Does display suite not provide us this field?


texts: How can I display content from one node to another?

texts:
With some design in mind, I have to display the some content of one node to another node. For ease of understanding, I have just put some drawing.

Suppose, I have,

Content type: Article which has -> Node/5 which has -> field_123 (Text type)

and I want to show that field content to another node,

Content type: Basic Page which has -> Node/6 which will be ->  copy_field_123 (Text type)

Hence, in short I want to display content of one node to another node. I do not want entire node content to be transferred to another node as it is, but a specific fields which I choose.

Any suggestions, please?


texts:
I have a really complex set of shipping rules

I have three product types

Product type A with a rate of £1 per product
Product type B with a rate of £2 per product
Product type C with a rate of £3 per product

A customer can add any combination of products into their cart so

2 x Product type A
1 x Product type B
1 x Product type C

I have created rules to loop through commerce_line_items and get the individual shipping costs for product types based upon a field in the commerce_product entity and I have got it so it calculates quantity times shipping cost.

What I do not know and cannot work out is how I then add these shipping costs back to the order, there seems to be no way to set the value of a shipping service.

Also I do not know how to parse the line items for each product type and calculate the shipping costs based upon each product type. So I need a condition check on the product type of each line item in the order to obtain the product type and then do the calculations based upon the correct shipping rate and quantity.

Any advice would be fully appreciated.


texts: How to customize order confirmation e-mail

texts: I am experimenting with Commerce 2 and it is amazing, however one thing that I am unable to resolve customizing store e-mails? The default confirmation is not adequate and should be easy to customize using tokens or whatever like drupal core email messages. Can anybody provide a high level overview how to customize the order summary e-mail? Any tips will be greatly appreciated not only by myself, but certainly many other site builders who are stumped over this.


texts: preserve node changed timestamp during term migration

texts:
I have precisely the problem described in d6_term_node migration overwrites node changed timestamps:

The d6_node migration preserves the original 'changed' timestamp for nodes on migration. But, then the d6_term_node migration comes along and sets 'changed' to the import time for any nodes with term references.

The bug has been open for 4 years. As a novice, I do not know how to fix the problem.
A workaround is suggested in comment #28:

As a possible ugly work-around, add 0.01 to the timestamp ('changed' += 0.01) to keep the existing value. Because php will treat these as != but when mysql goes to insert into an integer column in the DB, it will round down and set to the same value.

However I have been unable to find a simple example to crib from that performs this task. Pointers to a tutorial would be greatly appreciated.