texts: In add filter criteria "user" not coming from FILTER list in add views

texts: I am following the book "The Definitive Guide to Drupal 7" where I am trying to add a new view. But when I tried to add filter,I can't find the User in the FILER list . I am very beginner to Drupal,though I know PHP .


texts: Drupal gives me a blank page after moving from localhost to server

texts:
I am new to Drupal . I moved my project from local host to server but it does not display either an database error or a page not found error.
Everything works better in local.
Please help me .


texts: How to limit the products from the compare in drupal?

texts:
I am working with the Drupal Commerce and the Commerce product comparison module. Here I need to limit the products.

How do I limit the products from the comparison?


texts:
I have a module called hello_world.

I have a hello_world.info.yml file in drupal/web/modules/custom/hello_world whose content is the following.

name: Hello World
description: Hello World module
type: module
core: 8.x
package: Custom

This works perfectly ; the module is in the extension list.

I tried to make a help hook so I made in the same folder a hello_world.module file with the following code.

<?php

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */

function hello_world_help($route_name, RouteMatchInterface $route_match) {
    switch ($route_name) {
        case 'help.page.hello_world':
            $output = '';
            $output .= '
' . t('About') . '
';
            $output .= '
' . t('This is an example module.') . '
';
            return $output;
            break;
    }
}

This does not work at all. The help page is not shown.

I also tried to make a hello world page using this controller in drupal/web/modules/custom/hello_world/src/HelloWOrldCOntroller.php.

<?php

namespace Drupal\hello_world\Controller;

use Drupal\Core\Controller\ControllerBase;

/**
 * Controller for the salutation message.
 */
class HelloWorldController extends ControllerBase
{
    /**
     * Hello World.
     *
     * @return string
     */
    public function helloWorld()
    {
        return [
            '#markup' => $this->t('Hello World')
        ];
    }
}

I added hello_world.routing.yml to drupal/web/modules/custom/hello_world.

hello_world.hello:
path: '/hello'
defaults:
_controller:
'\Drupal\hello_world\Controller\HelloWorldController::helloWorld'
_title: 'Our first route'
requirements:
_permission: 'access content'

This does not work either, even after clearing the cache. As I said, the hello_world.info.yml works perfectly fine, but the help hook and the controller/routing does not. The rest of the core modules work. I am using Vagrant if it matters.


texts: How to pass an argument from a Rules event to a Rules action?

texts:
In Drupal 6, I have made a custom Rules action in code using hook_rules_action_info(). I want to create a rule that uses the Event: "After saving a new term", which is an Event provided by Rules in the module.

I want to make whatever taxonomy term has been created available to me in my action hook, how can I do this? Looking in taxonomy.rules.inc I see the following code for the Event:

function taxonomy_rules_event_info()
{
  return array(
    'taxonomy_term_insert' => array(
      'label' => t('After saving a new term'),
      'module' => 'Taxonomy',
      'arguments' => rules_events_hook_taxonomy_term_arguments(t('created term')),
    )
  )
}

Judging by the Rules documentation for 6, I need to declare the following in my action hook:

$actions['mymodule_notifications_notify_discussion_flagged_users'] = array(
    'label' => t('Notify discussion flagged users'),
    'module' => 'System',
    'arguments' => array(
        'taxonomy_term' => array('type' => 'taxonomy_term', 'label' => t('Term'))
        )
    );

Then I can pass the $term argument to the function that will perform my actions. When I inspect $term using dpm(), I get the following object which is an array with one empty element:

Surely after the term has been created, this should contain some info about the taxonomy term? What am I doing wrong here?


texts: IMCE module is not showing icons on the editor

texts: I installed the IMCE module, but it didn't add any icon to the editor menu toolbar. It manually loads with domain.com/imce.


texts: How can a user select a different language to the site default language?

texts:
My Drupal 6 site should always display in French for all users except me. I need to administer the site in English.

Using the Locale module I have both languages installed and default set to French. In the language negotiation settings ('Configure'), I have selected 'none'. The help text says that "users may (optionally) select a preferred language on the My Account page".

Even though I have selected English in my account settings (under "Language settings"), everything remains in French when I login?


texts: Moving site to new domain on the same server

texts:
We're having a problem (well, a series of problems actually, but this one appears more difficult to solve) moving a clients site to a new domain on the same server / hosting account.

The site is moving to another folder hosted on the same server, so should be no need to change database settings or move the database.

We've moved all the files to the new sub directory and the problem is that whilst the home page displays fine, none of the other pages appear to exist and none of the menu links work. Base URL isn't specified in the settings file (although we've tried specifying one which didn't help).

Any ideas?

EDIT: Changing .htaccess file isn't helping


texts:
Is there a way to use a taxonomy term name to get all the parent terms in Views?

If the taxonomy terms are the following, is there a way to get "one" and "two," given "three"?

one

two

three


texts: Bulk redirect update from CSV: in code or manually?

texts:
I have a D7 question. My latest site change involves using the Path Redirect Import module and drush path-redirect-import to bulk-create a bunch of URL redirects from a CSV file. It works fine in dev on my Linux box and I need to deploy it to test on Pantheon.

I'm striving to do code-based deployments, so I use Features and a MYSITE.install module with hook_update_n() calls.

1) Is it a best practice or am I misguided in trying to code a hook_update_n() to perform the DB update? Code-based development aims for recording every developer-initiated site change in code, right? Or are there cases where you don't commit something to code?

2) If the answer is "yes, you should do this in code", then I see that the drush_path_redirect_import function simply processes command-line options and executes:

$result = path_redirect_import_read_file($file, $options);

so I should simply do the same in my hook_update_n(), right?


texts: I noticed that the user table has a column for status. Does 1 status mean the account has been email activated? and is this the only thing distinguishing a activated account and unvalidated account? Also, I want to make a module that will do something when a user email activates his account. I'm guessing this would be the user hook but what op code would I use to detect when a user email activates his account?


texts:
function mymodule_node_insert($node){
    if($node->form_id == 'whatever_node_form'){
        // do stuff
    }
}

Returns an error:
Notice: Undefined property: stdClass::$form_id in mymodule_node_insert() (line 16 of /home/admin/public_html/website.com/sites/all/modules/mystuff/mystull.module).

I can clearly see the array dump of $node that it is indeed an object and it contains form_id. What am I doing wrong?


texts: Ckeditor pasted url links become hyperlinks

texts:
We have disabled 'Convert URLs into links'.

When you copy a url link from a browser url field like: drupal.org. Your clipboard contains the FQDN: https://www.drupal.org/. When you past this into Ckeditor. It becomes a working hyperlink. This is expected. Can I stop this from happening? We want to allow url links to be pasted/added only through the Ckeditor Linkit module.

Below is an example if you use Linkit external links or if you paste a copied link in. The markup in the Ckeditor source is the same. How can I target the pasted link and strip it out the href attribute?. I thought about adding a link attribute in Linkit to distinguish it. Then use regex that targets href without that attribute and strip out the href.

<a href="https://www.drupal.org/"https://www.drupal.org/

&nbsp;

https://www.drupal.org/


texts: What limits the options in a Bulk Operations Menu (beyond their initial settings) regarding rule components?

texts:
I created a View Bulk Operation (VBO) that should allow an admin user to change the author of several nodes at once.  Everything works fine when I am logged in as the root user.  However, when I am logged in as a different kind of admin user, the VBO drop down menu is empty.  I am assuming that there is a setting somewhere that is preventing the menu item(s) from appearing in the drop down list.  What could be causing this to happen?  I checked my permissions, but there did not seem to be a VBO related permission for the specific drop down option that I have enabled for this.

My setup uses a flag to target a user and a rules link to target an entity.  the rules link triggers a 'rule component rule' which changes the author of the target node.  I have a view table that renders this rule link as a column and also has a VBO column that can trigger the rule link for multiple columns.

Edit: I added a new test VBO action which calls a rule component rule (that only sets a Drupal message.)  This option does not appear for the admin users either.

Edit: the admin user role has full read and write permissions for the content type.

Edit: After enabling all VBO permissions for everyone, the option is still not available.

Edit: I noticed that the Rules Link is not shown in the view for the other admin role.

Edit: After enabling the permissions for all Rule Links, the link is displayed, but still not the VBO option.

Edit: I was able to add generic VBO operations (which could be seen by the admin roles.)  This problem only seems to effect VBO operations that are created by rules.


texts: How to fetch records from entity base on only Day and month?

texts:
How to fetch records from entity base on only Day and month

Like In DOB need to return those user which has current day and month.

E.g:

$query = \Drupal::entityQuery('user');
$query->condition('status', 1);
$query->condition('field_dob', date('m-d'));
$entity_ids = $query->execute();

In anyone have idea how to do this?


texts: Render node content in page.html.twig level or blocks at node.html.twig level

texts:
In a Drupal 8 site design there is expected a view block and a static block in the middle of node content.

I've been trying to figure out how to render node content around the block region (in page.html.twig level), render the block region in the middle of the node content (in node.html.twig level) or any other work around, for ages.

I imagine one way would be to render part of the node content in a view block with contextual filter and other node content fields in the node.html.twig, but I don't know how resource heavy would it be for the system?

If there are any suggestions/solutions anyone here could think of for solving this as efficiently as possible, I'd be very happy to hear about them.

Best,

Alari


texts: How to change the link target in a entity reference display?

texts:
I'm on d7. I have two content types on my site, "link" and "Article". The link content type contains a link field from the link module that users enter a link to another site in to. I have the "link" content type referenced (thanks to the entity reference module) in my "article" content type and I would like for the link, when clicked, to open the referring page (offsite) in a new tab/window. How can I do this?? Any suggestions?
Thanks.


texts: i'm currently using webform module to receive "contact us" messages in my website. I would like to keep track of our answers in the system by answering from the website instead of the email.  Anyone knows a module or something? I want to avoid using complicated crm systems (civicrm, crm,etc)


texts:
How can I create a separated workflow for a content type like "Article" for each organic group?

For example:

"Math Group" has the roles "Author," "Head."
"Article" nodes created by users with the "Author" role in "Math Group" will be visible only by users with the role "Head."
Users with the "Head" role will review "Article" nodes, and then publish it or send it back to "Author" for improvement.

How can I implement it with OG and Workflow?


texts: Programmatically created node gets created three times, produces error

texts:
I'm creating one of my first Drupal modules which should create a node (type= page) when you activate the module, and then add some javascript to site.

But when I activate the module, it creates three nodes with the desired node-title, and drupal produces an error:

Notice: Undefined index: module i FieldInfo->prepareInstanceWidget() (linje 591 af /var/www/SITENAME/public_html/modules/field/field.info.class.inc).
Notice: Undefined index: module i FieldInfo->prepareInstanceDisplay() (linje 626 af /var/www/SITENAME/public_html/modules/field/field.info.class.inc).
Notice: Undefined index: module i FieldInfo->prepareInstanceDisplay() (linje 626 af /var/www/SITENAME/public_html/modules/field/field.info.class.inc).

I am creating the node in the .module file like this:

$node = new stdClass();
$node->type = "page";
$node->title = "Page title";
$node->language = LANGUAGE_NONE;
$node->path = array('alias' => 'some-path');
node_object_prepare($node);
$node->uid = 1;
// Let's add standard body field
$node->body[$node->language][0]['value'] = 'This is a body text';
$node->body[$node->language][0]['summary'] = '';
$node->body[$node->language][0]['format'] = 'full_html';
$node = node_submit($node);
node_save($node);

The above code is based on this article

If i were to use the above path for the node, i would get three pages created with the following paths (i have pathauto installed):

/some-path
/some-path
/page-title.html

All of the pages have the "Page title" title set, and if i edit them they all have the 'This is a body text' body content.

Any help would be appreciated.


texts: How do I create a custom field storage back end?

texts:
In Drupal the default field storage is in an SQL database. I am creating a custom field type and want it to have non-SQL storage.

In Drupal 7 there was the Field Storage API, which you could use to define your own storage back ends by implementing a module similar to the field_sql_storage module.

How does one do such a thing in Drupal 8?

To give an example usage, I am interested in implementing something similar to Drupal 7's hook_field_storage_load() so I can have fields that load their data from files in the file system.

If it is too complex a thing to give a code example for, a point in the direction of the relevant API and/or default SQL implementation that I can reference should suffice.


texts: Using Ultimate cron to set a specific time to run a function of module, but it is not working as expected

texts:
I have set ultimate cron job time once a day but it works at every hour because another default site cron is running every hour.

This code is working on production but not according to crontab time i.e once in a day. It is working every hour, i checked cron job list on acquia server there is one cron job set named "site cron" which is running every hour.

Code:

/**
 * Implements hook_cronapi().
 */
function demo_cronapi($op, $job = NULL) {

  $items['monitor_run'] = [
    'description' => 'Post Solution',
    'scheduler' => [
      'name' => 'simple',
      'simple' => [
        'rules' => ['0' => '0 7 * * *'],
      ],
    ],
  ];

  return $items;
}

/**
 * Trigger event to generate report.
 */
function monitor_run($job) {
  // logic code.
}


texts:
I am trying to make a link pointing to # but am unable to find a method that works.

The output i would like to see is

Example

I have tried a few variations of the following without success.

$url = Url::fromUserInput('#');
$link_item = Link::fromTextAndUrl(t('Example'), $url);
return $link_item->toRenderable();

I have also tried using  ::fromUri etc and am unable to find a method that produces tehd esired output, please help.


texts: Allowed types for DataDefinition::create()

texts: I'm creating a new Field Type in Drupal 8. What types can I pass to DataDefinition::create()?


texts:
I have a group made from Organic groups, and it has these two tabs.

I want to change the name of "View", but can't figure out where to do that.

Even better would be if I could delete that little menu. Ideas?


texts: Duplicating commerce kickstart's product types view modes

texts:
I can see that Commerce Kickstart distribution has several more view modes for product types like: product in cart or node:product list, which are not listed, by default, after commerce module installation on plain Drupal.

How can I get those with only commerce module installed?

Is it some additional code or I am just missing some settings?

I found a module, Entity view modes, which seems to be good for the job but Commerce Kickstart does not have this module installed.

Thank you for advice.


texts:
I have a drupal 6 instance and I want to make it so when I create a content type (for example movies) it would create 2 sub pages (reviews, and photos). So if I went to

www.site.com/movie-BLAHBLAH/ it would load the node content type info
and

www.site.com/movie-BLAHBLAH/reviews/ it would display a page where I could theme the page.tpl.php file to do what i want it to do. and same with the other one.

Is this possible somehow?


texts: How can I print the file size and other file info in a Views field template?

texts:
I have created a content type with a number of fields including file fields. In the node template for that CT (node--unit.html.twig) I am able to get the details with the following code:

{% if content.field_files.0 %}
   {% for key, value in content.field_files if key|first != '#' %}
      {{ content.field_files[key]['#description']}}
   {% endfor %}
{% endif %}

Now I'm trying to get those same details for the field inside a view that lists nodes of that CT but the above code doesn't work. In fact all I can get from the field is the 'content' using the following code inside the views-view-field template (views-view-fields--units-e-resource-sheets.html.twig):

{{ fields.field_e_resources.content}}

All I can find using kint and other tools is the target_id attribute. Do I have to use this to retrieve those other details in the view?


texts: CSV migration always returns "id is defined as a source ID but has no value"

texts:
I have a freshly composer installed Drupal 8.6.13. I tried to migrate csv sources and allways got the error message

  [error] Migration failed with source plugin exception: id is defined as a source ID but has no value.

I switched to an example that is running in another installation https://www.drupal.org/docs/8/api/migrate-api/migrate-source-plugins/migrating-data-from-a-csv-source, but still get this error.

My versions: migrate  8.6.13, migrate_plus 8.x-4.1, migrate_source_csv 8.x-2.2, migrate_tools 8.x-4.1

Does anyone have an idea what causes the error?

This are the files:

CSV:

id,title,body
1,title 1,some body text 1
2,title 2,some body text 2
3,title 3,some body text 3

Migration configuration:

id: article_csv_import
label: Import articles
migration_groups:
  - ACME import
source:
  plugin: csv
  path: 'public://articles.csv'
  delimiter: ','
  enclosure: '"'
  header_row_count: 1
  keys:
    - id
  column_names:
    0:
      id: 'Unique Id'
    1:
      title: 'Title'
    2:
      body: 'Post body'
process:
  title: title
  body: body
  type:
    plugin: default_value
    default_value: article

destination:
  plugin: entity:node


texts:
Im trying to create a sliding popup using jQuery in my drupal module .

Referring the code from:

http://karlagius.com/2009/02/08/creating-a-sitepoint-like-sliding-popup-in-jquery/

My popup window, defined in the module, is a html string (using divs, a, img etc) .

How do I pass this html string to .js file. It gets used there in .get(url, function(data)).

Tried using drupal_to_js and drupal_json, both returns the value 0, not the string.
Need some suggestion on how to proceed.


texts: Entity query on custom entity is not checking access rights

texts:
I have a custom entity called project_member. Not all user have access to this entity. But when I query this entity with entityQuery as follows
\Drupal::entityQuery('project_member')->execute()
all the entities are returning. It is not checking the access rights. I am missing anything. I tried to implement hook_project_member_access() to restrict the access still entityQuery is not checking those access results.


texts: How can check if a field is empty in a node template?

texts:
I am using Drupal 8. I have a paragraphs field (field type: paragraphs of reference revisions) in node template, I tried lots of ways to check if the field is empty (purpose is to show the field only it has a value).

<code>
{# Below codes in node.html.twig #}
{# Below codes NOT work #}
  {% if content.field_notes.0 is empty %}
    This field is empty-1.
  {% endif %}

  {% if content.field_notes[0] is empty %}
    This field is empty-2.
  {% endif %}

  {# Enable module:twig field value #}
  {% if content.field_notes|field_value is empty %}
    This field is empty-3.
  {% endif %}

  {% if node.field_notes.isempty %}
    This field is empty-4.
  {% endif %}

  {% if node.field_notes.value is empty %}
    This field is empty-5.
  {% endif %}
</code>

How can check if a paragraphs field is empty in node template in Drupal 8?

UPDATE:
Codes tested and result below, the way NOT work for paragraphs but work for some other field types.

{% set count_field_element_1 = node.field_paragraphs|length %}
  {{ count_field_element_1 }}
  {# when field has or no value: count_field_element_1 = 2 #}
  {# paragraphs type contains two field type: image and text plain long #}

{% set count_field_element_2 = node.field_image|length %}
  {{ count_field_element_2 }}
  {# when field has value: count_field_element_2 = 1; #}
  {# when field has no value: count_field_element_2 = 0; #}

{% set count_field_element_3 = node.field_text_plain_long|length %}
  {{ count_field_element_3 }}
  {# when field has value: count_field_element_3 = 1; #}
  {# when field has no value: count_field_element_3 = 0; #}

Maybe my question is not very clear, let me explain more as below:
The purpose of this question is to check if paragraphs field (not other field types) has a value. When a field value is input and saved, node page will show the field and its value; when no field value is input and saved, node page will NOT show the field (including the div element).

{% set count_field_element = node.field_paragraphs|length %}
  {{ count_field_element }}

count_field_element is 1 for below:

count_field_element is 0 for below(removing all form items of paragraphs in node form):

In short, up till now, I still NOT figure out a way to check if a paragraphs field has a value, node page will show paragraphs field empty only when removing all form items of paragraphs in node form.


texts: How to have html not just sitename or logo in site heading block? (via subtheme or preferably editing WITHIN drupal)

texts:
Can someone give examples of using html not just a text string or logo graphic in the header for a site?

I ask because I'd like to use several web typography fonts to make a logp rather than a bitmap.

Update

Editing "editing WITHIN drupal" - would be nice, sorry to adjust question. Thanks for your answers so far.


texts: how to create path node/{some id}/add/{node_type} which loads node/add/{node_type} page

texts:
Create a path node/{some id}/add/{node_type}  which loads  node/add/{node_type} page form.

I want to get that  { some id } to assign it default value in a form field client needed that url pattern as node/{some id}/add/{node_type}.


texts: How to theme each field of exposed filter from Views?

texts:
I have found the theme template for exposed filter form of view.
Template name: views-exposed-form.tpl.php

Inside the template I found the $widgets array and for loop for each $widget display in form.

But it is rendered HTML widget How can I get only values array for each combo box to render output for my combo box as I want?

for instance:

I have one combo called Country:
Country has hierarchy level of list

Asia
- India
- Sri lanka
- thailand
- Indonesia

etc...

So, I would like to make my combo just like this

http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_optgroup

<select>
  <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  </optgroup>
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
  </optgroup>
</select>

This will identify the parent / child category in combo?
can we do this directly in drupal 7 Views for Expoesd Filters Combo ?
or
How can I theme myself to override its HTML?


texts: Why is my custom twig template not being selected by Drupal?

texts:
So I have a custom module that has boilerplate template code inside it. No problem there. So I following the Drupal Docs which says to create a service.yml file and turn debug on and caches off. Done.

Now i'm able to view the debug info in my browser which shows which template is being called. So I copy the file field.html.twig and all its content's, create a new template that is 2 layers up from the suggested template names (field--parent-task.html.twig), and paste the code in there. So far nothing has changed other than file name only.

Now however, when I attempt to reload the page and clear my caches, it still defaults to the most generic and default template. Why does it not load my more name specific code in my custom module? Do I need to make any changes inside the file itself before it will load it?


texts: Webform address country field alter default error message (An illegal choice has been detected. Please contact the site administrator.) when is empty

texts:
I'm working on a D8 project and I have a webform where I use webform_address type fields.

If the country (which is a mandatory field) in those fields is empty I'm getting the generic error "An illegal choice has been detected. Please contact the site administrator.".

Is there any way to change it?

I tried to use the hook_webform_element_alter in order to add custom validation in my field but the country is a subfield of address field.

Any thought/idea/solution would be valuable!

Thank you in advance.


texts: Changing colors per page through drupal interface

texts:
Using Content type: News, I have created pages NewsItem1, NewsItem2

I would like to have a background and color blue to NewsItem1 page
and set the pink background to NewsItem2 page through Drupal admin. Is that possible?

I am using Drupal 8.5 version. I think themekey module allowed to do this but it is not available for D8. I couldn't find any other easy way to do this. Any suggestions? Thanks in advance.


texts: How to apply a Field Formatter to a node field programmatically?

texts:
I have the following code to get the value that is stored in a field

$nid = 76;
$node = \Drupal::service('entity.manager')->getStorage('node')->load($nid);
foreach ($node->field_aaaa as $delta) {
  dpm($delta->value);
}

With this I can get the correct value let says:

 * id_string1
 * id_string2
 * id_string3

But my field has a Field Formatter named title_formatter that will take the string id_string1 and will show something like this:

String 1

In the UI this works fine if I chose my Title Formatter (title_formatter) for the field I can see the 'String' when I viewing my node.

But how to apply the Field Formatter programmatically to the field values?


texts: How to change head title of a page having a Omega 4 subtheme?

texts:
I'm trying to implement this: http://ryanissamson.drupalgardens.com/blog/html-node-and-view-title to add the possibility of having HTML injected in node titles. It works great for the node titles in the pages and the views.

But there's something I cannot accomplish: the "$head_title" part. I can't change the text of the title showed in the browser tab, so, assuming that I have a mid-italic title like "Title", in the browser tab it shows something like "Ti[i]tle[/i]".

I think it's because Omega 4 uses the Layout system, that works perfect, and we don't have to override page.tpl.php, as seen in How do you override page.tpl.php in Omega 4?

Here people say to this guy to disable Layouts, but for me that's not an option at this moment.

Any ideas? Thanks.


texts: Drupal commerce cart not working after upgrading from kickstart-7.x-2.9 to 7.x-2.20

texts:
I have a site using the commerce_kickstart-7.x-2.9 install profile (Drupal 7.22). Updating the site was long overdue, so being cautious I decided to do the update on a new server with a domain name I bought just for testing. I put extracted the up to date copy of kickstart commerce (kickstart-7.x-2.20) on to the server. Then I added in my modules and themes into sites/all. I needed to uninstall the securepages module as it was forcing the login page to go back to the old site.

The core upgrade seemed to go fine. I could see my site working. However I could not add items to the cart. The Item added successfully dialogue box shows, but nothing is actually added to the cart. I updated all of my contributed modules to see if this might help, but it didn't.

The new copy of the site does not have an SSL certificate yet, so I will either need to move the SSL certificate or apply the updates on the live copy of the site. However I am very keen to get to the bottom of why items can no longer be added to the cart before I apply any changes to the live site.

Why has my cart stopped working after the upgrade and what can I do to fix it? Any help would be appreciated. Please let me know if there are any troubleshooting steps I can take to provide further information.


texts: Defining the primary address of a CiviCRM contact

texts:
I have a webform with CiviCRM fields on it (webform 7.x.4.1, civicrm_webform 7.x-4.9).

I have configured 2 addresses fieldset, one for work address and one for home address.
I find it non intuitive to let the user choose the location for each address and set the first one as the primary. So i have instead defined one field that let the user choose which one is its primary address (simple select field with Home or Work value).

Now, i need to synchronize this with CiviCRM after the form is submitted. I use hook_webform_submission_insert and hook_webform_submission_update.

My question is : what is the best way to define which address is the primary for a contact (the address are already saved in the database). Api ? other ?

Alternative question : maybe there is another (more simple) way to do the same thing ?


texts:
I am using the simplenews module in order to create newsletters and enable users to subscribe to those. By following the instructions in the readme file it says:

Enable new content types to use as newsletter:
Structure > edit content type > Publishing options

What I did, I created a new content type and in the Publishing options I enabled the "Use as a simplenews newsletter" option.

Is this correct? Or should I have gone into one of the existing content types and selected this checkbox instead?

Also,
ENABLE SIMPLENEWS BLOCK

With the Simplenews block users can subscribe to a newsletter.

Enable a Simplenews block per Newsletter category:
Structure > Newsletters > edit newsletter category

In my block structure I have the following available to me:
Newsletter: Multi Subscription
Newsletter: Newsletter

Enabling Newsletter: Newsletter displays nothing. SHould it?
Enablinb Newsletter: Multi Subscription displays an option of subscribing to available newsletters. But I only have one newsletter so it's a bit misleading.

What settings have I stuffed up in order for the Newsletter: newsletter block to not display anything, but to instead have a multi subscription block?


texts: How to theme a flag for different pages?

texts:
I want to theme a flag for different pages like on user profile page the html of the flag will be different then on the view page . I can make  use of the flag.tpl.php and theme it but, I don't how to theme it for different pages.

Any suggestions?


texts: Set workbench_access taxonomy term to active

texts:
We're using workbench_access to separate content by taxonomy and when my customer adds a new term and tries to assign a role to it, is unable to find it in the list under admin/config/workbench/access/roles

To solve issues with permissions we've opted to set the module to "Generate automatic URL alias". When we create the term, that option is selected and unavailable as expected by this doc page:
https://www.drupal.org/node/1171382

I've cleared the cache and can see my new term in the admin/structure/taxonomy/myterm page.

It appears that the module in the auto mode is filtering using the workbench_access_editors() function which shows it in the list but not under the "active" flag, so it does not appear in the workbench role page.

I've looked and searched but it's not clear how to get this taxonomy term to be "active" so workbench can automatically load this term?


texts: Render an HTML element before the menu with hook preprocess menu

texts:
I want to render an HTML element like This is my menu before my menu. I thought the most easy solution is to alter the menu. I already altered my menu to add a class. But how do I add an element before my menu with a hook preprocess function?

I know I can extend menu.html.twig to menu--my-mwnu.html.twig and add it there but I think it's less overhead to add it with a preprocess function.

/**
 * Implements hook_preprocess_menu().
 */
function mytheme_theme_preprocess_menu(&$variables) {

  if (isset($variables['menu_name'])) {
    if ($variables['menu_name'] === 'my-menu') {

      $variables['attributes']['class'][] = 'my-menu';
    }
  }
}


texts: Send email to user on new term save depending on flagged content

texts:
I have a content type 'my_content' with two nodes. These nodes can be flagged by each user (NOT global flag) with the flag 'my_flag'. This content type has a field 'machine_name'.

Now, using feeds I'm importing some content from xml to another content type that has also a field machine_name and one of the fields is a taxonomy term that is created if it doesn't exists.

What I want is to send an email to the users who flagged the nodes of 'my_content' whenever a new term is created.

Example:

### 'my_content' ###
nodeA:
machine_name = Sidney
flagged = true

nodeB:
machine_name = London
flagged = false

Feeds imports an xml and creates a new taxonomy term. It also creates content where one of the fields is the machine_name. If that machine_name is 'Sidney', the email should be sent. If it's 'London', the email is not sent because nodeB is not flagged.

I think rules is the way to go but I'm unable to get the two conditions I need to have that are, a new node is created and a new taxonomy term is created.


texts:
I am inserting nodes from an external application into Drupal (7.x). I've taken care of the node_revision table and other tables needed by Drupal to see the node. However I have pathauto installed and it does not recognize the node as new as per this link. So my question is, how does Drupal/Pathauto determine if a node is new or not?

Obviously I can't use the $node->is_new property, cause I am doing the inserts from a Zend application. I just want Pathauto to check the Automatic alias checkbox by default.


texts: Separate page for payment methods selection in drupal commerce

texts:
is there a way to have a separate page for payment method selection, to allow clients to select the payment method they want to use instead of the current way drupal commerce use (integrating payment selection in the review order page)?

Thanks in advance for your support.


texts:
I've got a simple form which I've added a little AJAX to. The form simply let's people add users to a list. That is, I've got a textfield where people can enter an e-mail address, and that e-mail address gets added to the list.

Now, the "Add" button is AJAX enabled, meaning that the add request gets posted as an AJAX request. However, I would then like the AJAX callback function to render the form again so that the newly added user appears in the list. However, I can't really see how I should do this.

I've tried to build the form ("from scratch") using drupal_get_form() in the AJAX callback function and then return that form, but that does not work. It just gives me the error :

Notice: Undefined index: form_build_id in /home/playground/www/public_html/includes/ajax.inc on line 320

How should I go about when I would like to rebuild the form from the very scratch as a part of the AJAX request, and then return that form?


texts: How to conditionally load - and allow a user to populate - a taxonomy image field in node create/edit form?

texts:
pardon the bad headline. I have a node with a autocomplete taxonomy field "categories". When a user creates a node, he can add a single term/category to that node.

How would you make it possible to also attach an image to that taxonomy in the same "create" or with ajax?


texts:
i try to include a node creation form by a field attach form. So i try to load the entity of a custom content type created by the back-office with is called 'friterie'. But when i call the entity_create function i get this error : Call to undefined function entity_create()

Here is my code :

function fritr_register_friterie_form($form, &$form_state) {
    $form = array();

    // INCLUDE FRITERIE ADD FORM
    $form['friterie'] = array();
    //module_load_include('inc', 'node', 'node.pages'); this is an old method
    //$form['friterie'] = node_add('friterie');
    global $language;
    $entity = entity_create('node', array('type' => 'friterie', 'language' => $language->language));
    //$form['friterie'] = field_attach_form('node', $entity, $form['friterie'], $form_state);

    // INCLUDE USER REGISTER FORM
    //$form['user'] = drupal_get_form('user_register_form');

    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Enregistrer la friterie'),
    );

    dsm($form);
    return $form;
}

I don't know why i get this error, i watch on the official documentation and it says i can do it like i did :/


texts: How to enable users to add content only from some pages (and only once) in  Drupal 7

texts:
i currently need to implement this use case in drupal.

We have two different type of users: registered users and moderators.

I need to do the following:

registered users can add only one
particular content type: videoCV (no
help needed on this subject)
registered users can add this content
only from a pre-definite page called
"Create you Video CV" (the page is
accessible in the main menu) and only
once
moderators can add contents wherever
they want.

so i need on these points:

how to limit to registered users the
possibility to add content only on
one page?I mean have the link add
new content only on that page? (and
also change that link so that it
reads add your videoCV
how to limit users so that they can
add just one content?

any help is appreciated, i think i can solve point number 1 withouth particular coding, but i think i need to create a custom module for point number 2, that is no problem!


texts: getting Drush to cooperate with Mercurial

texts:
I just tried to update a site on my local machine from Drupal 7.14 to 7.15 with "drush up". I use Mercurial (hg) for version control. (I know that most Drupal sites use Git, but we standardized on Hg before we started working with Drupal.)

I was surprised to see that the update process pretty much hollowed out the .hg folder, which is where Mercurial stores all of its information. I got the following warning from drush:

rmdir(C:/Dev/mysite/.hg): Directory not empty filesystem.inc:141

Is there something I need to do to tell drush to please leave that folder alone? I googled this issue and didn't find anything helpful.

[update 08/29/2012]
I thought I'd post an update to this, since I still haven't solved the problem.
I tried to update a fairly vanilla test Drupal site from 7.14 to 7.15 this morning, and got the same error. Drush failed to update Drupal, and pretty much destroyed the .hg folder in the process. Here's a full dump of the messages from Drush as it did this:

    Code updates will be made to drupal core.
    WARNING:  Updating core will discard any modifications made to Drupal core files, most noteworthy among these are .htaccess and robots.txt.  If you have made any modifications to these files, please back them up before updating so that you can re-create your modifications in the updated version of the file.
    Note: Updating core can potentially break your site. It is NOT recommended to update production sites without prior testing.

    Do you really want to continue? (y/n): y
    rmdir(C:/Dev/drupal-7-test/.hg): Directory not empty filesystem.inc:141              [warning]
    string(2) "\037ï"
    array(1) {
      [1] =>
      int(35615)
    }
    string(2) "\037ï"
    array(1) {
      [1] =>
      int(35615)
    }
    Destination directory C:/Dev/drupal-7-test/drupal-7.15 already exists.                 [error]
    Project drupal was updated successfully. Installed version is now 7.15.
    Backups were saved into the directory                                                     [ok]
    C:\Users\ahuey/drush-backups/drupal_7_test/20120829131850/drupal.
    Backups were restored successfully.                                                       [ok]
    rmdir(C:/Dev/drupal-7-test/.hg): Directory not empty filesystem.inc:141              [warning]

I'm running Drush 5.5. I'm OK with having to update Drupal manually for now, but it's a weird problem, so I may spend some more time on it, if I can spare the time.


texts: Creating Nodes Of A Content Type on-the-fly While Creating A Different Content Type

texts:
Exposition

On a Drupal 7 site I have two Content Types with the following fields:

Scenes

Scene Name
Starring (Actor's names)
Streaming Link

Releases (DVD Releases)

Title
Description
Starring (All actor's names from all Scenes referenced)
Multiple Scenes (Entity references to the Scene Content Type)

My Question

Is there a Drupal 7 module or some technique that will allow me to create new Scene nodes on-the-fly while in the Create Release (node/add/releases) form?

Avenues I Have Explored

Field collection (No way to set Scene Name or Create separate nodes)
Node Reference + noderefcreate (Creates blank Scene without prompting for the fields)
Inline References is an abandoned Drupal 6 module that looks like it was meant for using with nodrefcreate to add the other fields like I want.

The Solution

Thanks to Clive's Answer, I've found Node Connect which is exactly what I needed.


texts: Complicated module update error HTTP error 0

texts:
I'm recently getting the error below:

  HTTP error 0 occurred when trying to fetch https://ftp.drupal.org/files/projects/captcha-7.x-1.5.tar.gz.
  Downloading updates failed:

  Failed to download captcha from https://ftp.drupal.org/files/projects/captcha-7.x-1.5.tar.gz

  Blockquote

I'm running my website on a shared platform, so I can't change the parameters of PHP...

Based on this long thread drupal dot org/node/247009 I have already tried several many potential solution with no luck so far. This is what I tried and it did not work:

gave 777 recursive permissions to tmp and site/default/
tried on different browsers (Edge, Firefox, Chrome)
in jquery update module I changed the jquery default version to 1.10
I set the jquery source from google, and I set the jquery to non-minified
I checked and in settings.php I do not have any base url set
the file which failes to be downloaded is very small in size 103KB, so I
    guess it's not about uploading to large files
I checked my PHP version and it did not change recently it;s 5.3.29
I also checked the PHP memory limit and it's set to 256MB which to me it's not that low for uploading a 103KB file
I I tried the update of a different module, and I get the same error

What could be the problem? Where to look next?


texts: Why the system enter two times in an hook_node_presave?

texts:
I've write a simple module for my sites, where I populate a node reference by code.

I use hook_node_presave, but I notice that drupal enters TWO times in this hook, so if my node reference field is multiple, it populates it two times.

Is there something wrong on my code or is normal?
In the presave hook I've to load another node and then save it

I have something like this:

   function alterator_node_presave($node) {
      if ($node->type == 'partner_progetto') {
        // here I load a node "progetto"
        // that is referenced on my partner_progetto node
        $progetto = node_load($node->field_progetto_rif['und'][0]['nid']);

        // here I load another node "soggetto"
        // that is referenced on my partner_progetto node
        $soggetto = node_load($node->field_soggetto['und'][0]['nid']);

        // then I've to fill a node_reference in the node $progetto,
        // using the nid of $soggetto
        $progetto->field_soggetto_ref['und'][]['nid'] = $soggetto->nid;

        node_save($progetto);
      }
   }

In this hook the system enter 2 times, so when I save a "partner progetto" node that has a reference to the node soggetto with nid '150' I've that the "progetto" node has this structure:

$progetto->field_soggetto_ref
  ['und']
    [0]['nid'] = 150,
    [1]['nid'] = 150;

The value of this field is filled two times.


texts:
I'm using Commerce License and Commerce Files to sell digital downloads (zip files). Usually this works completely fine, so I'm thinking this might be a bug on my site on not in the modules themselves - but I'm not sure.

On one specific product the file description (and therefore the download link) doesn't appear on the user's file tab.

The orders that needs to download are in 'pre-order' paid state (using Commerce Pre-oder, which isn't a problem on other products on our site.

Here's the pre-order rule in case that's causing this:

{ "commerce_preorder_checkout_complete_generate" : {
    "LABEL" : "Generate pre-order pending orders on checkout completion",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "10",
    "OWNER" : "rules",
    "TAGS" : [ "Commerce Pre-order" ],
    "REQUIRES" : [ "rules", "commerce_preorder", "commerce_checkout" ],
    "ON" : { "commerce_checkout_complete" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "commerce-order" ], "field" : "commerce_preorder_order" } },
      { "data_is_empty" : { "data" : [ "commerce-order:commerce-preorder-order" ] } }
    ],
    "DO" : [
      { "commerce_preorder_generate_pending_orders" : {
          "USING" : { "commerce_order" : [ "commerce-order" ] },
          "PROVIDE" : { "pending_orders" : { "pending_orders" : "Pending orders" } }
        }
      }
    ]
  }
}

Any ideas as to how to investigate the issue?


texts: How to change order currency in cart/checkout page?

texts:
I want to change the price of the order in the cart/checkout page.
Let's say I have a product ABC with $100(USD) and I added that in cart. But after adding I want to change the currency to EUR and proceed with the checkout process.
I tried to change the currency and amount in order like below:

$order = commerce_order_load(1234);
$amount = 100;
$order->commerce_order_total['und'][0]['amount'] = round($amount,2);
$order->commerce_order_total['und'][0]['currency_code'] = 'EUR';
$order->commerce_order_total['und'][0]['data']['components'][0]['price']['amount'] = round($amount,2);
$order->commerce_order_total['und'][0]['data']['components'][0]['price']['currency_code'] = 'EUR';
commerce_order_save($order);

But when I refresh the checkout or visit cart page, it's still in USD.
So I need help in changing the currency of order based on user input in cart/checkout page or based on the field (currency) which admin has created for every product.


texts: Drupal 7: how to redesign, move stuff around, for a content type page?

texts:
If when creating a View, I create a list of a specific content type, let's say Staff. It lists everyone from the Staff content type. I have this setting too: Link to the original piece of content. Then I get a list of content type labels and content type data. How can I rearrange everything? How can I edit the HTML?

I don't want to create a view for a specific content type, I want to redesign (edit HTML) the content type page, example: domain.com/node/5


texts: How can I print taxonomy id of a blog category field in a node

texts:
Please, how can I print the taxonomy id of a blog category field in the node template?
Using {{ content.field_category }} prints the term name but how can I get the unique term id instead?


texts:
When anonymous users are registering and creating a group - the field:

Determine if this should be a group.

Shows up on registration.

In the field settings on the content type I'm using I have the values checked to "Hide" this portion.  I've even hid the values on Manage Display.

Screen shots attached.  All I want to do with is hide the field to NOT show to users.  There's no reason for this field to be visible in my scenario.

I don't want to hide it with css if at all possible.

Any guidance is appreciated.


texts: context block visibility - disable block for certain role

texts:
I use drupal 6. I want to show a block for all users (anonymous, authenticated, all roles) except role XY and some paths.
I use context module where it is easy to set path rules. However, setting rules does not work - I want to disable block for role XY but enable it for all other authenticated users. So I check all roles I have + authenticated users and leave role XY empty. This way it does not work, probably drupal thinks that all authenticates are all roles.
What would be the way of achieving this? Thank you.


texts: Is it bad practice to track all in the configuration module

texts: I am taking over a site that was built without configuration management, I installed the configuration module for the first time (I am used to using features). I am wondering if it is bad practice to just select all in all the categories and track all the available configurations instead of trying to cherry pick the applicable ones. What are the effects of performance, etc.


texts: How do you structure and use arguments in a view using the Views UI in Views 3


texts: Set default value with PHP on a node field.

texts:
I'm using Drupal 7 and have created a content type called abc. In abc there is a field called seller. When a logged in user creates a new piece of abc content, the value of the seller field would be the name of the person who is logged in.

So what I want is a default value for the seller field for a small piece of PHP code. But I am not able to find the place to enter this PHP. In Drupal 6 there is text area for the php code to enter, how can this be done with Drupal 7.


texts: Preprocessing a front page block causes errors on other pages: why?

texts:
I'm currently working through self-set tasks to learn Views and pre-processing in Drupal 7. I've created an unformatted view which creates a list of images (which are linked to a content-type but it seems if I replace the fields in view with node:type then I get a link to the node page which is not what I'm after) to place them in a block. I've placed the block into the highlight region and have written a views-view-fields--image.tpl.php file to output the list into various unordered list formats which are then transformed by jCarousel or the featureList jQuery plug-ins.

On top of this, I've created a page--front.tpl.php file to restyle the front page and it appears to work in that the CSS, js and HTML are working correctly and the carousel and lists appear & work in the defined block.

However when I leave the front page to another page where the view should not appear, I get the following error:

  Notice: Undefined property: stdClass::$_field_data in iaintest_preprocess_views_view_fields() (line 10 of /Applications/XAMPP/xamppfiles/htdocs/drupal/sites/all/themes/iaintest/template.php).

To pre-process the list that the view outputs, I've written the following pre-process code:

function iaintest_preprocess_views_view_fields (&$variables) {
  if (!$variables['view']->result[0]->_field_data) {
    // Line 10 where the error occurs.
  }
  else {
    drupal_add_css(path_to_theme() . '/jcarousel/skins/tango/skin.css');
    drupal_add_css(path_to_theme() . '/featureList.css');
    $js = "
      jQuery.noConflict();
      jQuery(document).ready(function(){
      jQuery('#mycarousel').jcarousel();

      jQuery.featureList(
        jQuery('#tabs li a'),
        jQuery('#output li'), {
          start_item: 1
        }
      );
    });";

    drupal_add_js($js, 'inline');
    $items = array();

    foreach ($variables['view']->result as $key => $vars) {
      foreach ($variables['view']->result[0]->_field_data['nid']['entity']->field_images['und'] as $k => $v) {
        $variables['carousel'][] = array(
          'uri' => $v['uri'],
          'alt' => $v['alt'],
          'title' => $v['title']
        );
      }
    }
  }
}

I have tried using drupal_is_front_page() or $variable['is_front'] === TRUE to limit this part of the preprocessing to the front page, which is the only place where the original view appears.

Is this possible at all, or have I misunderstood anything?


texts:
How to translate "Sort by" region of the KickStart commerce into Russian?

Need to completely translate KickStart commerce. Are there any ways except translating the core and searching for .po for an every single left module?


texts: Template suggestions for page on specific node id

texts:
I created 2 nodes of the content type page for which i want to create a custom template file.
In the theme_hook_suggestions array there is an element with 'node__821' so i created the file node--821.tpl.php but it doesn't work.

I also tried page--node--821.tpl.php, this works in that it uses the file but this replaces the page.tpl.php and thats not what i need.

According to http://drupal.org/node/1089656 my filenames should work, but since they don't anyone an idea why? Could it have something to do with the page content type?


texts: How to embed a view in hook_page_build()

texts:
I'm trying to render a view into a region in hook_page_build().  I'm using views_embed_view(), but I'm getting the errors:

  Warning: Invalid argument supplied for foreach() in element_children()
  (line 6428 of /var/www/.../includes/common.inc). Warning: Illegal
  string offset '#children' in drupal_render() (line 5893 of
  /var/www/.../includes/common.inc). Warning: Illegal string offset
  '#children' in drupal_render() (line 5903 of
  /var/www/.../includes/common.inc). Warning: Illegal string offset
  '#children' in drupal_render() (line 5941 of
  /var/www/.../includes/common.inc). Warning: Illegal string offset
  '#printed' in drupal_render() (line 5948 of
  /var/www/.../includes/common.inc).

I have a view named 'blogs' and a view named 'block_2'.  In my hook:

function mymod_page_build(&$page) {
    $page['sidebar_second']['blogs'] = views_embed_view('blogs', 'block_2');
}

I'm trying to move away from blocks and context, and just render content I'd otherwise use in blocks directly into their regions in hook_page_build().


texts: how to add more button/link to the feeds in drupal7

texts: I have more than 10 feeds in my website and I want to display them 3 items at a time. When I go to site information and change the items per page to 3, I see the 3 items and the pagination controls added. Now I want to add a more button/link instead of the pagination controls.


texts: Ckeditor Allow all html tags and disallow a few

texts:
By default Drupal provides a form under text formats to allow some html tags, then it will disallow anything not in this allow list. I would like to do the opposite of this. Allow all html tags then disallow just a few tags.

I am using this custom hook to disallow html tags

mymodule_editor_js_settings_alter

then I am placing the tags I want to disallow like all h1 class names

$settings['editor']['formats']['rich_text']['editorSettings']['disallowedContent'] = 'h1(*)';

But I have to supply a list of allowed html tags in the drupal GUI under text formats. So I need to allow h1 id and styles. What I want to do is to allow all h1 tags by example and then disallow 1 thing. I read this is possible here under the section "How to Allow Everything Except…"
https://ckeditor.com/docs/ckeditor4/latest/guide/dev_disallowed_content.html#how-to-allow-everything-except
This page offers an example array. I tried to add this to my hook but I get a syntax error.

I tried this and it seems to be working. In the hook below I am allowing h1 and h2 and any attribute, style and classnames, but then I disallow the h1 class name of "myHeader2"

use Drupal\Core\Form\FormStateInterface;
use Drupal\editor\Entity\Editor;

/**
 * Implements hook_form_alter().
 */
function blank_moda_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if ($form_id == 'node_page_form') {

  }
}

function mymodule_editor_js_settings_alter(array &$settings) {
  foreach ($settings['editor']['formats'] as $name => $value) {

    $settings['editor']['formats']['rich_text']['editorSettings']['allowedContent'] = array(
      '$1' => array(
        'elements' => array('h1'=> TRUE, 'h2'=> TRUE),
        'attributes' => TRUE,
        'styles' => TRUE,
        'classes' => TRUE,
      ),
    );

    $settings['editor']['formats']['rich_text']['editorSettings']['disallowedContent'] = 'h1(myHeader2)';
  }
}

Now I need to prepare a full list of all the allowed elements I want. Then I can start disallowing specific attributes, styles and class names.


texts: How to show a node but return HTTP 404 response

texts:
I want to show an existing page(node) normally but return a HTTP404/410 etc instead of HTTP200.

How can I do it? Is there any simple way to do it?


texts: How can I remove 0 & negative values(-1 to -100) in weight module section?

texts:
I want to remove 0 and negative values (-1 to -100),so need to display only 1 to 100 items only  in drop down list .

How can I achieve this?


texts:
I migrated Wordpress to Drupal 7 using wordpress migrate

What does this mean unprocessed -444?

Is that I have 444 articles are failed imported to Drupal?


texts:
I am getting "page no found" errors in my website log. Maybe it is some bots that search for  directories that do not actually exist. I get at least 50-100 daily of these messages.

The log says, for example:

  www.mysite.com 46.29.3.237 - - [14/Jan/2013:17:02:33 +0100] "GET /files HTTP/1.1" 200 683 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17"

How is it possible to get rid of that? I am just worried if there is problem on my side or it happens to any site. Thank you.


texts: How can I run client side validation before a Drupal AJAX submit call?

texts:
I'm trying to perform client side validation using jquery.validate.js on a form submitted via Ajax (using form actions), but for some reason, the client side validation is not being triggered.

This is what I have in my template.php file in order to trigger an ajax call for login:

$form['actions']['submit']['#ajax'] = array(
    'callback' => 'fantasia_user_login_ajax_callback',
'wrapper' => 'user-login-form',
    'event' => 'mousedown',
 );

And here's my js to trigger the client side validation:

(function ($) {
Drupal.loginAjax = {
    form_id: 'user-login-form'
};
Drupal.behaviors.loginAjax = {
    attach: function (context ,settings) {
         Drupal.loginAjax.beforeSubmit = function (form_values, form, options) {
                $("form#user-login-form", context).validate({
                    rules: {
                        edit_pass: "required",
                        edit_name: "required"
                    },
                    messages: {
                        edit_name: {
                            required: "E-mail Address is required"
                        }
                    }
                });
        }

        for (ajax_el in settings.ajax) {
            if (Drupal.ajax[ajax_el].element.form) {
                if (Drupal.ajax[ajax_el].element.form.id == Drupal.loginAjax.form_id) {
                    Drupal.ajax[ajax_el].beforeSubmit = Drupal.loginAjax.beforeSubmit;
                }
            }
        }

    }
};
})(jQuery);

The beforeSubmit method is being triggered because when I print to the console, I do get a value.

On a sidenote, I've tried doing this using the beforeSend instead. The client side validation does trigger, but the submit is not being halted.

Any pointers please?


texts: How do I set a multi-value list to my multi-value field with feeds?

texts:
I am running into the issue with my Feeds where when a field can accept more than 1 value and has more than 1 value, it throws a error saying its not able to find the 2nd item (and so forth) listed. It only finds the first.
I use Feeds tamper and used the explode function. This helped it with locating the first value as I no longer get field.value.0 errors, but I do get field.value.1 (and so forth) errors.
I double checked to make sure the field accepted unlimited values and the key-value pairs were correct, so why isn't it working?
I just keep getting the error, the value you have selected is not a valid choice.
field_target_member.1: The value you selected is not a valid choice.
field_target_member.2: The value you selected is not a valid choice.
field_target_member.3: The value you selected is not a valid choice.


texts: Drupal commerce auto login during checkout process

texts:
I have created a e-commerce site, in that when anonymous user purchase a product during checkout process it should automatically created a account and assign order to the user. For existing user it should it should log in and assign order to him. Is there any module to do this or else how can achieve this.

I have tried https://www.drupal.org/project/commerce_checkout_complete_registration it works fine for new user. When I enter existing user email site goes to Maintenance mode.


texts: How to remove custom module provided entity instances by the time the module being uninstalled?

texts:
I have the following use case:

I have a custom module, which defines a custom entity type.
The custom entity type has some content in the database.
Module needs to be uninstalled now, but it can't, since "There is content for the entity type" (which is true, there is content)
How to extend the uninstall process of the module to first remove all the content instances and then do the rest?

I tried hook_uninstall, but that didn't help. Any ideas?
Content can't be uninstalled by hand! (bigger project issue)


texts:
I want add link field (label + url internal/external) in custom form

This not work:

$form['test_ink'] = array(
  '#type' => 'link',
  '#title' => $this->t('Link title'),
  '#url' => '',
);


texts: Make support ticket subscriptions visible by default

texts:
I have a Drupal 7 site using the Support Ticketing System module. When viewing a ticket, the client would like the Subscribed fieldset (id="edit-subscribed") visible by default. Currently it is collapsed, and you have to click on it to expand the field.

This problem is similar to a previous post, where hook_form_BASE_FORM_ID_alter() allowed me to expand the Subscribed field by default when the ticket was being edited.

But when viewing the ticket, the form in question is the comment-form, and I can't find the right array to target the edit-subscribed fieldset, if in fact the hook_form_alter is the right way to do this.


texts:
How to make the cart menu display the number of items added?

Example If I added one item, the cart menu will display "one".

Module: Drupal Commerce


texts: How to pass field data from custom node type to webform block?

texts:
I'm using the Webform module's block on custom content type.

The webform has some text fields and I want to pass some data from my custom content type fields to webform fields.

I tried to add a default value by using tokens but it didn't work ([node:custom_content_type_custom_field] is shown on the available tokens but didn't work).

How can I pass field data from current (custom) node to webform block?


texts: Map array of node IDs to bundle types without loading all the nodes

texts:
For complicated reasons I need to map an array of node IDs to a list of node bundles. That is, for a given list of node IDs, I need to get all the different bundles (node types) of the nodes the IDs belong to. The simple approach would be to load all the nodes, map that to their bundles and using array_unique to get the final list. Unfortunately, this is not a good solution because there may be hundreds of IDs in the array and loading all those nodes will result in a bad performance hit and/or go over the memory limit.
What is the best way to map an array of node IDs to (unique) node bundle types? Is there something built-in or does this require a custom database query? If so, I would be grateful for a dynamic query I could use for this (we're using MySQL). Thanks!


texts: "IMCE Uploader" module is preventing some file types from being uploaded within IMCE

texts:
I have downloaded and enabled the "IMCE Uploader" module at https://drupal.org/project/imce_uploader

This module allows you to within IMCE to upload multiple files at one time and is working better than the "IMCE plupload" module which I have found has corrupted some files after uploading.

I have configured the Media browser settings at /admin/config/media/browser to include a lot of file types (including jsonp, docx and xlsx) and without having the "IMCE Uploader" module enabled they all display when trying to do an upload within IMCE.

After enabling the "IMCE Uploader" and "IMCE Uploader - Plupload" modules I have noticed that some file types like jsonp, docx and xlsx are not allowed anymore when trying to do an upload within IMCE.

Is there any way that I can allow these additional file types to be uploaded within IMCE when using the "IMCE Uploader" and "IMCE Uploader - Plupload" modules?


texts: How to give a roll only access to add a certain content type?

texts:
In D8:
I have a content type call fooCT.
I have a role called:  "fooRole"

I give fooRole the following permissions:

fooCT: create fooCT
use simple editor

So the checkbox: View published content is not checked

A person with this role cannot do anything in the system anymore.

How to give this person only access to add a a fooCT?

I tried several options but do not get the desired result.

Any suggestion?


texts: How to show in a view the total number of paragraphs for a node?

texts:
I have a content type with a field of type paragraphs, with possible unlimited values. I need to show the total number of paragraphs for every node, in a column, in a views (table of fields). It seems to be only possible to render a preview of the paragraph. I tried to use "rewrite result" with "replacement patterns" but the only token available are the following:

{{ field_hours }} == Hours
{{ field_hours__target_id }} == Raw target_id
{{ field_hours__target_revision_id }} == Raw target_revision_id

How I can proceed?


texts: Reuse Block's visibility settings mechanism for custom entity

texts:
I'm on Drupal 8.

I'm writing a module where I want to have custom entity which will reuse Block's visibility mechanism.

I don't want custom block type, I don't want my custom entities to appear as blocks in block system.

I want it to be separate entity type where users will store some third party inline Javascript code and they will have control on where this code might be loaded. (like embedding some third party services).

As in block's visibility settings, they might choose it to load:

On specified paths.
On specified content types.
For specified user roles.

I have tried many things, I already implemented this functionality using custom blocks but in that case I had to alter block system to hide my custom blocks from it.

What I'm looking for now is the right way of extending Block's functionality so that I can reuse visibility settings part for custom entity type.


texts: Is it correct to directly modify a supplied Drupal theme?

texts:
I downloaded and installed the Bootstrap theme for a new Drupal 7.28 site.

Is it correct to simply modify this theme directly to build my site, or should I create a custom theme and somehow "base" it on this theme?

Put another way, is theming analogous to downloading the Bootstrap CSS and overriding selectors, or directly modifying the CSS itself?


texts:
I have a content type with a field_maps whose type is Text (plain, long). I needed to change it to Text (plain).

So I've done this SQL statement:

ALTER TABLE node__field_maps MODIFY field_maps_value VARCHAR(200);

It seems that field_type has changed to VARCHAR(200), but there is still one more problem: On the content type and manage fields tabs, the field is still shown as Text (plain, long).

How do I change it to Text (plain)?


texts:
My collegues and I are working on a Drupal 7 project. From time to time, we need to do a clean install on our machines (to get the latest updates working).
However, when installing the Drupal database, my collegues laptop is much faster than mine, despite the fact I've got the latest and most powerfull laptop (Windows 7 Enterprise, 64-bit and 8GB of RAM).

What causes this lack of performance in installing the new Drupal website? I reinstalled MySQL 5 times, and still I don't see any improvement.


texts: Seeking advice how to tokenise specific views settings (from geofield and geocoder modules) to recognize tokens

texts:
I am seeking advice on best practices to tokenize drupal views filter settings to process tokens and work with the token and token_filter module.
I have asked the specific question here: Steps to create a geofield view proximity search for unrelated content, though i would like to attempt to solve the problem myself which will modify the function of two modules: geofield and geocoder.
Whilst I am seeking a specific solution I anticipate there being a standard approach to tokenizing settings and fields though i do not have any experience currently to do so.
Any help or advice is greatly appreciated.


texts:
I have just set up a very simple site with only Drupal 7 core and a couple of other modules. I just installed ckeditor module and given permission to administer access and change ckeditor appearance, but any change I try to make results in an "access denied 403" message.

Any help welcomed.


texts: hook into third party API after checkout

texts: I wondering where to get started on this, I have ubercart core 6.x-2.10 installed and configured with authorize.net.  after a user purchases a "product" I want them to be registered on a third party webinar site. Where in the code would I start are there any extra modules I should use?


texts: Rules fatal error during update: Call to undefined method stdClass::events()

texts:
What I have tried:

Clear Cache.
Disabled module and enabled it.
Try with registry_rebuild, module_missing_message_fixer, variablecheck modules.

Still getting the below error when I try to run update.php.

Notice: unserialize(): Error at offset 668 of 1298 bytes in \sites\all\modules\entity\includes\entity.controller.inc on line 261
Warning: Creating default object from empty value in \sites\all\modules\rules\includes\rules.core.inc on line 57
Fatal error: Call to undefined method stdClass::events() in \sites\all\modules\rules\includes\rules.plugins.inc on line 767


texts: Why does my admin menu link for my custom module not get created?

texts:
I am creating a module in Drupal 7. The module is working well now, but I doesn't create an admin menu link.

I used the following code:

<?php
function question_mark_menu() {
    $items = array();

    $items['admin/question-mark'] = array(
        'title' => 'Question mark',
        'description' => 'Manage your question mark',
        'page callback' => 'question_mark_page',
        'access arguments' => array('administer question mark'),
        'type' => MENU_NORMAL_ITEM,
    );
    return $items;
}
?>

I tried to clear my cache but nothing works.

What is wrong in my code?


texts: Define a specific page.tpl for a page create from a module

texts:
I have a module witch generates a custom page:

function my_module_basket_menu() {
  $items["my-basket"] = array(
    "title"=>"My basket",
    "page callback" => "_my_basket_page",
    "access arguments" => array("access my_module_basket content"),
  );

  return $items;
}

function my_module_basket_theme($existing, $type, $theme, $path) {
  return array(
    'my_module_basket_page' => array(
      'template'  =>"my_module_basket_page",
      'render element' => 'page',
      'arguments' => array("listeProducts" => NULL, "key" => $key),
    ),
  );
}

function my_module_basket_theme_registry_alter(&$theme_registry) {
  $hooks = array('page');

  foreach ($hooks as $h) {
    // Add the module path on top in the array of paths
    array_unshift($theme_registry[$h]['theme paths'], drupal_get_path('module', 'my_module_basket'));
  }
}

function _my_basket_page() {
  // ...some treatment

  return theme("my_module_basket_page", $liste_produits, $key);
}

All works fine, but the problems start here: I want also to have a specific page.tpl, for example page_my_basket.tpl.php.

I tried to create a function my_module_basket_preprocess_page and change the theme there but the URL path I catch is the node of the page 404. Impossible to catch "my-basket". Any ideas? A different suggestion on how i can make it work?

EDIT

As suggested, i changed the name of my registry_alter function. From here when i look at the url (with a dsm()), i catch the good one, not the 404. So that part is ok.

So now i have to theme two page tpl, one for the page create in the module and a second one to replace  the page.tpl.php The problem is this second page i add a function preprocess in my module :

function my_module_basket_preprocess_page(&$variables, $hook){

    $alias = drupal_get_path_alias($_GET['q']);

    if ($alias == "my-basket") {
      $variables['template_files'][]  = 'page_my_basket';
    }
}

In my hook_theme function, i have that :

function oxo_wedze_basket_theme($existing, $type, $theme, $path){

  return array(
    'my_module_basket_page' => array(
      'template'  =>"my_module_basket_page",
      'arguments' => array("listeProducts" => NULL, "key" => $key)
    ),
    'page-my-basket' => array(
      'template'  =>"page_my_basket",
      'render element' => 'page'
    ),
  );
}

And that don't work, i still get the standard page.tpl.php


texts: How can I fallback to one field in absence of another

texts: How can I make one field show up, unless it has no value, in which case another field is shown? I want to do this on the default node view, I already know how to accomplish it in views. I'm assuming it will mean coding something in my theme, but where best to do that is a little confusing to me.


texts: Programmatically customise fields in node views

texts:
I'm developing a module that exposes a node type (by the usual hook_node_info() and hook_install()) and a set of custom fields.

I would like to programmatically define what/how those fields have to be shown in the node views (at least "full"). For example: the field XYZ should be hidden in the "full" mode, and the field ABC should have the lable inline (I'm able to do this by UI, but I would like to define it programmatically).

In any case my need is to exactly modify the view mode (not to always hide a field), in order to allow users to modify the default visualisation way after installation, if necessary.

I can't figure what hook I have to implement, or what code I have to write in the hook_install.

Thank you for your help


texts: Use Webform Results in another webform content type

texts:
I am creating a website for my department at work using Drupal 7. I have a webform designed in a page named Registration in the website. When a user fills this form in and submits, it  sends a confirmation to me. I am also able to view the submissions using the Results tab in the webform using admin rights.

Now I am creating an other page(named 'approve request') for an editor role who approves the submission of the user. This Approve request page has been created in the content type that enables the webform. Now, I need the webform results from the Registration page to appear in the Approve request page. This will enable the Editor to view the Registration results and approve them.

How do I retrieve the results from the registration page to the Approval page? I looked at various sources and could not find a good answer. Please let me know.

Thanks in advance!


texts: It is possible to change MEDIA_RESOURCE_URI_DEFAULT ('public://') to just a specific subdirectory from 'public://' URI?

texts:
I created an 'image field' with 'media file selector widget', at "Allowed URI schemes" just 'public://' and a subdirectory "article-media".

When I click to "Select media", I want to appear in my "Library" tab only pictures listed in this subdirectory ("article-media").

Is this possible?

Thank you.


texts: How State is specific to the specific environment, when its actually pushed to all environments with DB sync?

texts:
I am working with a Drupal 8 setup when production, test and development environments which periodically sync database. In Drupal 7 it was easy to override the $conf variables in settings.php to force a site in maintenance mode. However, in Drupal 8, the maintenance_mode is not a configuration anymore, but a state that is not possible to override from settings.php, so we have to use additional drush command after each sync to put one of the environments to maintenance mode.
And I am confused how come State API documentation asserts it's environment-specific, when in fact, it gets synced together with database and it is not easy to keep environment-specific settings using State API.
On the contrary, $config is easy to override in settings.php (which is excluded during sync), so it does provide easy way of setting environment-specific configurations.


texts: Enable Relationships in Views with Entities?

texts:
I am creating some custom entities and one of them will need to contain a helper table to store a lot of data against one entity (event dates, prices, and tickets left). This is not a Commerce based app, we simply need to display the data appropriately as we receive it all from a third party service.

What I would like to do is rewrite the Entity implementation and not use Fields, but store this all as Properties, which will require its own table and fields with the proper foreign key back to the main Entity. Currently, it is all stored in Field Collections, which can be difficult to work with (Importing/Exporting the entity, or installing/uninstalling the module- FCs are just hard to script, attach, and add fields to in my experience).

So, assume:

entity
entity_event

I can get the data in and out fine.

With Views, how do I tell the Entity there is a relationship available here by the ID? When I am searching them with Views, I need to allow a search by date, AND that the event itself has tickets left (tickets wont be a exposed filter).

I assume too, that when buildContent() is called on the Entity to view it, here I attach the additional data from the event table?


texts:
I am wondering how can I provide support for embedding feature. Actually in my application when user creates article/content, I need to take option from user that if his content can be embedded via embed code to some other web sites. For that he selects yes, then, system should display embed code in the article page, by using which, other people can embed this article.

Please suggest is their any module in drupal that helps me to achieve this or some tutorial helping me to achieve this will also be useful.

Thanks for your time.


texts: How can i render webform on custom url with custom html in drupal 8

texts:
Basically I am using sample code which shown in below.

public function test(){

$webform = \Drupal::entityTypeManager()->getStorage('webform')->load('contact_us');
$webform = $webform->getSubmissionForm();
$dd= drupal_render($webform);

return array(
'#type'=> 'markup',
'#markup' => $dd.'

test

'

);

}

I'm using return type markup then form is not rendering properly.So any help available. Thank you all in advance.


texts: How to redefine default theme_image() function?

texts: By default drupal use theme_image() for render images. How to set for render custum function, ex. theme_cus_image()?


texts: Is deactivating modules safe regarding settings?

texts:
I had a strange error after uploading a module to a shared hosting server when going to admin/modules before even activating the module (image_desaturate_formatter).

  PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'sites/all/modules/image_desaturate_formatter/image_desaturate_fo' for key 'PRIMARY': INSERT INTO {system} (filename, name, type, owner, info) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => sites/all/modules/image_desaturate_formatter/image_desaturate_formatter.module [:db_insert_placeholder_1] => image_desaturate_formatter [:db_insert_placeholder_2] => module [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => a:11:{s:4:"name";s:26:"Image Desaturate Formatter";s:4:"core";s:3:"7.x";s:7:"package";s:5:"Field";s:7:"project";s:26:"image_desaturate_formatter";s:12:"dependencies";a:2:{i:0;s:5:"field";i:1;s:5:"image";}s:7:"version";s:11:"7.x-2.0-rc1";s:9:"datestamp";s:10:"1356346648";s:11:"description";s:0:"";s:3:"php";s:5:"5.2.4";s:5:"files";a:0:{}s:9:"bootstrap";i:0;} ) in system_update_files_database() (line 2307 of xxx/htdocs/site/modules/system/system.module).

Now the update module isn't working anymore but just showing the following message, when I try to start the update process manually:

  Failed to get available update data for 27 projects.

Could the module upload error be related to the update module not working?
Is it safe to stepwise deactivate the modules to check if update isn't working due memory issues? Do I loose all the settings I've made?

EDIT/UPDATE:

I have limited access to server logs and there is a

  The timeout specified has expired: ap_content_length_filter: apr_bucket_read() failed

and the "reports" section doesn't show anything except the PDO above.

I now have disabled every module except core and tried to run update in between with no effort. The update module isn't working anymore. Is there something else i could do?


texts: How to rebuild route cache programmatically

texts:
I installed a module quizzard and after uninstallation I am getting this error

Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "quizard.quizard_config_form" does not exist." at /home/paddu008/public_html/core/lib/Drupal/Core/Routing/RouteProvider.php line 190

So how do I rebuild route cache programmatically.


texts: Is there an easy way to define a "global" if isset condition on node.tpl.php?

texts:
I'm using some custom node.tpl.php files with lots of custom fields. For each field I have to write down <?php if (isset($content['field_myfield'])):?> SOMETHING <?php endif; ?>

(It gives error if that field is not set without using if isset condition.)

Is there anyway to define a 'global' if (isset...): instead of adding if condition to each field separately?


texts: Drupal automagically changing password hash

texts:
This issue happened on my  localhost machine while in development but I thought nothing of it since I had multiple drupal projects and was jumping to one another constantly - I figure it was cookies or what not and was constantly resetting my passwords. However I recently went into production and this issue is still occuring.

I have a new drupal site for which I created 2 new users for testing purposes. I realized that after 24 hours or so, the login credentials for these users would not work and I would get :

  Sorry, unrecognized username or password. Have you forgotten your password?

I use these accounts to log in via browsers other than my main one and test the user interface of my production site. After each use I make sure I logout.

I made sure to configure the  $cookie_domain in my settings.php and chmod the file properly but the issue still occurs.

Recently I started tracking the hashes in the user table and low and behold they are magically changing without any human intervention ! What can be causing that ?

Oddly enough, this issue does not happen with the admin account (#1) for which I have yet to logout, and another account which was created but never used. In both cases user_check_password() returns true.

Clearing cache does nothing.

I am running the latest core with latest version of all contrib. modules.
I use SSL everywhere
I have APC and memcache running.
I use a mix of MongoDB and MySQL


texts: Display Image on hover for items in a bullet list

texts:
Using Drupal 7 and I'd like to do the following, have 2 columns, one with bulleted text and the second with an image.

I'd like the image in the second column to change when the user hovers over the bulleted text in the first column.

How hard would this be? Is there an existing Drupal module to accomplish this?


texts:
I'm using Organic-Groups on my site and I would like to represent the unsubscribe from this group link as a tab after the View tab.

I am using the following code:

function mymodule_menu(){
    $items['group/node/%node/unsubscribe'] = array(
    // $items['node/%node/custom'] = array(
        'title' => 'Custom',
        'access arguments' => array(''),
        'type' => MENU_LOCAL_TASK,
        'weight' => 100,
    );
    return $items;
}

That code is copied from a source which works correctly.

Using the original url path (node/%node/custom), the tab shows up as expected.

However when i replace the url path with group/node/%node/unsubscribe, the tab disappears from my node.

Can anyone help me implement my group unsubscribe link as a tab, please?


texts:
I am converting some module from d5 to d7, and in old code there is an update query like this:

<?php
db_query("UPDATE {a_table} SET count = count + 1 WHERE field1 = %d", $some_value);

As we see, it is incrementing a field value (AFAIK it is a mysql feature).
But, if I use new style of update it won't work.

<?php
db_update('a_table')
    ->fields(array('count' => 'count + 1',))
    ->condition('field1', $some_value)
    ->execute();

Are there any workaround within new style of db update without running an extra query to get existing field value to increment it?


texts: Common Custom PHP Library: Drupal 8 and Stand-alone Shell Scripts

texts:
I have a Drupal 8 custom module that contains 5K of php in 10 classes.  This code is production ready for the launch of a new website.

I also have code that runs from non-drush shell scripts.  One example is the creation and distribution of a newsletter that runs from crontab.  This pulls data from Drupal and creates a multi-part (html & plain text) email in multiple languages.

There is overlap between these two sets of code that would like to eliminate.  How can I create a single php code library that can be shared between Drupal 8 and also used in standalone shell scripts?

There seems to be two approaches here:

(1) place all code in the custom module and Include it in shell scripts

I understand how to accomplish the custom module part of this.  I don't know how to do the include into a stand-alone shell script from the Drupal directory.

(2) place all code in an external library and Include it in the custom module, the shell scripts and anywhere else I need it

This approach seems to have more flexibility.  It addresses my original issue of sharing code between Drupal custom modules and stand-along scripts.  It also allows the same code to be used in multiple projects -- separate Drupal 8 installs perhaps for difference clients.

How can I pull a custom php library (not on packalist.org) into my Drupal custom module?  If this is possible, I will likely move most/all of my Drupal and Shell Script PHP code to a common external library that is under github change control.


texts: How to set the language to Swedish when users visit example.se and to French when visiting example.fr?

texts:
I have a Drupal 7 website in 18 languages. The main URL is example.com and 18 other international domains are domain aliases of the main URL (example.de, example.fr, example.se, ...).

The Language detection and selection feature in Configuration currently selects the language based on the path of the URL (example.com/de, example.com/se, ...) but not based on the actual URL extention (example.de, example.se, ...).

How can I set the language to Swedish when users visit example.se and to French when visiting example.fr?

Thanks in advance!

Kind regards, Jan


texts: Leaflet: how to display a unique marker per map

texts:
Normally people want to add multiple markers to a single map. In my case I'm attempting almost the opposite - create two maps from the same content type and using Leaflet assign each a unique marker to each. Try as I might I can't figure out how to do this. Instead, what happens is that both markers are displayed on either map (rather than one per map).

My current setup it like so -

Content type

Has a geofield set to output Lat/ Long coordinates

Page

Two pages based on the above content type (let's call them Page Map A and Page Map B) each have a unique set of coordinates.

View

Individual View block for Page Map A and also for Page Map B. These are set
to output the geofield data

(I originally had one View block and I was hoping that splitting them in two would solve the issue. It didn't.)

Block

In blocks the View for Map A and the View for Map B is set to display only on their respective pages

Both of the Views are ordered by sort date (which might be the source of the problem) and only show 1 item. However, if only one item is set to show then it's always the marker for Page Map B that's displayed. Furthermore, if I increase the display to show 2 or more items then the popup text for both markers will only appear on Page Map B, and there are no popups for Page Map A.


texts: Why so many "page not found" for statistics.php?

texts:
In my Drupal sites, there are many "page not found" for modules/statistics/statistics.php recorded in the log ("Recent log messages" or /admin/reports/dblog).
Many of them were accessed by the admininistrator in the record.
The file exists, of course.

That seems strange to me.  Why is it so?

Note the core statistics module (Ver.7.32) is enabled, and all the three options (access log, Count content views, Use Ajax to increment the counter) in its configuration are enabled.

[Description added]
In the Report page /admin/reports/dblog when I click the links modules/statistics/statistics.php in the Message part, I see (for TYPE: page not found) the LOCATION of http://MyHost/en/modules/statistics/statistics.php or alike, that is, path with the language prefix.  My websites use the path-prefix-based i18n feature.


texts: Let images work properly online and offline (MAMP)

texts:
I just started using MAMP to work offline on my drupal-projects.

Because MAMP and working offline is new to me I started today with a test-website.

I installed MAMP, no problems.

I installed a new drupal 7.30 offline in MAMP, no problems.
I imported the CKEDITOR and IMCE for uploading images, no problems.

I created two test-pages and imported in each page a image using CKEDITOR & IMCE, no problems.

After that i tried to upload my offline website online: backup DB, create a new DB online, imported the offline DB, FTP my files online, change the settings-file for connecting instructions DB.

After all those steps my website was showing up online and i could login. Everything seems to work fine.

But then when i clicked one of the testpages, i saw that my images where not showing up...

When i checked the sourcecode i saw something like this:

When i removed /sweetmorning, and saved that code, the image was showing up again.

What is the best practice to still work with CKEDITOR IMCE and let the images showup offline and also after i put the website online.

Any tips, links, info are welcome :-)

Thanks in advance,
Kristof


texts: Using the PHP include in your template: Naming the file .php or .inc?

texts:
I'm able to load static PHP files for my theme without any problems but do I name the file as file.php or file.inc? I found out that either way works fine so which one is better?

<?php include ".." . base_path() . path_to_theme() . "/includes_folder/file.php"; ?>
<?php include ".." . base_path() . path_to_theme() . "/includes_folder/file.inc"; ?>

Remember that the files are saved in my theme folder since I'm not making a module. It's just static content.


texts: Where do I edit the HTML surrounding a field's output?

texts:
I am working on a site that has an image Field (machine name: field_resp_media) that outputs images.

I simply need to add an attribute to the <img> tag this field outputs.

I've run keyword searches in modules/contrib and modules/custom, and I came up with nothing.

Would anyone know what file I need to edit and add this attribute?


texts: Creating dependencies between fields in content type creation form

texts:
I have two fields in my content type that I'd like to have depend on each other. The two fields are category (the dependee, a field list) and icon (the dependent field and also a taxonomy term field). They are both select lists. I want the dependent field (icon) to not be available to authors creating records in the admin interface. It should just automatically select the correct term based on the category selection above it.

I looked into 'Conditional Fields' but I'm not certain it does what I'm looking for.

Any suggestions?


texts: I am running a Drupal 5 site with number of roles. Is there a way to assign limits per role? E.g. Authenticated user could upload 10 documents, whilst Paid user could upload 100 documents. Your help is much appreciated.


texts: How to add in-line styles to addressfield field?

texts:
How can I add an inline style to an addressfield field without having to modify the template files?

I'm using the addressfield as a field in my user object and am trying to load the full user object in the commerce order display page.

This page is being rendered using the admin theme which is the default Seven theme.  I'm trying to avoid having to modify that default theme for this purpose.

Here's the relevant code:

function MYMODULE_entity_view($entity, $type, $view_mode, $langcode){
  if ($type == 'commerce_order') {
    $uid = $entity->uid;
    $user = user_load($uid);
    $renderable_user = user_view($user, 'default');  //<-- Can I modify this array to add an inline style?
    $entity->content['customer_info'] = array(
      '#weight' => -2,
      '#markup' => render($renderable_user),
      );
    }
}

Or perhaps I'm going about this the wrong way and there's another way to modify the output of this page?


texts: How to show a node view after clearing cache?

texts:
I'm running into an odd situation with views and pathauto not showing a node. Here is what is happening:

I have created a content type called "Āsana". In it, there are several fields and paragraphs.
I have created a node called "Śirṣāsana" that has a safe name called "sirsasana".
I have set up a Pathauto alias with the pattern, asana/[node:field_safe_name]. To navigate to the Śirṣāsana page, I can go to http://mysite.loc/asana/sirsasana
I have also created a view that shows a full page of a single "Āsana" node. The page path is set to /node/%, and the contextual filter is set to Content: ID. Here is a screenshot of it...

When I navigate to the page http://mysite.loc/asana/sirsasana, I see all of the content that the view is supposed to display.
If I rebuild the caches (drush cr) and navigate back to the page (http://mysite.loc/asana/sirsasana), all of the content is gone.
In order to see the content, I have to go to admin/structure/views, edit the "Āsana" view, and save it. Note that there are no changes to the view. There is no asterisk (*) by any of the view tabs. I just have to save the view, navigate back to the page, and then I can see the content. All of the content disappears when I rebuild the caches again.

What am I doing wrong? Is there something wrong with my views setup? Is it Pathauto?