texts:
I have built a Drupal 7 website that contains a mobile theme. What I want to do is run the newest version of Jquery Mobile - http://jquerymobile.com/ which requires Jquery 1.7.1. Drupal by default is using an older version of Jquery.

I want Jquery Mobile to load "last" and be used for all screen elements (it changes the way form elements, the way the page is scrolled etc). I've already excluded a bunch of the default Drupal js and css (that won't be needed in the mobile theme) and if I stick this in the html.tpl.php of my test theme.

<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>

It works exactly the way I want it to, but this does not seem like a good Drupal friendly implementation. What is a better implementation of this that will work better with Drupal and reduce risk of conflicts?

I've tried Jquery update http://drupal.org/project/jquery_update/, and jQuery Multi modules http://drupal.org/project/jqmulti, but without modifications the theme won't load (it loads perfectly if I use those 2 lines above).

Also please do not point me to http://drupal.org/project/jquerymobile or to this
http://drupal.org/project/mobile_jquery

I have a site using that module and theme and I do not want / desire/ require, the extra functions thqat module works with (plus it uses an old version of jquery mobile) and the theme has lots of issues which make it not work for my purpose.


texts:
I want to let my user to request membership to an OG through the user registration form (they should select the company you belong too). I found how to

I have two content type set as OG (company and committee). When I enable group audience selection in the registration form all my OG are displayed. I want to display only value related to the company OG.

Is this achievable?


texts:
I have to change a website, but I cannot log in. The problem is, that the login page does not appears in any way. I get a 403 error when accessing /user. That should come from a change that I did in the past to deactivate the login page at all. Even I cannot remember what I did or (last conclusion), the database has an error and the login page does not appear.

I setup a new Drupal installation with the same version, but I cannot see any significant difference of the folders.

Is there a hack to activate for a moment to allow anonymous user act as an administrator?

I am using Drupal 6.19.

Querying the database, I get the following.

    drupal=> SELECT path FROM menu_router WHERE path LIKE '%user%';
     user/login
     user/password
     user/register
     user/autocomplete
     admin/user
     user/%
     user/%/view
     user/login/lightbox2
     user/login/thickbox
     admin/user/rules
     admin/help/user
     user/%/contact
     user/%/delete
     admin/user/permissions
     admin/user/roles
     admin/user/settings
     admin/user/user
     user/%/edit
     admin/user/rules/list
     admin/user/user/list
     user/%/edit/account
     admin/user/rules/add
     admin/user/user/create
     admin/user/rules/check
     admin/user/roles/edit
     admin/user/rules/edit
     admin/user/rules/delete
     admin/views/ajax/autocomplete/user
     user/reset/%/%/%
    (30 rows)


texts:
I'm using Drupal 7.
I've a custom table that I what do display and enable to Add, Edit and Delete items.
I tried editableviews module but it doesn't work for me:

Notice: Undefined variable: result_indexes in editableviews_plugin_style_row_edit_table->insert_form_elements() (line 218 of C:\wamp\www\mypoc\sites\all\modules\editableviews\editableviews_plugin_style_row_edit_table.inc).
Notice: Undefined variable: result_indexes_reverse in editableviews_plugin_style_row_edit_table->insert_form_elements() (line 219 of C:\wamp\www\mypoc\sites\all\modules\editableviews\editableviews_plugin_style_row_edit_table.inc).
Notice: Undefined variable: result_indexes in editableviews_plugin_style_row_edit_table->insert_form_elements() (line 218 of C:\wamp\www\mypoc\sites\all\modules\editableviews\editableviews_plugin_style_row_edit_table.inc).
Notice: Undefined variable: result_indexes_reverse in editableviews_plugin_style_row_edit_table->insert_form_elements() (line 219 of C:\wamp\www\mypoc\sites\all\modules\editableviews\editableviews_plugin_style_row_edit_table.inc).

How to fix that error or is there anything else to use?


texts:
After the 8.8.4 update I am getting the following error when I try to clear caches:

  Circular reference detected for service "theme_handler", path: "twig -> twig.loader.filesystem -> theme_handler -> config.factory -> high_contrast.overrider -> theme.manager
    -> theme.negotiator -> access_check.theme".

Uninstalling the high_contrast module fixes the issue, but I would prefer to keep using it for accessibility purposes.

I can't find any relevant bugs on the module webpage

Is anyone else having this issue or is something else going on?


texts: How to embedding Comment form for each individual item in drupal's view?

texts:
In my current project I want to embedding comment form for individual item in views but I did not get any settings/ configurations for the same in view. I tried to override template for the same using

print drupal_get_form('comment_form', array('nid' => $nid));

code but I got an error, so please suggest my any idea or any module using that I can show comment form in views.

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


texts: What is the right way to print variables with Twig?

texts:
I want to know what is the right way to print with Twig.

Example:

node.field_related_articles.entity.get('field_color_theme').value
node.field_related_articles.entity.field_color_theme.value

What is the difference? Which one we should use and why?

Example 2:

When we need to access variables through node.field_something and when with content.field_something in node-something.twig.html?

Example 3:

When we are printing plain text in html like:

"< h4>Related articles< /h4>"

How should we print it with twig right way so that if in future we want multilanguage site we don't need to track all plain text in html to change it?


texts: How to split content for different target audience?

texts:
We're having a bit of a difficulty finding the best way to solve the current issue: it's a multi-site and multi-lingual set-up for a customer that is active in different countries. For each country a separate database is uses (multi-site) and each country has an English + local language variation (multi-lingual).

The customer also has a split audience (private vs. business) and all pages have a one-to-one match, meaning if you are on a /en/private/foo page, you could go to /en/business/foo just by switching the target audience (same way the language switcher works).

The problem is you'll have two switcher blocks on the page that have to be in sync:

language (english/local language)
audience (private/business)

How would you split the content and keep the relation between the different nodes for different audience groups? This also has impact on other Drupal components, the menu for example.

We've been looking at two different approaches:

separation on content level (taxonomy or field to select the audience
group)
grouping the content (e.g. og module, or the new kid on the block group)

Any people out there that had the same issue and how did you solve it?


texts: Use sub-directory if URL includes specific string

texts:
I am using Drupal 7. Right now, I would like to install WordPress in a sub-directory for maintaining my content page. Since I've used my website for a while, I don't want to change my URL for SEO purpose.

What I did right now:

Drupal root is in /var/www/html folder
Created a subfolder under /var/www/html
Install Wordpress in /var/www/html/subfolder

My current blog page's URL is http://www.example.com/subfolder/my-blog-1.blog.html.

But my expected blog page's URL is http://www.example.com/my-blog-1.blog.html.

How can I avoid using http://www.example.com/**subfolder**/my-blog-1.blog.html for my blog?

Is there anything I need to do in the .htaccess file?


texts: How to detect device in template file in drupal 7

texts: I want to get the device whether is it Mobile,Tablet,Iphone or desktop based on the screen width. I know about breakpoint and picture module. But I need to change some HTML based on that condition. How can I get the condition in tpl file.


texts: How to pass variables into link path within l() function?

texts: I am wondering how to pass variables into a the path argument for a link created with l(). The path looks like registration-history/listing/$node->nid/$sku/$node->created/$start_date And the link text is in $registration_count.


texts:
Drupal user profile image alt text is showing special characters instead of a quote in the user name. My user name is Derek O'Rourke  and the alt text for user profile image is showing Derek O&#039;Rourke's picture"which is not correct.

I couldn't find a way to update it. Please help me.


texts:
I've got a local install that has turned bad. I want to quickly re-import block settings, block content, and menus.
How can I achieve this?


texts: How to place one region below the other while reducing the width in drupal 7?

texts: Currently, I am creating a single page responsive website in Drupal 7. After making the page responsive, I added a block with two regions: about us and ethics side by side that is in two columns. When reducing the browser width, the content still remains in two columns!!! I want the region about us to be below ethics, but I am not aware how to do it!! Can anyone guide me with the aforestated question.


texts:
I have a list of taxonomy terms to make some categories on my website. When I click on one of them, the content appears, but I can't display the taxonomy term name. I can't find the right configuration in my view.

To display the result, I need to alter the page.html.twig template and the views template. I want to display the name of the term in the page--my_name.html.twig template.


texts: 301 redirect one site in multi-site installation

texts:
I have a drupal 6 installation that is hosting numerous sites. They're all located in the sites/ folder. Like: sites/site-1 sites/site-2, etc.

One of these sites has been discontinued, and we need to redirect from it to a new domain name.

Placing a .htaccess file in the sites/site-1 folder does not work.

How can I redirect ONLY THIS ONE SITE out of a multisite installation to a new domain name?


texts: Adding CSS to specific nodes doesn't work

texts:
I'm new to Drupal 8 themes and am trying to edit CSS on individual pages. I've read how to do it, and have attempted to implement, but when I clear my sites cache and try to view the page, the new CSS (or JS on some pages) does not seem to get utilized.

What I have done

In my .theme file I have this code

function odyssey_preprocess_node(&$variables) {
  // find node object
  $node = \Drupal::routeMatch()->getParameter('node');
  if ($node) { //ensure object is a node
    if ($node->id() == 1 ) { //grab specific node (R&D page)
      //attach the library
      $variables['#attached']['library'][] = 'odyssey/research-devel';
    }
    elseif ($node->id() == 3 ) {//CR Calc node
      $variables['#attached']['library'][] = 'odyssey/cr-calc';
    }
  }
}

In my .libraries.yml file I have the following code

research-devel:
  css:
    theme:
      css/research-devel.css: {}

cr-calc:
  css:
    theme:
      css/cr-calc.css: {}
  js:
    js/cr-calc.js: {}
  dependencies:
    - core/jquery

I uploaded the named files from .libraries.yml into the appropriate folders (I have my global CSS and JS files working, so I know the locations are correct.)

Does anyone see any glaring errors? Am I going about this the wrong way? Like I said, fairly new to the game and I'm sure that adding specific page stylings to the global CSS is the "Non-Drupal" way to go about it, so any advice would be appreciated.


texts:
I am trying to update some field options in an inline entity form with ajax. This should happen, when someone selects a value in an other field.

I already have some code which "works", but the problem is that you can edit multiple items and there seems to be a problem with the wrapper_id, because it is for all items the same and the entityForm function is called multiple times.

So what is the best way to do this?


texts: How can I access the paragraph fields from my node via Tokens?

texts:
Token Version: 8.x-1.7
Paragraphs Version: 8.x-1.12
I have one main node. In this main node I have referenced another sub-node. This sub-node has two fields with paragraphs. Each of these paragraphs consists of further text fields.
I would like to access these fields in the pargraphs by token. Unfortunately, I cannot find a suitable token for this. Neither in my token browser nor under /admin/help/token .
The only token with which I can access the field is the following:
[node:field_agent_reference:entity:field_gratification_for_agents].
But unfortunately this only gives me the whole content of the paragraph and not the fields individually. What am I doing wrong?
All other tokens that start with paragraphs, such as:
[paragraph:field_agent:entity:field_gratification_fur_agents]
[paragraph:field_agent:entity:field_bonus_number_or_percent]
[paragraph:field_percentage_media]
[paragraph:field_percentage_media:value]
do not function for me.
Thanks a lot
Bavra


texts: HTTP/2 does not allows to write in folders in Drupal 7, how can I fix?

texts:
I've recently changed from HTTP 1.1 to HTTP/2, as soon as i did it I was not able to create or edit files from backoffice (both image upload or css/js cache), but if I did it from FTP there is no problem

All the folders are 755 and all the files are 644 and I could not get other informations

Varnich cache is not installed on the server, what can cause the problem?


texts: How can access the Question from its Course when using the E-learning module?

texts:
I am using Drupal 7 and I have installed the "E-learning" module.

I have created these items:

a Question.
an Exercise (which includes the Question).
a Unit (which includes an Exercise).
a Course (which includes the Unit).

How can access the Question from the Course I have created?


texts: Exception handling for incorrect content type for request in custom REST API plugin

texts:
I have created a custom REST API plugin for an endpoint. I have set the accepted format to json using the configuration options. This works. However, if we set the content-type to something other than application/json I am getting a 500 error.
I am seeking to know how this exception can be handled more gracefully. However, what is preventing this is the fact that I am not able to get the Request object in the plugin code.
I tried extending the default EventSubscriber services but they do not seem to be of help. I am seeing that this seems to be an open issue in Drupal.org
https://www.drupal.org/project/drupal/issues/2954286
I am thinking of altering the route and set the default format to json as in manually added custom routes but open to better ways.
Any help would be appreciated.


texts:
I am trying to understand how URLs work in D7 with Views and Panels. When setting up a new view or panel it asks you for a URL.

I am setting up a panel that will embed a few different views. This panel will be for the homepage. I have a view with the URL featured-items. I have successfully embedded it into the front page panel. However, it is also accessible at /featured-items. How do I prevent this from happening?


texts:
I have Drupal 7 with Domain Access on it.
On the main domain i have an About us page with the path www.example.com/about-us

How can i get same "/about-us" path on several subdomains like domain.example.com/about-us, domain2.example.com/about-us etc. to point to different nodes?


texts: How to use drupal twig template available variables

texts:
I'm struggling to understand how twig templates work in Drupal 8. At the beginning of each templates there is a comment to show availables varialbes but I dont know where or even how I'am suppose to assign them.

Let's take views-view-fields.html.twig as an example.

{#
/**
 * @file
 * Default view template to display all the fields in a row.
 *
 * Available variables:
 * - view: The view in use.
 * - fields: A list of fields, each one contains:
 *   - content: The output of the field.
 *   - raw: The raw data for the field, if it exists. This is NOT output safe.
 *   - class: The safe class ID to use.
 *   - handler: The Views field handler controlling this field.
 *   - inline: Whether or not the field should be inline.
 *   - wrapper_element: An HTML element for a wrapper.
 *   - wrapper_attributes: List of attributes for wrapper element.
 *   - separator: An optional separator that may appear before a field.
 *   - label: The field's label text.
 *   - label_element: An HTML element for a label wrapper.
 *   - label_attributes: List of attributes for label wrapper.
 *   - label_suffix: Colon after the label.
 *   - element_type: An HTML element for the field content.
 *   - element_attributes: List of attributes for HTML element for field content.
 *   - has_label_colon: A boolean indicating whether to display a colon after
 *     the label.
 *   - element_type: An HTML element for the field content.
 *   - element_attributes: List of attributes for HTML element for field content.
 * - row: The raw result from the query, with all data it fetched.
 *
 * @see template_preprocess_views_view_fields()
 *
 * @ingroup themeable
 */
#}

I created a custom View which create a Block. It contains a query fetching a custom content type named "News".
Each news have a title, a body and an image. I overrided views-view-fields template to views-view-fields--MYVIEWNALME.html.twig (the overriding works just fine).

I though for each field I would have a tab in the admin where I could assign for example "wrapper_element" but unfortunately it doesn't work that way.


texts: Views contexual filter based on nid (not from URL)

texts:
I am using Viewfield module to display taxonomy terms of a node is referencing to. I am not using the default taxonomy field available in views because I want more freedom on manipulating the rendered taxonomy terms.

When I am in the node page I use contextual filters and I provide the default value from the URL. Easy. But...

For listing nodes of a taxonomy term I use views also and I want the same functionality in there.

The only way I can do this is by providing the default value from the nid of every node (row). So how can I get the nid as a contextual filter in such case?

Thanks


texts: Can drush return if site is in maintenance_mode?

texts:
To work in parallel with another team, I've copied via ftp the working Drupal 7 app and mysql database and am trying to get it to run. I've cleared the cache and drush happily reports connecting to the db but the home page responds with a 500 error about

Recoverable fatal error: Argument 1 passed to image_resize() must be an instance of stdClass, boolean given, called in /media/psf/Home/apps/newdom/sites/all/modules/image_resize_filter/image_resize_filter.module on line 515 and defined in image_resize() (line 279 of /media/psf/Home/apps/newdom/includes/image.inc).

I'm unable to see anything and to login. While I'm tracking down why that error is thrown, I can see in the page inspector that the css is suggesting the app is in maintenance mode. OK, looking at the drush help commands I enter:

drush vset --exact maintenance_mode 0

And it returns that maintenance_mode set to "0". But the page still looks like it's in maintenance.

My question is, can I send a command through drush to test if the site is in maintenance mode or not? I've tried leaving off the last parameter but that is required. I don't see it in the help page so maybe it does not. Drush status does not have a property for that in its list. Is there a way to verify an app is in maintenance mode by the command line?


texts:
I am having trouble updating custom fields programmatically. The code appears below and is in the body of my custom module. When I run this changing the title, it changes OK. But, when I try to do this with the custom field, the field doesn't get updated and I don't understand why. Should I be wrapping this into some hook? Is there a cache not being cleared somewhere? Basically, what am I missing when it comes to programmatically updating fields.

$nodes_to_load = $query->execute();
if (isset($nodes_to_load['node'])) {
  $nodes = entity_load('node', array_keys($nodes_to_load['node']));

  foreach ($nodes as $node) {
  $node->field_myother_field[$node->language][]['value'] = '500';
  $node->title = "retest the test";
  node_save($node);
 }
}
 else {
  print "no nodes to load";
}

UPDATE: When I try to change the field by going into the admin panel, and simply typing in a new value I get a "The content on this page has either been modified by another user, or you have already submitted modifications using this form. As a result, your changes cannot be saved" error.


texts: Reset user password without using "Forgot password?"

texts:
I know that in Drupal 7 I could reset the user #1 password via code.

define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
require_once DRUPAL_ROOT . '/includes/password.inc';
$newhash = user_hash_password('newpass');
$updatepass = db_update('users')
  ->fields(array('pass' => $newhash))
  ->condition('uid', '1', '=')
  ->execute();

(user_hash_password() doesn't exist anymore in Drupal 8.)

Alternatively, I could use the following code.

define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
require_once DRUPAL_ROOT . '/includes/password.inc';
$edit['pass'] = 'newpass';
$account= user_load(1);
user_save($account, $edit);

What is the equivalent code for Drupal 8? What API should I use for this purpose?


texts: I am learning Drupal 7 and want to know the way to learn modules

texts:
I am learning Drupal 7. I have read the docs about modules.

But still want to know the correct way to learn modules eg. how to use it, how to install extended modules etc.


texts: Pass the value in a field into a colorbox popup

texts:
Is it possible to dynamically change a link on a colorbox popup a specific field value?

I have a view displaying a list of external links that have been added using a custom content type. And what I would like to do is be able to have a colorbox popup when you click on one of those links that explains that you are about to go to an external site.

I have the colorbox popup working with a button to go to that link, but I need the link of the colorbox button to change depending on which node they click on in the view.

My field is "field_conf_presentation_link"

Can I pass that value in anyway to the link that the popup would have?

Here is my view displaying the link they would click on:

Here is the code I have on my page template file that creates the content for the popup:

  <?php print '
' . t('You are now being redirected to view this live session.') . '
'; ?>
  <?php print l('Watch Now ›', '**LINK HERE**', array('attributes' => array('class' => array('btn-small')) ) ); ?>

I've been looking around and see that there is a module called Colorbox Node that might be able to give me what I want, but I am hoping I can get around that for something like this.


texts: How do I update Drupal core on composer install?

texts:
I installed (or downloaded) drupal 8 via:

composer create-project drupal/drupal my_site_name 8.0.*

Which, at the time I ran it, downloaded Drupal 8.0.1.  Now drupal 8.0.2 is available and I'd like to update to this version.

I'm not sure how to update core but I decided to try running composer update from my drupal site's root directory.

This updates many packages (e.g.):

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing composer/installers (v1.0.21)
  - Installing composer/installers (v1.0.22)
    Loading from cache

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/class-loader (v2.7.6)
  - Installing symfony/class-loader (v2.7.9)
    Downloading: 100%

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing symfony/console (v2.7.6)
  - Installing symfony/console (v2.7.9)
    Downloading: 100%

(...)

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Removing twig/twig (v1.23.1)
  - Installing twig/twig (v1.23.3)
    Downloading: 100%

However I don't see anything about updating drupal/drupal.  And when I visit my site's status report it still shows 8.0.1.

So how do I actually update core via composer?


texts: What is the purpose of url('', array('prefix' => &$prefix)) in drupal_add_js()?

texts:
I was looking at the code of drupal_add_js(), and noticed the following code.

  // url() generates the prefix using hook_url_outbound_alter(). Instead of
  // running the hook_url_outbound_alter() again here, extract the prefix
  // from url().
  url('', array('prefix' => &$prefix));

I tried executing the following code, from the Devel module.

dsm(url('', array('prefix' => &$prefix)));
dsm($prefix);

The output was "/dr72/" for the first dsm(), but nothing for the second one.

Looking at the HTML of the front page in my test page, I notice the following JavaScript code.

jQuery.extend(Drupal.settings, {"basePath":"\/dr72\/","pathPrefix":"", /* … */ });

What is the purpose of that code in drupal_add_js() work? How it is supposed to work?


texts: Relationship between node_access gid, roles and workflow

texts:
If using workflow, what database table.field does the node_access.gid map to? Does it represent a role, does it represent a workflow sid (state id), or something else?

Example:

+---------+------+-----------------+------------+--------------+--------------+
| nid     | gid  | realm           | grant_view | grant_update | grant_delete |
+---------+------+-----------------+------------+--------------+--------------+
| 1234561 |    4 | workflow_access |          1 |            1 |            1 |
| 1234562 |    5 | workflow_access |          1 |            1 |            1 |
| 1234563 |    6 | workflow_access |          1 |            1 |            1 |
| 1234564 |    7 | workflow_access |          1 |            0 |            0 |
+---------+------+-----------------+------------+--------------+--------------+

EDIT: After @Berdir's excellent response I wrote the query below to analyze the relationship between node_access.gid, workflow_access.rid, and role.rid:

# Establish relationship between workflow, roles, gids, etc.
SELECT
    r.name AS role,
    r.rid AS w_role_rid,
    wa.rid AS and_workflow_access_rid,
    ws.state AS has_access_to_state,
    wa.sid AS with_state_sid,
    IF(ws.status=1,'YES','NO') AS which_is_enabled,
    wa.grant_view, wa.grant_update, wa.grant_delete
FROM workflow_access wa
    LEFT JOIN role r ON wa.rid = r.rid
    LEFT JOIN workflow_states ws ON wa.sid = ws.sid
ORDER BY r.rid, wa.sid

If anyone notices any incongruousness with my query please comment so.


texts: getFieldDefinitions on Drupal 8 (why all these deprecated functions on DP8?)

texts:
I don't understand why they are so much functions deprecated on Drupal 8. From the basics (node load, node delete,...) to more complicated (getFieldDefinitions,...).

And their is no explanation for using the new way of implementation in the official documentation.

For example, I want to get the definitions of all my fields for a content type. The old way was :

Drupal::service('entity_field.manager')->getFieldDefinitions(xxx, xxx);

For somes reasons, its now deprecated. Now, we have to use this. But how use it... that's the question. Their absolutely no example or help. I would use the getFieldDefinitions function from this class, but I have to create a instance from it, the function is not static.

How do I do :( ?


texts: Month Year granularity on views exposed filter for a custom table exposed to view

texts:
I have a custom table exposed to view with a column of type int where I am storing current time stamp. while exposing the custom table I have kept views filter handler as "views_handler_filter_date", but this is not allowing to create expose filter with month and year granularity.How can I get month and year granularity for my date_of_purcahse

Here is the snippet exposing the field to views.

  $data['jh_report']['date_of_purchase'] = array(
    'title' => t('Date of purchase'),
    'help' => t('Date of last purchase for current month'),
    'field' => array(
      'handler' => 'views_handler_field_date',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort_date',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_date',
    ),
  );


texts: Passing a number via page arguments in hook_menu()

texts:
I am generating the return value for a hook_menu() with values from a query.

 $items[$record->path_prefix . '/my_path/%'] = array(
     'title' => 'Topic Redirect',
     'page callback' => 'my_callback',
     'page arguments' => array($record->id,2),
     'access callback' => TRUE,
     'type' => MENU_CALLBACK
   );

This will automatically pass the argument that is the record id to the callback function. I would like it to pass the value. Is there an easy way to do this?


texts:
I imported products with the help of feeds via commerce product processor. All products data downloaded correctly except the product photo.

It downloaded from csv file, where there is a full direct path to the picture. At settings of acceptability to this field : photo: URI (field_product_photo:uri)

Import runs without mistakes, but there is no product photo in a product's description. Which is strange because the file is copied to sites/default/files/ it's saving the origin name, except saving in sites/default/files/images and changing the origin name to sku , as it should be by making this products list by hand-labour.

Can you tell me what am I doing wrong?


texts: HTML code to PHP code mapping does not work

texts:
I am trying to include the timeline API, and install the timline files on my webserver. The timeline-api.js gives an example of an HTML page that contain the following code.

<script>
var Timeline_ajax_url="http://YOUR_SERVER/apis/timeline/ajax/simile-ajax-api.js";
var Timeline_urlPrefix='http://YOUR_SERVER/apis/timeline/';
</script>
<script src="http://YOUR_SERVER/javascripts/timeline/timeline-api.js"
type="text/javascript">
</script>

It also contain the following comment.

   /*
    * Eg the two next lines pass the same parameters:
    * Timeline_parameters='bundle=true';                    // pass parameter via js variable
    * <script src="http://....timeline-api.js?bundle=true"  // pass parameter via url
    */

I am trying to do the same thing in Drupal using the following code.

$timeline_lib_path = $base_path . libraries_get_path('simile_timeline');
// Set some global js variables that the library is going to need for proper inclusion and functionality.
$timeline_inline_js = "
var Timeline_ajax_url = '$timeline_lib_path/timeline_ajax/simile-ajax-api.js',
Timeline_urlPrefix = '$timeline_lib_path/timeline_js/',
Timeline_parameters = 'bundle=true';
";
drupal_add_js('similetimeline',$timeline_inline_js);
drupal_add_js('similetimeline','$timeline_lib_path/timeline_js/timeline-api.js');

I have an uncaught reference error: Timeline is not defined.


texts: How do I pass a PHP variable to Drupal.settings global javascript?

texts:
Javascript works fine, but i need to get my_var variable from module. At the moment its not working.

Clear my page cache and browser cache several times.

The variable 'my_var' is showing value on front end but not on backend/admin side.

Front end theme is Bartik; the admin theme is Seven.

All other variables are available on Admin side from Drupal.settings, except the one I pass from my custom module.

This works well on both themes.

alert(Drupal.settings.basePath);

This is my code.

MY_MODULE.module

/**
 * Implements hook_page_build().
 */
function MY_MODULE_page_build(&$page) {
    ctools_include('modal');
    ctools_modal_add_js();

    // HERE it is calling the js
    drupal_add_js(array('MY_MODULE' => array('my_var' => 'MY_VALUE'),), 'setting');
    drupal_add_js(drupal_get_path('module', 'MY_MODULE') . '/js/MY_MODULE.js');
}

MY_MODULE.js

(function ($) {
    Drupal.behaviors.MY_MODULE = {
    attach: function(context) {
        alert("test");
        alert(Drupal.settings.MY_MODULE.my_var);
    }
  }
})(jQuery);

On front end, it alerts with test followed by MY_VALUE, but on admin side, it shows test; Firebug then shows me:

  Uncaught TypeError: Cannot read property 'my_var' of undefined

How can I fix this?


texts: trying to add a template file to my module using hook_theme_registry_alter

texts:
Here's my .module code:

/**
 * Implements hook_theme_registery_alter()
 */
function popover_theme_registery_alter(&$theme_registery) {
    $theme_registery['popover'] = array(
        'template' => drupal_get_path('module','popover'). '/popover.tpl.php',
        'type' => 'module',
    );
}

I'm having some plain html elements in the tpl.php file so that might be not good? or do I have to call this hook somewhere? what's wrong?


texts: Assign content creation of nested content

texts:
In my Drupal 8 site I have a newspaper, that consists of multiple non-fix categories. Within these categories I have two different types of articles. As an editor I want to assign these two types to certain authors. So for example the editor sets up the current categories and wants to assign type 1 articles in category 1 to author 1. That author should than be able to create these articles types for this category only.
Obviously I don't want to create a content type for every combination of category and article type, as the content is structurally the same and the amount of content types would be unreasonably high. I could tag the article types with the corresponding categories, but still for now I cannot find a way to properly handle the permissions/access to the creation of specific article types within a certain category. So is there any way i can differentiate between the article types of different categories, that can be used for handling the permissions of what content authors can create?
Any module recommendation, help or hint would be highly appreciated.


texts: Is there a way to get Drush to download all required dependancies for a specific module?

texts:
For example if you perform the following commands:

drush dl views
drush en views views_ui views_export

You will get the the following error when trying to enable the views modules:

  Module views cannot be enabled because
  it depends on the following modules
  which could not be found: ctools

Is there a way to get drush to download required module dependancies?


texts:
I am developing an application based on Drupal 7 and web services. Some application pages have a menu which should be customized (menu items should be removed) based on the response from the web service, but am not sure on how should implement it.

In general the logic is the following: I will get a parameter from the request and call the web service with PHP (I know how to do this). Then, based on the response, I should show or hide some menu items.

The problem is that the menu should be customized in every request, so hook_menu_alter does not help me, because it is only called once when the menu is created. Is there another hook that I should be looking into, or any other method I should be using?


texts: How to override VBO redirect after performed action?

texts:
My problem is that I can't override the URL where VBO redirects me to after I performed a default action. When I write my own actions I simply put $_GET['destination'] = 'my/target'; inside my custom form submit and that works. I tried to alter VBO's form submit to attach my own submit but that doesn't work:

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'views_bulk_operations_form') {
    array_push($form['#submit'], 'MYMODULE_vbo_redirect');
  };
}

function MYMODULE_vbo_redirect() {
  $_GET['destination'] = 'my/target';
}

When I testhack the VBO module and inside views_bulk_operations_form_submit($form, &$form_state) replace the final redirect with my custom one, it works. How can I get inside there and get my custom redirect executed without hacking?


texts: Different front page template for different domains

texts:
I have Drupal 7 installation with the Domain Access module.

I need to have different page--front.tpl.php templates for some of the subdomains, for example:

www.example.com should have one type of the front page template (not a node, but some custom blocks and module outputs) and d1.example.com, d2.example.com and d3.example.com should have different kind of blocks, module outputs, forms, and template.

The style for the rest of the site should be pretty much the same for all domains.

How can I accomplish this?


texts:
We are having an ongoing project on OpenSocial, which is a profile based on Drupal 8. The project was installed using composer. However, later several modules were installed and updated via Drush.

Due to this, the composer file and the actual application is not in sync. What would be the best way to get out of this situation? Is there any way to fix composer?


texts: How should jcarousel be installed and configured?

texts:
To achieve a slider with 5 slides in sight and sliding 1 at a time, I thought https://www.drupal.org/project/views_slideshow_jcarousel would be a good choice. Also, because I already use views_slideshow.
However the installation instructions are a bit confusing. They seem to relate to Drupal 7 and/or combined with Drupal 8.

At first I installed through Composer and activated the module in Drupals' User Interface. This did not work.
Then I downloaded the zip and tried to place files in different locations. Because it is not clear to me where I should place files, this also failed.

Anybody knows how I could get this to work?

Update: as was noticed by Stefan, the dist folder should be in an other location than the docs (sites/all/libraries/jcarousel/dist) indicate. I moved the contents of the dist folder to that new location (/libraries/jcarousel/lib), this didn't make it work yet. I can see the carousel options in the view that I made, but it doesn't function yet.

I'm setting the view > slideshow settings > widgets > pager type to jcarousel pager. At that point there's a select list for skin without options to choose from. The output of the slider is an unformatted list with the slider below that.
Perhaps I'm still doing something wrong?


texts: Adding autocomplete to Google CSE based on taxonomy terms

texts: I want to implement something similar to the search on http://www.retailmenot.com/. When you type in a company name, a drop down will appear showing you matching companies. I want to do the same thing on my Drupal and have the suggestions be terms from a certain vocabulary. I am also using Google CSE. Does anyone know how I can implement this using modules or how to start if I wanted to code this myself?


texts: How to add frontend form using custom content type?

texts:
I new to Drupal and I created a custom content type which has few fields, like donation name, value, size, etc.

I want to add these fields as a form for user which they can fill in the frontend. I want to know there are existing for this task or it can be done through core module


texts:
I would need to export nodes in Ms Word format.

I would need to mantain the node structure or to apply a template.

I don't want to export data in a table like "Views data export" module does.

In Drupal 6 it was done using "node to word" module (https://drupal.org/project/node_to_word), but the module doesn't exist for Drupal 7.

thank you in advance


texts: Why do I get a redirect loop (302) when using path-auto patterns on taxonomy terms?

texts:
I am using pathauto to set up my URL's at the moment and they are working fine for nodes.
However when I set up a rule for taxonomy terms using [term:name] as the pattern I end up with redirect loops.

Can anyone explain why this is and how to remedy.

Thanks for any help.


texts: How to make CKeditor format code indenting elements and adding line breaks?

texts:
Using CKEditor in Drupal 7, I could configure CKEditor to format the code adding line breaks and indenting the HTML code automatically.

For example, pasting this in the source code:

Test

CKEditor could be configured to turn it into:

        Test

To achieve that, I just had to select the right configuration for CKEditor (Indent the element contents, Break line before the opening tag,  Break line after the closing tag), and include the Javascript configuration:

config.allowedContent = true;

But in Drupal 8, I can't see those options and CKEditor removes all the whitespace from the source code.

How can I make CKEditor work like with that configuration in Drupal 8?


texts: Programatically render a node in a specific language

texts:
I want to render a node display programmatically for sending it to a search engine. It works ok but is ignoring the language and renders the field labels in the source language (which is English).

I use the following code for creating the teaser markup.

 $render_array_teaser = $view_builder->view($entity, 'compact_teaser', 'de');
 $rendered_teaser = $renderer->renderPlain($render_array_teaser);

The result gives me a teaser that includes a field named "field_sku" that has the label "SKU number". If I output the teaser in the browser the label gets correctly translated to German = "Artikelnummer" if the current language is "German".

If I render the teaser with the above code the label stays English even if I set the langcode parameter to 'de'.

How to get the teaser with German lables?


texts: Exposed filter for data and select field

texts:
I spent all weekend trying to make this work, and couldn't figure it out.

How do I create a views exposed filter for date and a text list on a given node?

My setup - I have a view that is exposed as JSON with a task_name field, a date field, and a status field.

I have the date module installed in both Drupalgap as well as Drupal, and I'm able to get that to display correctly.

I've tried creating a select list for day, month and a year, as well as task status, and this seems clunky (four select lists takes up quite a bit of room - and I can't figure out how to collapse them - perhaps some sort of "collapse format"?)

But even if I do create them, there seems to be no way to have an interaction between them and the view content object. I tried grabbing the values of the select lists from the path of the views object, but there seems to be no way to do that.

My views code looks like this, almost an exact copy of the beer example:

function task_list_page() {
  try {
    var content = {};
    content['task-list'] = {
      theme: 'view',
      format: 'ul',
      path: 'tasks.json',
      row_callback: 'task_list_page_row',
      empty_callback: 'task_list_page_empty'
    };
    return content;
  }
  catch (error) { console.log('task_list_page - ' + error); }
}

What would I do to this to create an exposed filter for date and status, both of which are columns in the view? How would I make this filter compact and perhaps collapsible?


texts: How to file_save_data with utf encoding?

texts: file_save_data is saving files with ANSI encoding. I want utf8. How can I specify encoding?


texts: Error after installing module twice: Configuration object already exist

texts:
I've followed How to create views programmatically in Drupal 8, but as I asked in this topic, my view doesn't appear in my list.

When I install my module twice (Enable -> Uninstall -> Enable), I have an error:

  Configuration object views.views.viewsname already exist

I also tried to import it directly in Drupal, copied the exact same code and this worked.


texts: What permission gives users access to the "additional settings" options (author, etc.)?

texts: Which permission should I give to users to allow them to change the author of node content?


texts:
Any Help would be appreciated :

I've created a custom page via hook_menu in drupal 7 in which there is a custom form implemented (and additionnal features). I'm trying to implement an Ajax callback on the form submit to refresh dynamically the content part of the page, but i keep having an "error 200" on "system/ajax".

I guess that is because of the route Ajax doesn't find.

How can I implement a custom route for the ajax callback ?

Edit : Here's the code of the module :

function CUSTOM_MODULE_menu() {
  $items = array();

  $items['CUSTOM_ROUTE'] = array(
    'title' => 'TITLE',
    'description' => t('DESSCRIPTION'),
    'page callback' => 'CUSTOM_CALLBACK',
    'access callback' => TRUE,
  );
}

function CUSTOM_CALLBACK(){
  $build = array();

  $build['content'] = array(
    'form_event' => drupal_get_form('MY_CUSTOM_FORM'),
    'list_events' => OTHER_STUFF,
  );

  return theme('custom_theme',$build);
}

function MY_CUSTOM_FORM($form, &$form_state) {
  // FORM ITEMs, CHECKBOXES
    $form['submit'] = array(
    '#type' => 'button',
    '#value' => t('Search'),
    '#submit' => array(
      'MY_CUSTOM_FORM_submit'
    ),
    '#validate' => array(
      'MY_CUSTOM_FORM_validate'
    ),
    '#ajax' => array(
      'callback' => 'ajax_test_callback',
      'wrapper' => 'result-div',
    )
  );

  $form['results']=array(
    '#prefix' => '
',
    '#suffix' => '
',
    '#weight' => 10001,
  );

  return $form;
}

function ajax_test_callback($form, $form_state) {
  $test ="hello";
  return $test;
}

Here's the error I get :

Code de statut HTTP : 200
Informations de débogage ci-dessous.
Chemin : /system/ajax
StatusText: OK
ResponseText :

EDIT 2 : In menu.inc, inside menu_execute_active_handler function, I have the following values :

$router_item['page_callback'] = 'ajax_form_callback'
$router_item['page_arguments'] = array();

and the execution stops in the ajax_form_callback function after the list($form, $form_state, $form_id, $form_build_id, $commands) = ajax_get_form();

EDIT 3 : After debugging a little bit more the execution, I found out that in ajax_get_form function the $_POST['form_build_id'] was NULL.


texts:
I have an autocomplete field that selects id,text data from db table. I want to show the text in the field but need to put the selected id inside a hidden field so that, when the user submits the form, it is passed as form_values[] to _submit hook.
Which is the correct way to do it in D7?


texts:
So I have used the t function correctly e.g. t('hello world')
But I am not sure what else to do to get these strings translated. I tried looking at the hook_locale documentation, but I wasn't sure what a group was. Could someone help me find some documentation that would help me understand what I need to do after adding the t function?

Thanks.

function my_module_block($op = 'list', $delta = 0, $edit = array()) {
    ...
    if ($op === 'view') {
    $content .= '
' . t('my holiday') . '
';
    ...
    $content .= drupal_get_form('cool_form');
    $block['content'] = $content;
    return $block
}
}

EDIT: added some code. Is this enough code?


texts: Changing label of views exposed date filter select list

texts:
Trying to change the label of a views exposed date filter based on Year granularity which is a select list. I have given date range to the filter thus it does not generate the "#options" array.

It creates a dropdown with year values and a "-Year" to display all values.

I want to rename this "-Year" label. Could not find any options within the view to change this label. So is there any hook or alter that can be used here ?

Yes i am using Better exposed filter and trying to use Date filter based on Content Post Date. After applying BEF i get a select list to the exposed date filter. I need to change the "-Year" label inside this dropdown. tried using hook_form_alter but not able to search this label and change it.

Attached a screenshot of the settings page for the Date filter. And under BEF settings I selected the Default select list option. Could not find any way to rename the "-Year" label.


texts:
I have a view which has an argument passed to it. I provide a default argument of "User ID from URL". I then use %1's content in the Title. This returns username's content.

I have a content profile associated with a user. I want to get the field_first_name from the content profile and display it in the title. So I would get Lucy's content. How can this be achieved?


texts: How to avoid script being injected into costum blocks?

texts: I have a custom block in which I put iframe and javascript ads. I noticed that recently they are being exploited so that attackers add some script to them (i.e on custom block table). I use Full html on the blocks to be able to insert iframe and script code of the ads. All these made me feel very insecure about Drupal so I appreciate your solution to secure my site.


texts: Best practices to hide elements on a page

texts:
So at the moment I can use:

CSS using display: none
function hide(attribute) using hook_preprocess_page()
remove title code from page.tpl.php

And I'm sure there are much more! I'm kinda new to drupal so wondering what you guys think is better practice. Ie...

If I want to hide the page title I would use...
If I want to hide the timezone configuration block on user profile I would use...

Thanks!


texts: How can I check to see if the current user has an an order in checkout?

texts:
I need to create a condition like the following:

 if (current user has an order in checkout){
    go to the checkout page
 }else{
    go to this other page
 }

So far, I'm using:

 if ($order = commerce_cart_order_load($user->uid)) {
      drupal_goto('checkout/')
 }else{
      drupal_goto('someotherpage/')
 }

but it doesn't seem to work. What am i doing wrong? Thanks!


texts: Commerce - Views - Taxonomy - Add to cart issue

texts:
I am constructing an e-shop using Drupal Commerce. I've arranged my products in Categories and Subcategories using taxonomies and taxonomy-menu. All is nice till now. I also created a view, that displays the subcategory's items, with an 'Add to cart' form as a field.

Clicking the 'Add to cart' button does adds the item to the cart.

The cart's block is is configured to link each line item to it's display path.

The issue occurs here: products added from their perspective nodes, are linked correctly (to their perspective display paths) in the cart. Products that were added via the view's 'Add to cart' button, are plain text, and their 'Display Path' field is empty.

I'm puzzled. Any help?


texts: Automatic Login after Successful Registration

texts:
Is there any way to automatic login user after a successful registration, it seems I can't find any tuts/solution how to do this.Thanks!!

Any replies are much appreciated....

in my template.php

function drupal_onrevue1_form_user_register_submit($form, &$form_state){

    //$form_state['rebuild'] = TRUE;
    $form_state['redirect'] = "user/login";
    //print_r($form_state);die();
   $edit = array(
          'name' => $form_state['values']['name'],
          'pass' => $form_state['values']['current_pass'],
          'field_first_name' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_first_name']))),
          'field_last_name' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_last_name']))),
          'field_middle_name' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_middle_name']))),
          'field_year_select' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_year_select']))),
          'field_month_select' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_month_select']))),
          'field_date_select' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_date_select']))),
          'field_gender' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_gender_select']))),
          'mail' => $form_state['values']['field_mail'],
          'init' => $form_state['values']['field_mail'],
          'status' => 1,
          'access' => REQUEST_TIME,
    );

    $account->is_new = TRUE;
    $hello = user_save($account, $edit);
    //print_r($hello);die();

}


texts: Error messages appear in background page, not in dialog

texts:
I have a form being displayed in a jQuery modal dialog. When the form is filled out incorrectly (ie a required field left blank) the error messages appear in the background page, not in the dialog overlay. This is not the beaviour I want and is confusing for users. How do I get drupal status messages to appear in the dialog box?

I am using Drupal 7 with jQuery 1.5.

Thanks.


texts: How to create a eCommerce site products slideshow using views

texts:
Environment: D8 with commerce module.

I am working on a eCommerce website. I created a view to display the products as unformatted list. How can I change it to a slider/slideshow view? Each slide should have 5 products info. Each product of the slideshow should contain title, list price, catalog image, short desc.

Current view:

How the view should look like with the slider:

How can I modify the view to make it a slideshow like the above design?

--

Update 1


texts:
I have products categories vocabulary containing the term T Shirts with child terms Polo & Round Neck.

I have created a facet api block to filter the results through those terms. Under Configure facet filters for Product category I have unchecked all the options.

Now when I am going on page with Facet API Block it's showing me a term T Shirts when I am clicking on T Shirts it shows me both the terms Polo & Round Neck but when I am clicking on Polo it disappears the Round Neck.

I am actually looking for option to display all the child terms even if one of them is selected.


texts: Notice: Undefined index: driver in Database::openConnection() when trying to connect to sqlite db

texts:
In one of my modules I try to connect to one SQlite DB to copy from it the info into my MySQL DB, however after creating the db info and trying to add them into the Drupal context, I get the error Notice: Undefined index: driver in Database::openConnection()

here is my function:

function query_247($table, $conditions = array()){
  $module_path = drupal_get_path('module', 'cw_ticketing' );
  $databases['247cinema']['db1'] = array (
    'driver' => 'sqlite',
    'database' => $module_path.'/247cinema_part1.sqlite',
  );
  $databases['247cinema']['db2'] = array (
    'driver' => 'sqlite',
    'database' => $module_path.'/247cinema_part2.sqlite',
  );
  // die(var_dump($databases));
  Database::addConnectionInfo('247cinema', 'db1', $databases);
  Database::addConnectionInfo('247cinema', 'db2', $databases);
  try {
    db_set_active('247cinema');
    if (count($conditions)) {
      //some logic
    }else{
      $where_s = false;
    }

    //some logic

    db_set_active();
    return$records;
  } catch (Exception $e) {
    $msg = $e->getMessage();
    watchdog('error', $msg);
    db_set_active();
  }
}

Anyone has any idea ?


texts: How to access the published field in my PHP code?

texts:
I am defining a datatype called slider

$nodes = node_load_multiple(array(), array('type' => 'slider'));
foreach($nodes as $slider):

and trying to iterate through each of them. I want to access the field which says if the content is publised or not. I tried this -

$slider->$status == 1

But this is not working.
Does anyone have a solution this problem?

Thanks


texts: Is it possible to query against the ldap server stored in drupal without reconnecting?

texts:
I have a drupal install that uses LDAP to authenticate users.  I use that same LDAP to return user info such as roles, employee photo, email, role, and the center they work at.

    $ds=ldap_connect("ldap-example.com");
            if ($ds) {
                $r=ldap_bind($ds);
                $sr=ldap_search($ds, "DC=tpcontact,DC=co,DC=uk",$search);
                $info = ldap_get_entries($ds, $sr)or die('get info fail');
}

I need to make it so that the server is pulled from drupal.  So, if it is possible to query ldap without reconnecting, I need to do that.  Otherwise I need to query the drupal DB's ldap_servers table, the only problem is that I dont have access to a MySql database that has LDAP enabled to see what the field is.


texts: How to Retrieve FID from UUID on Feature Enable

texts:
I would like to use features to import/export some content. The content type conains custom field of file, so I am using hook_uuid_node_features_export_render_alter(&$export, $node, $module){..} to add UUID of the file to the export.

function MODULE-NAME_uuid_node_features_export_render_alter(&$export, $node, $module){
        if($module == 'MODULE-NAME'){
        $field_instance = field_get_items('node', $node, 'field_elastic_slide');
        foreach($field_instance as $key => $instance){
            $file = file_load($instance['image']);
            $export->field_elastic_slide['und'][$key]['image'] = (array)$file;
            $file = file_load($instance['thumb_image']);
            $export->field_elastic_slide['und'][$key]['thumb_image'] = (array)$file;
        }
    }
}

This works well and the UUID along the other file info is written into the file ending .features.uuid_node.inc part of the export module. So far, so good.

When importing, i would like to use the UUID to look up the FID of file on the Drupal instance import taking place, so i am using:

function MODULE-NAME_uuid_node_features_rebuild_alter(&$node, $module){
    if($module == 'MODULE-NAME'){
        $field_instance = field_get_items('node', $node, 'field_elastic_slide');
        foreach($field_instance as $key => $instance){
            $uuid = $instance['image']['uuid'];
            // We have a uuid - we'll try to retrieve fid.
            $file = entity_uuid_load('file',$uuid);//attempt 1
            $slider_img = current($file);

            $fid = uuid_get_serial_id('file', 'fid', $uuid); //attempt 2

            // There is no local image.
            if (empty($fid)) {
                watchdog(WATCHDOG_NOTICE, 'Slider image with uuid: ' . $uuid.' was not found', WATCHDOG_ERROR);
            }
            $node->field_elastic_slide['und'][$key]['image'] = $fid;
...

This is not working. Where is the UUID<->FID Map stored for features? How to retrieve the FID at the time of importing(enabling the feature)? Any help is much appriciated


texts: hook_views_post_execute() don't work on AJAX View with exposed filters after 1st refresh

texts:
I have a View which returns 5 entities of the same type. AJAX - enabled, filters and exposed filters, all working fine.

I need to add a new result, a user - defined entity, at the top of the View results. This programmatically added row should not be affected when the exposed filters are used and should remain at the top of the View, on top of the other 5 returned results, no matter what.

I managed to add this with hook_views_post_execute() but when I use the exposed filters the View returns to its original results and my addition is lost, because AJAX is enabled on this View. hook_views_post_execute() doesn't seem to have any effect after the initial page load.

What is a good alternative for this scenario ie alter the View in a way that's not affected by the AJAX refresh?


texts: Show forbidden content to non-authorized users when viewed in a Panel(-s Node/-ized Node), not when otherwise?

texts:
I'm using Panels Nodes (Similar functionality to Panelized nodes, if you're more familiar with that) to display a bunch of content from sundry content types -- for instance, I have a content type called Front Page Slideshow, within which each node is a slide that is placed as a piece of Panels content (For simplicity sake, let's just call it a Pane) on the front page.

However, I don't want each individual slide node showing up in either internal or external search results, so I've used Content Access to prevent access to the individual nodes comprising the front page panes but allow access to the Panels Node content type.

Alas, doing this hides all of the panes inside of the Panels as well.

How would one prevent access to specific content types only when they're being viewed individually and not when they're being viewed via a Panel, in a way that also hides them from search results?

N.B. I'm talking about types of nodes that can be created with individual Panels configurations -- NOT Panels pages. So, I don't have access to things like contexts and selection rules and whathaveyou.

Thanks!


texts: Is there a way to create a taxonomy path redirect?

texts:
I am trying to create a taxonomy redirect for specific taxonomy URL. Basically what Taxonomy Redirect did for Drupal 6 but for Drupal 7. I have searched the Drupal 7 API for hook_term_path but don't see it.

Finally, I need these links to be associated with particular profile2 profiles.

Is this possible?


texts: just installed 7.12 - but got stuck - how to access the backend and login

texts:
good day dear drupalers,

just installed 7.12 - but got stuck - how to access the backend. i have no glue.

see the page: http://www.boysday.org - i do not know how to proceed. how can i see the backend.

btw. i do not know the passwd. and the admin-login-name.
and i do not know the link to the login page:
i was in a hurry while i installled all.

see the result on http://www.boysday.org :

Page not found
The requested page "/" could not be found.

question 1: can the data (login name and passwd) be accessed via the backend!? Can i obtain the data to access the backend of the freshly installed D 7.12 while i look at the backend of the site - with phpmyadmin.

question 2: if i have the data - where to go - which link should i follow to acess a login-screen?

look forward to hear from you

greetings

btw: there was a lot of noise during the installation - have a look at this folllowing data: - what do you say...!?

http://boysday.org/install.php?profile=standard&locale=en&op=start&id=1

Warning: opendir(modules/simpletest/tests/themes/test_theme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/boysday.org/includes/file.inc).
Warning: opendir(modules/field/modules/list/tests) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/boysday.org/includes/file.inc).
Warning: opendir(modules/update/tests/themes/update_test_basetheme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/boysday.org/includes/file.inc).
Warning: opendir(modules/update/tests/themes/update_test_subtheme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/boysday.org/includes/file.inc).
Warning: opendir(modules/block/tests/themes/block_test_theme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/boysday.org/includes/file.inc).
Warning: opendir(modules/simpletest/tests/themes/test_theme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/boysday.org/includes/file.inc).
Warning: opendir(modules/field/modules/list/tests) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/boysday.org/includes/file.inc).
Warning: opendir(modules/update/tests/themes/update_test_basetheme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/boysday.org/includes/file.inc).
Warning: opendir(modules/update/tests/themes/update_test_subtheme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/boysday.org/includes/file.inc).
Warning: opendir(modules/block/tests/themes/block_test_theme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/boysday.org/includes/file.inc).

what do you say...!? ,look forward to hear from you!!


texts:
We seem to be experiencing a very unexpected problem.

We have created a custom entity called feature and it has a uid property. The schema is as follows:

$schema['feature'] = array(
  'fields' => array(
    'fid' => array(
      'description' => 'feature id',
      'type' => 'serial',
      'not null' => TRUE,
    ),
    'bundle' => array(
      'description' => 'bundle name',
      'type' => 'varchar',
      'length' => 32,
      'not null' => TRUE,
    ),
    'nid' => array(
      'description' => 'Node ID.',
      'type' => 'int',
      'not null' => TRUE,
    ),
    'tid' => array(
      'description' => 'Taxonomy Term ID.',
      'type' => 'int',
      'not null' => TRUE,
    ),
    'uid' => array(
      'description' => 'User ID.',
      'type' => 'int',
      'not null' => TRUE,
    ),
    'created' => array(
      'description' => 'created timestamp',
      'type' => 'int',
      'not null' => TRUE,
    )
  ),
  'unique keys' => array(
    'primary key' => array('fid'),
    'nid-tid-uid' => array('nid', 'tid'),
  )
);

An entity is then picked up with

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'feature')
  ->entityCondition('bundle', 'disabled')
  ->propertyCondition('tid', $tid)
  ->propertyCondition('nid', $nid)
  ->addMetaData('account', user_load(1));
$result = $query->execute();

if (isset($result['feature'])) {
  $features = entity_load('feature', array(reset($result['feature'])->fid));
  $feature =  reset($features); // $feature here as the wrong uid
}

However, no matter what permutation I try, the uid is always set to 1.

The database has the correct information - so the data is being stored correctly.

The entity has views integration and pulling the data in through views works correctly as well.

Outputting the $feature always gives a uid = 1.

I even have traced through the EntityAPIController with little luck.

I tried loading an unrelated entity (Field Collection Item). This entity does not have a uid field. However, after entity_load it seems that a uid property is set.

Does this mean that having a uid property on an entity is just not possible? There does not seem to be any documentation to suggest that this is the case though.

I know that I can just rename it to aid or something else but am curious as to the cause here.

Thanks...


texts: querying content type via drupal database API

texts:
Using Drupal 7 I have created a content type called 'fauna'. I simply want to filter by an attribute (eg: 'area') using Drupal database API.

As far as I have seen around, most of people follow queries like...

$query = db_select('my_table_name')

applying then some filters.

But I have no table at all regarding my content type where I could apply these filters, i just have a bunch of tables field_data_field_fauna_name, field_data_field_fauna_area ... (these are the fields defined for my Content type).


texts: Building a view programmatically fails when filtering specific nids but not others

texts:
I am quite stuck with this, so I hope you can help me out…

I have a view which filters (contextual filter) by 'nid'. I have two 'filter criteria's (view ui):

Published
Node type

I want to embed that view in a page programmatically through an Ajax call. I have discovered it sometimes returns the correct node and sometimes not. It depends on the specific node so for example it always retrieves the node nid = '4' and it never does for nid = '35'

Trying to figure out where the problem comes from I have tried few things. For example: I have tried to embed the view using panels, just for testing, using arguments for the contextual filter. It always work (always retrieve the correct node) this way. But when I call the view programmatically from a form building function (the one I use inside 'drupal_get_form()'), it just work with some nodes (some values of nid).

I am using devel for debugging and, when the view doesn't returns results,

$view->build_info['fail'] = TRUE

Here is the way I call the view:

$view = views_get_view('proyecto_en_arquitecto');
$view->init();
$view->set_display('block_1');
$view->set_arguments('35');
$view->execute();
dpm($view);  //Here is where I can see the building process fails

I am lost as I don't have a clue of why it just works with some nodes…

I hope you can point me to the right direction.

Thanks in advance for your help and let me know if you need further information.


texts: Nodes vs Enties : consequences on search requests

texts:
I have to store a large amount of content in drupal.

I'm wondering if it's better to split it in different entities to increase performances, or to put all in the node tables (so everything will be in the same tables : books, authors, editors, and so on...)

I'm prefering the entities way, but what about the search performances ?
Is the search API able to check different entities ?
Is the search speed going to really slow down ?

Thanks :)


texts:
I am on 8.3.3 and I would like to update jquery and jquery ui to the latest stable version of both. I do not want to update drupal core only jquery and jquery ui.

Anyone knows how to do that?


texts: How to return a DatabaseStatementBase object

texts:
I have a method that extends the execute() method used in the Drupal 7 database abstraction layer.

When used with db_query, such as:

$result = my_extended_db_query("SELECT * FROM {node} WHERE nid<100")->execute();

$result holds a DatabaseStatementBase object, whether there are resulting rows or not. However, following:

return $result;

the calling function receives an empty array if there had been no query results, instead of a DatabaseStatementBase object. Because of this, ->fetchAll() fails because it is attempting to operate on a non-object.

How do I get my return to arrive as the same object is started as?

The method:

public function execute() {
$sql = $this->sql;
switch ($this->function) {
  case 'db_query':
    if ($this->args) {
      $args = $this->args;
      uksort($args,"si_stats_sort_by_length");
      foreach($args as $name => $value) {
        $sql = str_replace("{" . $name . "}",$value,$sql);
        if (is_array($value)) {
          $sql = str_replace($name,"('" . implode("', '",$value) . "')",$sql);
        } else {
          $sql = str_replace($name,"'" . str_replace("'","''",$value) . "'",$sql);
        }
      }
      try {
        $query = db_query($sql);
      }
      catch (Exception $e) {
        // log the error
        $msg = $e->getMessage() . "\n";
        $msg .= $e->getTraceAsString() . "\n";
        mylog($msg . PHP_EOL . PHP_EOL . $sql, debug_backtrace(), LOG_ERROR);
      }
      return $query;
    } else {
      try {
        $query = db_query($sql);
      }
      catch (Exception $e) {
        // log the error
        $msg = $e->getMessage() . "\n";
        $msg .= $e->getTraceAsString() . "\n";
        mylog($msg . PHP_EOL . PHP_EOL . $sql, debug_backtrace(), LOG_ERROR);
      }
      return $query;
    }


texts:
I'm creating a custom field in my Drupal 8 installation in which you can select brand and model of some cars.

So if I select Audi from a select list, the next select list will make you select only Audi models.

It's the same appereance of the "Hierarchical select" module, but I cannot use taxonomy and my data is taken from fields of nodes

The problem is, there is something wrong

I have my formElement function where i create the widgets

public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
    $marche=$modelli=$alimentazioni=array();
    $terms = \Drupal::entityManager()->getStorage('taxonomy_term')->loadTree('marche');
    foreach($terms as $term)
        $marche[$term->tid]=$term->name;

    $terms = \Drupal::entityManager()->getStorage('taxonomy_term')->loadTree('modelli');
    foreach($terms as $term)
        $modelli[$term->tid]=$term->name;

    $terms = \Drupal::entityManager()->getStorage('taxonomy_term')->loadTree('alimentazioni');
    foreach($terms as $term)
        $alimentazioni[$term->tid]=$term->name;

    $element['usato_marca'] = array(
      '#type' => 'select',
      '#title' => $this->t('Marca'),
      '#options' => $marche,
      '#ajax' => array(
        'callback' => [$this, 'ajaxHandlerMarca'],
        'wrapper' => 'usato_modelli_ajax',
        'event' => 'change',
        'method' => 'replace',
        'progress' => array(
            'type' => 'throbber',
            'message' => NULL,
        )
    )
    );

    $element['usato_modello'] = array(
      '#type' => 'select',
      '#title' => $this->t('Modello'),
      '#options' => $modelli,
      '#prefix' => '
',
      '#suffix' => '
'
    );

    $element['usato_alimentazione'] = array(
      '#type' => 'select',
      '#title' => $this->t('Alimentazione'),
      '#options' => $alimentazioni
    );

    $element += [
      '#type' => 'fieldset',
    ];

    return array('value' => $element);
  }

and the callback function

public function ajaxHandlerMarca(array &$form, FormStateInterface $form_state) {
        $form = $form_state->getCompleteForm();
        return $form['usato_modello'];
    }

The ajax is triggered from the first select, but it always gives the error "Undefined index: usato_modello", but there is, what am I missing?


texts: How not to "fill up" a view when flagging

texts:
I have a list of different tasks (about 100 items). Each time a user logs in, he should get a display of 5 tasks randomly selected out of this list. When he finished the task, he can flag them as "done" and the task will disappear from the list. I managed to do this with flag module and views module.
The problem is, that the task-list is much longer than the 5 tasks. So each time the user flags a task with "done" this task will disappear from the list, but a new task will show up at the same time.
How can I stopp a view to be "filled up" in order that the user can empty his task list? (And may be gets new tasks only the next da or on next login).


texts: How can I query a database created using the previous core version from the new core version?

texts:
I want to query users, nodes etc in my D7 database that I am currently migrating to D8 to compare with the migrated content.

I want to use custom Drush commands to run some checks.

Is this possible?


texts: It is possible to alter the $form_state['redirect'] of a previous submit callback?

texts:
For example:

function awd_form_alter(&$form, &$form_state, $form_id){
    dpm($form_id);
    if(substr($form_id, 0,22) == 'eck__entity__form_edit'){
        $form['actions']['submit']['#submit'][] = 'submi';
    }
}

function submi(&$form, &$form_state){
    unset($_REQUEST['destination']); // this doesn't seem to work though
    unset($form['#redirect']); // i think this doesnt do anything because $form is not a reference
    $form_state['redirect'] = '<front>';
}

Thing is, the original submit callback (eck__entity__form_submit) from ECK module has already a $form_state['redirect'] and i want to alter that with out overriding the original submit callbcak function

I got it by unsetting the original callback from the $form in my hook_form_alter, copy paste the submit callback function into my module and then change the redirect but looks hacky. I also tried commenting the 2 lines at eck.entity.inc:495 but does the same, does not respond to my $form_state[redirect]


texts: How can I change the temporary file directory path without the UI?

texts: In Drupal 8, Is there any way to change the temporary file directory path if I don't have access to the UI page /admin/config/media/file-system, either with Drush or by modifying a config file?


texts: Views Pager Add rel="nofollow to ALL Pager Links

texts:
In Drupal 7 I am trying to add rel="nofollow" to ALL of the pager links in views. The closest I have got is to add the nofollow to next links, but I want it to include previous pages as well as "First" and "Last".

P.S. We specifically want the rel="nofollow" attribute to all pager links, we are not looking for other solutions (noindex, block with robots.txt, or rel=next/prev).

This is the code I am currently using:

function mytheme_pager_next($variables) {
  $text = $variables['text'];
  $element = $variables['element'];
  $interval = $variables['interval'];
  $parameters = $variables['parameters'];
  global $pager_page_array, $pager_total;
  $output = '';
  // If we are anywhere but the last page
  if ($pager_page_array[$element] < ($pager_total[$element] - 1)) {
    $page_new = pager_load_array($pager_page_array[$element] + $interval, $element, $pager_page_array);
    // If the next page is the last page, mark the link as such.
    if ($page_new[$element] == ($pager_total[$element] - 1)) {
      $output = theme('pager_last', array('text' => $text, 'element' => $element, 'parameters' => $parameters,'attributes'=>array('rel'=&gt;'nofollow')));
    }
    // The next page is not the last page.
    else {
      $output = theme('pager_link', array('text' => $text, 'page_new' => $page_new, 'element' => $element, 'parameters' => $parameters,'attributes'=>array('rel'=>'nofollow')));
    }
  }
  return $output;
}


texts: Multiple locations (longitude,latitude) in theme

texts:
I have to put multiple gmap markers in a map. The catch is... The location field is in the theme itself (longitude,latitude) no gmap module. I tried to enter 2 values separated by a comma but it doesn't work. I'm not very good with PHP but i have this in theme-settings.php:

// Cocoon Map Settings: Latitude

$form['cocoon_options']['cocoon_map_settings']['map_latitude'] = array(
    '#type'          => 'textfield',
    '#title'         => t('Map Latitude'),
    '#default_value' => theme_get_setting('map_latitude'),
    '#description'   => t("Latitude for the map address."),
  );

// Cocoon Map Settings: Longitude

 $form['cocoon_options']['cocoon_map_settings']['map_longitude'] = array(
    '#type'          => 'textfield',
    '#title'         => t('Map Longitude'),
    '#default_value' => theme_get_setting('map_longitude'),
    '#description'   => t("Longitude for the map address."),
  );

And this part in the page--front.tpl.php:

<?php if (theme_get_setting('show_map')): ?>
        <div id="map-canvas" data-lat="<?php print (theme_get_setting('map_latitude')); ?>" data-lng="<?php print (theme_get_setting('map_longitude')); ?>" data-zoom="10" data-style="style-2">

            <a data-lat="<?php print (theme_get_setting('map_latitude')); ?>" data-lng="<?php print (theme_get_setting('map_longitude')); ?>" data-string="<?php print (theme_get_setting('map_marker_text')); ?>">

    <?php endif; ?>

Can someone help me with this one?
Thanks!


texts: How do you delete a content type's URL aliases in bulk?

texts:
I have a content type where I want to delete all of its URL aliases in bulk. Currently the pathauto url alias page only has the option to delete all content url aliases regardless of what type it is.

How can you delete url aliases in bulk matching only a specific content type?

Also would it be okay to delete the url_aliases via phpmyadmin? I'm not sure if the url_aliases table is linked to something else.


texts: Limit number of nodes that can exist of a certain content type based on CCK term reference field input

texts:
I have a content type with an autocomplete term reference field.  I want to control the number of nodes that can exist as published with the same term reference.  Any number of these nodes would be able to be created, published, unpublished and deleted, but only a specific number would be able to exist as published at any given time.

It looks like this module doesn't quite do this:  Node Limit


texts:
I'm struggling with simplesaml and would appreciate any help. I've got it all working between two sites (an IDP and an SP) but I cannot get automatic login to function. I've been trying the code at this page:

https://drupal.org/node/1318908

In short, if the content requires authentication I want the page to be automatically forwarded to saml_login (instead of having to click "federated login"). If the content is public, then I want login to be bypassed.

Is that possible? If not, is there another SSO method that can be used?


texts:
I am trying to understand the Drupal database schema because I need to access the database via MySQL by another system and I do not have access to the original Drupal developer of the site nor do I know Drupal well at this point (I did work with it 8 years ago) and it will be much easier to access with MySQL than to set up a server to have to host a PHP-based API or similar.

file_usage

In the file_usage table there are two (2) field module and type and using a GROUP BY query this is what I get:

module | type
-------|-------
 file  | node
 imce  | file
 user  | user

So it is pretty obvious that module means that entry was added by either the file, imce or user modules, right?

My questions are:

What does node, file and user mean in this context?
Is file/node effectively the same as imce/file, or is it
something different?
Does user/user mean it is a file associated with the user?
Further file_usage has an id column; can I assume:

That nid for file/node and imce/file?
And uid is for user/user?
Or something else?

NOTE: I do not have access to the working Drupal system, I only have access to the database.


texts:
I created a custom entity, next I enabled (via RESTui) the GET and POST methods. I gave anonymous users permissions to "Access GET", "Access POST" and "Create new content" of that entity.

When I navigate in my browser to "http://mywebsite/my_entity/1?_format=json", I get a proper JSON response. When I navigate to "http://mywebsite/my_entity/add", I can add a new entity.

When I try to POST a new entity via "http://mywebsite/my_entity?_format=json", I get a 403 repsonse with following body:

  {   "message": "" }

Does someone have an idea what I'm missing here?

EDIT: When i put a die('give me something') in the method post() of the class "EntityResource" (which is the base class for all entities), the message isn't displayed...

EDIT2: I added headers "Content-Type" and "X-CSRF-Token"


texts: Drupal installed in the web root but not at the base of the domain name

texts:
If I was to have my site in the web root, for example /var/www/ but the path to my site is http://example.com/drupal, how do I configure the base path etc.

If I set my base path to http://example.com/drupal it doesn't seem to work unless the site is also in a subdirectory (ie. /var/www/drupal/).

I know I can easily just move the site to /var/www/drupal/, but I'm curious to know if it is possible to do it at /var/www/ with just drupal config.


texts:
I am using entityform module on subscribing certain organic groups forms.
I only need to add some custom submit logic when unsubscribing the form if the subscribe form was created with entityform.

Depending on if the subscribing form was generated by entityform, when unsubscribing I need to do some custom logic to clean up the DB from entity data not covered by entityform.

I am using hook_formID_alter, and this is my $form array:

The thing is I need to do a database clean up if it was submited with entityform in the first place, even though I understand the unsubscribe form is not a entityform.

Therefore, this doesn't work: if (isset($form['#entity_type']) && $form['#entity_type'] === 'entityform')

Can you help me identify programmatically which kind of form is the form?


texts: Create basic field data in template like node for custom entities {{ custom_entity.id }}

texts:
I see node preprocess does this
$variables['node'] = $variables['elements']['#node'];
and then in the template one can do this
{{ node.id }}
but when I create a custom entity and do the same,  I never get past all the the errors like
Exception: Object of type Drupal\Core\Field\FieldItemList cannot be printed. in Drupal\Core\Template\TwigExtension->escapeFilter() (line 476 of core/lib/Drupal/Core/Template/TwigExtension.php).

What are they doing special for node?


texts:
With which drush command can I update my Drupal 7.36 to 7.41?

I have tried so far the followings:

drush up drupal
drush pm-updatecode

But nothings has changed in either the code nor when I look at the currently pending updates.


texts: How to get select option id value in form api

texts:
Hi hello please help how to get dynamically selected option id value (i.e #options=>0=>'bala',1=>'kumar')

for example
how to get selected value of ID value in form api in drupal

$form['state1']= array(
  '#type' => 'select',
  '#title' => t('State'),
  '#options' =>$options_state,
  '#required' => TRUE,
  '#ajax' => array(
    'callback' => '_ajaxfunction',
    'wrapper' => 'divaroundseconddropdown'
  ),
);

the selected value store in $key value, please help me how to do....

$key = !empty($form_state['values']['state1']) ? $form_state['values']['state1'] : 1;

is this correct???


texts: How to implement a calendar based system for loaning of equipment?

texts:
I have looked MERCI over and it appears to be a great module but sort of like swatting flies with sledgehammers. We are a public library support agency and, among other items, we offer month long loans of 3D printers.

I'm looking for a way to implement a simple item registration system, that is calendar based so monthly calendars can be printed.

I like Basic Cart but need more of a library loan approach than a sales approach.

Any suggestions?


texts:
I am completely new to Drupal albeit I got some strong knowledge of Plone. I understand my difficulties might come from the 2 CMS have somewhat different ways to layout things.

I have read the "Structure guide" on Drupal website and I am quite puzzled about how to organise the site nodes. I intend to create a file-system-like hierarchy of nodes. While creating nodes by themselves is quite easy I can't find how to easily organise them. Am I right to understand I need to add tags to each and every node, then to use taxonomies to make hierarchies of tags?

I read Node Hierachy: Change Parent in Bulk which gave me some hints but unfortunately setting the parent element does not work for articles.

Is it not possible to browse the web site to some node then "Add content" as a child node of the displayed node and have this (and every subsequent) child added to an automatically generated menu? Or maybe I need some module for this?

Thanks in advance, I fear I'm completely lost!


texts: In terms of performance, is it better to lazy load, inline, or hook_init a Javascript library?

texts:
I'm working on a module to embed Highcharts into nodes. Other chart modules provide a PHP helper function to trigger the necessary library loading. To avoid enabling the PHP module, I tried creating an input filter with a token for loading the Javascript library. Unfortunately, filter output gets cached, so calls to drupal_add_js within a filter function don't get called on every page load.

I can think of a few workarounds:

a small inline script to load the library, after a node containing a chart has loaded
embed the whole library file inline, on pages where it's needed
load the library on every page, via hook_init

From a performance perspective, what is my best option?

For what it's worth, the compressed Highcharts library is 81k. The site I plan on using this on has Javascript aggregation enabled, but few content items will have charts, especially initially. Plus, I'd like to contribute the module on d.o, so I'd like to solve this in a way that would make sense on most sites.


texts: Large file uploads stop immediately, 404 error

texts:
I am having a weird problem with uploading large files in the Drupal admin's file field. I have the size limit set to 500 MB. I also have the php.ini settings for upload size, post size, and memory all set to 500 MB.

When I upload a smaller file like 50 MB everything works perfectly. If I upload a larger file such as 250 MB then the upload fails immediately and I get a 404 error in the Network tab of the Chrome inspector.

The 404 error is on this URL: http://example.com/file/ajax/field_video_file/und/0/form-tpohUDjq_v0b7OcNhtnQl2TaRc5UcFl9zwJQzI3mlwE

The server is running IIS 7.5.

Any ideas what could be causing this?

Thanks!


texts: Add print button in the "Review order" page

texts:
I want to know, is there any way to add print button to "Review order" page.

by clicking this button, a pop up page is loaded with good style for print mode and user can print the cart items , taxes and all information in Review order page.

Please guide me.


texts:
As part of Drupal 8 site install/deploy, I want to create content so that the site is functional and ready to use.

For example, whenever I install the site, there should be a home page node created.

How do I create content during site installation?


texts: Client-Side form validation issue with Fivestar module?

texts:
I've set up my review system of my Drupal 7.x site some what like mentioned in this http://drupal.org/node/1308114 and I've also set that field as "Required" but it seems that "Required Field" is not working since, its allowing user to submit the review without rating the article, for that I've created my custom module containing

<?php
/**
 * Implementation of hook_form_alter()
 */
function rishihrvalidate_form_alter(&$form, $form_state, $form_id) {
    $form['#attributes']['onsubmit'] = 'return comment_cs_validate()';
    if ($form_id == 'comment-form'){
  }
}

calling the JavaScript

<script type="text/javascript">
      function comment_cs_validate() {
        if ($('#edit-field-review-value div div').hasClass("on") && $('#edit-field-review-atmosphere div div').hasClass("on") && $('#edit-field-review-service div div').hasClass("on")) {
          return true;
        }
        else {
          alert ('You must rate the listing before submitting your review');
          return false;
        }
      }
    </script>

Though the above PHP code was not perfect, it was executing correctly and behaving as desired only the problem I'm getting is while logging on my site also its taking place since I've called all the submit buttons, hence I changed the from that above one to this, but now I'm getting nothing, may I know where I might be lacking?

<?php
/**
 * Implementation of hook_form_alter()
 */
function rishihrvalidate_form_alter(&$form, &$form_state, $form_id) {
    if ($form_id == 'comment_form') {
        $form['#attributes']['onsubmit'] = 'return comment_cs_validate()';
    }
}

I'm not getting where is the mistake, can someone help me in this issue?

Thanks in Advance :)


texts: View module diplaying wrong content type extra

texts:
I am having a problem with the views module in Drupal. Everytime I add a new content type, views will display an other content type. I have tried different things, but I can't figure it out. Any help will be appreciated.

Here is the link:
http://carlosgandara.com

Here is my view settings...
Quotes is the only content type that I want to display.

Here is the quote block, but every time I add an other content type. For some reason, it replaces the content with the other content type.


texts: Show slideshow without thumbnail through colorbox in Views

texts:
Within Drupal, I am loading slideshow through thumbnail. The problem with Colorbox is, that it also loads the thumbnail.

I am really hoping to find the solution where clicking on thumbnail would load the slideshow but without the thumbnail.

I am using Drupal 7, and creating the colorbox slideshow through Views.

The HTML which shows the colorbox is:-

HTML

Now, since I just want to show thumbnails on the page, I am hiding the slideshow images through:-

CSS

ul li.first {
  display: block;
}
 ul li {
  display: none;
}

P.S. (In View), I rewrite results for the multi-image field through the following to generate the upper HTML list of images.

In this way, I did show only thumbnail on the page and a slideshow is loaded when I click, but how can I hide the thumbnail in the slideshow?

Thanks.


texts: How to create node navigation to cycle through nodes of specific content type

texts:
I would like to add node navigations (prev - next) at the bottom of each node of a specific content type so that I can cycle through all the nodes for that content type.
Here is an example (scroll to the bottom of the article) http://happycog.com/work/blackhills.  You'll notice that there are navigation links that take you to the previous or next article.

I'd appreciate any guidance on how I can accomplish this.  I've looked at various contrib modules but none have given me the result I am looking for.

Thank you,

mario


texts: Migrated Servers now 500 Error _db_error_page('Access denied f...')

texts:
Moved servers, copied all files and database and set server settings to match old server. Updated settings.php with new database credentials and tripled checked them for the correct information. Console gives me a truncated error message so I don't know the exact problem.

[21-Feb-2019 15:02:21 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function ereg() in /public_html/includes/file.inc:1034
Stack trace:
#0 /public_html/includes/file.inc(1032): file_scan_directory('themes/pushbutt...', '\\.info$', Array, 0, true, 'name', 1, 1)
#1 /public_html/includes/common.inc(2888): file_scan_directory('themes', '\\.info$', Array, 0, true, 'name', 1)
#2 /public_html/modules/system/system.module(868): drupal_system_listing('\\.info$', 'themes')
#3 /public_html/includes/theme.inc(493): _system_theme_data()
#4 /public_html/includes/theme.maintenance.inc(51): list_themes()
#5 /public_html/includes/bootstrap.inc(1221): _drupal_maintenance_theme()
#6 /public_html/includes/database.inc(176): drupal_maintenance_theme()
#7 /public_html/includes/database.mysqli.inc(78): _db_error_page('Access denied f...')
#8 /public_html/includes/database.inc(15 in /public_html/includes/file.inc on line 1034


texts: How to organise content using public, private and semi-private groups?

texts:
I'm building a community website with Drupal Commons and I need to be able to create 3 kinds of groups:

public groups : anyone can view content, group members only can post/edit/delete content
private groups : group members only can view/post/edit/delete content
semi-private groups : authenticated users can view content, group members only can post/edit/delete content

How can I achieve this?


texts: Drupal 7 block api, is this custom module correct?

texts:
This is my first time attempting at writing a custom module i had a quick look over the api but forgive me if its wrong

We have been having some small issues regarding the drupal core blocks, the main page content block completely disregards the weigh assigned to it, and we are stumped for clues, no help or ideas have been found from posting on drupal or extensively searching google.

The final option we have is to manually overwrite the weight, i threw this together quickly

 <?php
 funtion hook_block_info_alter() {
$blocks['Main page content'] = array(
    'weight' => ('-9999'),
    );
 }
 ?>

Would that successfully overwrite the weight of the main page content block?


texts: When to filter search results with facets programmatically

texts:
To group search results and display them in different blocks i want to filter
them programmatically with facets.

I found a Solution,
where the view is executed only with a new request object.

term = searchword
content = facet field

function theme_preprocess_views_view__search_view__page(&$vars) {
    $view = Drupal\views\Views::getView('search_view_groups');
    $view->setDisplay('block_groups');

    $filters = [
        'term' => $vars['view']->getRequest()->query->get('term'),
        'content' => ['bereich:80']
    ];

    $request = new Symfony\Component\HttpFoundation\Request($filters);
    $view->setRequest($request);
    $view->execute();

    dump($view->result);
    dump($view->getRequest());
}

The code works with params from the real request, but i can't change them in the hook. So i guess i use the wrong hook.

When should i run the filter? Which is the correct hook for that?

Setup:
Drupal: 8.3.5
facets: 1.x-dev
search_api: 1.3


texts: How do I add images in pager for views nivo slider?

texts: I am using Views Nivo Slider for displaying a slideshow of banner images on my site. And i wish to show the pager in the form of images. I tried using Image pager in views slideshow and it worked there. But there are no settings specific to adding an image preset for it. I was able to add numbers instead of bullet. Please suggest a way to add image particularly.


texts: Site Down for few minutes after clearing cache

texts:
My site is going down every time whenever I am clearing the cache. Site will works again in 5-10 minutes after refreshing web page 2-3 times.
Also I am getting 500 internal server error after clearing the cache.
After refreshing web page 2-3 times site is working fine as before.
Additional information as follow.

Drupal 7
Boost
APC
Apache web server

Can any one put some light on above issue.

Edited

Apache error logs
[Tue Jul 07 08:51:12 2015] [warn] mod_fcgid: read data timeout in 40 seconds, referer: xxxxxxxxx.com

[Tue Jul 07 08:51:12 2015] [error] [client xx.xx.xx.xx] Premature end of script headers: index.php, referer: xxxxxxxxx.com PHP Warning: Module 'apc' already loaded in Unknown on line 0

[Tue Jul 07 08:51:18 2015] [warn] mod_fcgid: process 26541 graceful kill fail, sending SIGKILL PHP Warning: Module 'apc' already loaded in Unknown on line 0 PHP Warning: Module 'apc' already loaded in Unknown on line 0


texts:
I'm trying to create a custom token. I've already successfully implemented hook_token_info, and the token shows up. However, whenever I insert a the token [site:chosen-school-year] wherever I'm able, it doesn't show up.

Here's the code to implement the token:

function capstone_tokens_tokens($type, $tokens, array $data = array(), array $options = array()){
    $replacements = array();
    $sanitize = !empty($options['sanitize']);

    if ($type = 'site'){
        foreach ($tokens as $name => $original) {
            switch($name){
            case 'chosen-school-year':
                $replacements[$original] = getSelectedSchoolYear();
                break;
            }
        }
    }

    return $replacements;
}

getSelectedSchoolYear() is a function that I use in a different location that works as it's meant to.

I've compared my code to the samples provided here and here, and haven't found any clear discrepancies between my code and theirs. I have tried clearing the Drupal cache, but that didn't provide any results. Is there something else in the system that I should be checking/trying?