texts: How to define text css style in my themes folder to work with wysiwyg editor?

texts:
Bold text and Italic text are not working in ckeditor and I think it is because I have sites/all/themes/mytheme/styles/mytheme.css somehow not communicating with it.

Other text formats like strikethrough and underline are working fine for ckeditor.

So do I need to declare a property in mytheme.css to allow the editor to work?

I don't have the eric meyer reset file included or anything , just the add on css changes I made to my theme but don't see how that is stopping the strong and italic tags from not working because my changes were made for specific div ids.


texts: Why is hook_forms form callback not reached?

texts:
In my custom_apps.module file I'm trying to implement the same form multiple times with different ID's and for that in a loop I call for:

drupal_render(drupal_get_form('driver_route_'.$delivery_nid, $args));

I have a hook_forms function:

function custom_apps_forms ($form_id, $args) {
    // If driver route form
    if (0 == strpos($form_id, 'driver_route_')) {
        // Call one of the multiple forms
        $forms = array();
        return $forms[$form_id] = array(
            'callback' => 'driver_route_form',
            'callback arguments' => array($form_id, $args),
        );
    }
    return array();
}

And the driver_route_form() function itself:

function driver_route_form(&$form_state, $form_id, $args) {...}

However for some reason the driver_route_form never gets called and instead I get this notices/warnings:

Notice: Undefined index: driver_route_55 in drupal_retrieve_form() (line 806 of /var/www/website/public_html/includes/form.inc).
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'driver_route_55' not found or invalid function name in drupal_retrieve_form() (line 841 of /var/www/website/public_html/includes/form.inc).

It seems as if it's still trying to look for a function with the form_id not the one defined in my callback. What could be the casue of this? I have made sure the inside of custom_apps_form where the form is returned is reached.


texts: Find a URL inside Twig file from content made from another content type (referenced/ has a relationship)

texts:
I'm new to Drupal, and have stumbled across this issue.
I have entries (entry) that are blogs held inside a blog_listing. E.g.
{% for entry in content.field_blog_listing_entries|field_target_entity %}

{{ entry.title.value }}

{{ entry.field_blog_excerpt.value }}

{% endfor %}

The blogs are their own entries that have automatically generated URLs. e.g. Blog 1 can be found on blogs/blog-1.
How do I get this URL from within the code block above?
I want to access the value in the same manner that I do with the title and field_blog_excerpt to put into an anchor tag. I've tried the same method e.g. entry.url.value & entry.field_blog_url.value but these don't return anything.
How do I access this URL value?
Any help appreciated.


texts:
Working on a project on localhost, for which I installed the backup_migrate module, it seems one update procedure for this module had some problem (can't really remember what). And now every time I update any module (even totally unrelated), when performing the "update.php" script, Drupal states that there's the following pending update for the backup_migrate module:

7303 - Add a serial id field to all tables to allow them to be ctools exportable.

If I click apply, I get the usual progress bar, then the following error message:

backup_migrate module
Update #7303

Failed: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key: ALTER TABLE {backup_migrate_sources} DROP PRIMARY KEY; Array ( ) in db_drop_primary_key() (line 2904 of C:\xampp\htdocs\my_site\includes\database\database.inc).

So it seems to me that the update job #7303 has already been applied successfully, but for some reason Drupal hasn't registered that and thinks it still needs to be done.

How can I correct that?


texts:
I'm hoping to get some opinions on the best way to proceed.  We are migrating our website from a Microsoft Environment to Drupal 7 and I appear to be having trouble wrapping my head around how to do a couple of things.

We have about 50 locations, and each location might have any number of workers.  I have created 2 content types, Location & worker.  What I want to do is to create a "view" (for lack of a better term) which will list all of my locations grouped by county.  No problem.  Now, when the user clicks on one of the locations, I want to show the data for the location (address, phone number, etc) but I also want the location content type to be able to pull a list of workers (from the worker content types) that are at that site.

I have a common field in each content type of location_number, so basically what I need to do is a SQL JOIN operation.  I've looked into the Views module and it seems that using that I would have to create a separate view for each location (unless I'm missing something), when what I really want to do is create a more 'generic' view which I can plug into node template and have it auto-generate what I need.  I don't want to have to manage 50+ views.

My first instinct is to say write some custom PHP code that gets the data I want.  In SharePoint, I would just write a web part with a simple LINQ query right back to the 2 lists and plug it into the page.  Is there something similar in to this in Drupal or is there an easier way to go about what I"m trying to do.

Any advice is appreciated.


texts: Contextual filter doesn't work with the name of the entity reference, it only works with its ID

texts: why is the contextual filter below only working the the id of the entity reference ID? I would to search by name like by "Oceanography" or "Ecology and Evolution", but i'm not sure how. If i add a relationship the contextual filter doesn't even work with the ID number. Please help. Thanks in advace.


texts: How to prevent CKEditor from replacing spaces with  ?

texts:
I'm using CKEditor 4.2 with D7 and the editor is replacing every space with an HTML non-breaking space. For instance, if I type: This is a paragraph and then either save or view source, I'll get the following:

This&nbsp;is&nbsp;a&nbsp;paragraph.

I don't have any HTML correctors/prettifiers running as filters and I'm banging my head against the wall trying to figure out what's causing this.

Oh, I also have Convert all applicable characters to HTML entities. unchecked, so that's not it.

Has anyone seen this before? Any solutions out there?


texts:
Ok, so this is a weird one...

I have a HEADless Drupal that I'm using to serve webform submissions. The webform module stores all files as private files.

The issues I'm having is if I view the submission in the angular app as the user that submitted the webform (owner) all the files come back fine. If I try to view the submission as a different user the files come back 403 forbidden. All of the other REST data comes back fine.

Then if I go back and view the submission as the owner again the files are now 403 forbidden for the owner as well. The only way I can get the owner to get a 200 response and see the files again is to flush the cache.

Other users viewing those files seem to lock the files down for the owner as well.

Viewing the webform submission in the actual Drupal has no issues.


texts: How can I create search for one vocabulary?

texts:
I create taxonomy called Cities. And I create vocabulary for this Paris,Lyon and ... .

How can I found for example "best day" search in search module for paris vocabulary When I'm in paris vocabulary page ( localhost/taxonomy/term/1 [paris vocabulary]) and just show titles have "best day" in "paris" ?


texts: How can I only show the current book on book navigation?

texts: I have a list of books and I would only like to see the current book on the book navigation. How can I achieve that?


texts:
I want to set load more functionality using entity query, i have load all user data using entity query and set range condition and sorting condition, my scenario is i want to load all the data in descending order by drupal field, so for that i have called simple ajax in js file with drupal function url, and in the js file passed the offset value and that offset value i have used in entity query range condition as per below example.
JS Code :-
var count = 20;
jQuery('#score-loader-img').hide();
jQuery('div.load_more').on('click', function(e) {
jQuery('#score-loader-img').show();
jQuery.ajax({
    url: Drupal.url('geographical-scope-ajax'),
    type: "POST",
    data: {'actiton': 'GeographicalScopeAjax', 'count':count },
    success: function(response) {
        jQuery('#score-loader-img').hide();
        jQuery('.loadmore-row').append(response);
        count=count+20;
        console.log(count);
        if(count >= total ){
            jQuery('.load_more').hide();
        }
    }
 });

And for the controller php code as per below like.
$offset = 0; ( This will be change when click on load more button )
$query = \Drupal::entityQuery('user');
$query = $query->condition('roles', array('x1','x2'), "IN");
$query = $query->sort('field_x_score' , 'DESC');
$query = $query->range($offset, 20);
$uids = $query->execute();

So i want to load 20 data, if again user click on load more button show next 20 data with sorting.
Anyone have solution, it would be helpful to me Thanks.


texts: Altering existing route for translation overview page ie: entity.node.content_translation_overview

texts:
I have followed this documentation page :  https://www.drupal.org/docs/drupal-apis/routing-system/altering-existing-routes-and-adding-new-routes-based-on-dynamic-ones in attempt to alter access of translation overview page ie: www.example.com/node/1/translations
<?php

namespace Drupal\link_enhancements\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;

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

  /**
   * {@inheritdoc}
   */
  public function alterRoutes(RouteCollection $collection) {

    $route_name = "entity.node.content_translation_overview";
    var_dump($collection->get($route_name)); exit;
    if ($route = $collection->get($route_name)) {
      $requirements = $route->getRequirements();
      unset($requirements['_permission']);
      // if both role then only we will allow ...code will go here.....
      $route->setRequirement('_access', 'FALSE');
    }

  }

}

services:
  link_enhancements.route_subscriber:
    class: Drupal\link_enhancements\Routing\RouteSubscriber
    tags:
      - { name: event_subscriber }

But below route output is null and similar code works for other routes but requirement to alter translation overview route which returns null.
$route_name = "entity.node.content_translation_overview";
    var_dump($collection->get($route_name)); exit;

core/modules/content_translation/src/Routing/ContentTranslationRouteSubscriber.php
route is added in core module by below code and I have searched and tried but not sure how can we alter such routes, please suggest.
if ($entity_type->hasLinkTemplate('drupal:content-translation-overview')) {
        $route = new Route(
          $entity_type->getLinkTemplate('drupal:content-translation-overview'),
          [
            '_controller' => '\Drupal\content_translation\Controller\ContentTranslationController::overview',
            'entity_type_id' => $entity_type_id,
          ],
          [
            '_entity_access' => $entity_type_id . '.view',
            '_access_content_translation_overview' => $entity_type_id,
          ],
          [
            'parameters' => [
              $entity_type_id => [
                'type' => 'entity:' . $entity_type_id,
                'load_latest_revision' => $load_latest_revision,
              ],
            ],
            '_admin_route' => $is_admin,
          ]
        );
        $route_name = "entity.$entity_type_id.content_translation_overview";
        $collection->add($route_name, $route);
      }


texts: In Drupal 7 Commerce, how do you change the "View Cart" link in the cart block to something else?

texts:
In the Cart Block in drupal 7 commerce. How do you change the "View Cart" link. I want to change it to Edit Cart instead.

http://img853.imageshack.us/img853/2502/8yfy.jpg


texts: Recover content from "story" after content type was deleted accidentally

texts:
in a very stupid action, I accidentally deleted the "Story" content type which had a lot of content. Just to be clear: I didn't delete the content, only the content type. When I realized what I was doing, I pressed esc, so I got a drupal message that very few content types were deleted. Still, much of the content is not in the back up. I am checking whether I can restore some of the lost content.

Apparently the titles of all stories appear normally. Unfortunately the body content is missing. I recreated the content type manually and still nothing.
But when I looked in the database, I noticed that sql tables node, field_data_body and field_revision_body actually contain the content from the nodes that were deleted.

Going further, I realized that the database entries of these sql tables have a column deleted which was set to 1 for the 'story' entries. I found an article which explains how deleted fields stay in the database and suggests to set the value of the column back to 0, if you want your deleted fields back. I did that, but still the stories display only the title and not the body.

I also looked at mysql table "node_type" and story is there. It looks exactly like page.

What can I do to convince drupal to display again the body of the stories, as it is still in these fields in the database?


texts: How to transfer data from the program's created field to the standard text, while saving the node?

texts:
Using hook_form_alter(), I created 4 form fields. When saving a node, I want to extract data from them and transferred to a standard field.

Using foreach(), I can form a string and then transfer it to the standard field, but how do I get the data from the form input, while saving material?

I use hook_node_presave($node) but it already takes $node as argument, in which there are no custom fields. I do not know how to transfer them here and already work with hook_node_presave().

$form['field_cadastral_num'] = array(
    '#type' => 'fieldset',
    '#title' => 'test',
    '#attributes' => array(
        'class' => array(
            'field-type-text',
            'field-name-property_node_form'
        ),
    ),
  '#weight' => $instance['widget']['weight'],
);
$form['field_cadastral_num']['cell'][] = array(
  '#type' => 'textfield',
  '#default_value' => '',
  '#size' => 3,
  '#maxlength' => 3,
  '#name' => 'kadastr[0]',
  '#value' => ''
);
$form['field_cadastral_num']['cell'][] = array(
  '#type' => 'textfield',
  '#default_value' => '',
  '#size' => 3,
  '#delta' => 3,
  '#maxlength' => 3,
  '#name' => 'kadastr[1]',
  '#value' => '',
  '#prefix' => ':'
);
$form['field_cadastral_num']['cell'][] = array(
  '#type' => 'textfield',
  '#default_value' => '',
  '#size' => 6,
  '#maxlength' => 6,
  '#name' => 'kadastr[2]',
  '#value' => '',
  '#prefix' => ':'
);
$form['field_cadastral_num']['cell'][] = array(
  '#type' => 'textfield',
  '#default_value' => '',
  '#size' => 3,
  '#maxlength' => 3,
  '#name' => 'kadastr[3]',
  '#value' => '',
  '#prefix' => ':'
);


texts: Importing a Database into Drupal shows no content

texts:
I've been trying to get my database imported into Drupal today and I'm having quite a few issues. I'm using VDD with Vagrant / Oracle VM and everything is working properly, I have Drupal 7 up and running with no problems. I then used the drush commands to import my database into phpmyadmin, I verified the completion of this task after somebody else suggested I used Pipe Viewer.

For the drush settings.php file I used the following:

$databases = array (
 'default' =>
 array (
    'default' =>
    array (
     'database' => 'drupal7',
     'username' => 'root',
     'password' => 'root',
     'host' => 'localhost',
     'port' => '',
     'driver' => 'mysql',
     'prefix' => '',
    ),
 ),
);

At first I was getting a configuration error as I dropped the initial db to install the new one, so I ran the install.php file and I managed to get the page to render again, but with no content besides the default Drupal stuff.

Is there some sort of trick to getting the data to display? Or some way I can verify that my database imported properly?

Any help would be greatly appreciated.


texts:
I am trying to get Drupal 8 installed on Ubuntu 18.04. I have installed LAMP and composer. I will install Drupal 8 with this (I think this is the latest recommended way) ...

composer create-project drupal/recommended-project my_site_name_dir

Where should my_site_name_dir be?

Some guides suggest it should be at apache2's web directory: /var/www/html/my_site_name_dir. And then change the directory owner to www-data (for apaches benefit?). But how then does Composer or myself write files to this directory if the owner is changed?

This guide Using Composer to Install Drupal says:

  Your 'my_site_name_dir' will contain files that should be outside of
  your web root and not  accessible by the web server. The web root will
  be 'my_site_name_dir/web'

So am I right in thinking that my_site_name_dir should not be visible by apache, but my_site_name_dir/web should be? If so how to I tell apache to find it?

I was imaging that my_site_name_dir would be somewhere in my home directory (easier for dealing with file permissions?) and I would view it in a browser with something like: http://localhost/my_site_name_dir

(I'm struggling a bit trying to grasp file ownership and how composer works.)


texts:
I'm running with a big problem for hours now and it's driving me crazy, maybe one of you already know the answer.

Drush seems to not want to work on my OSX (10.8.5) with MAMP (3.0.5). When I execute $ drush pmi I get the following output:

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

Drush was attempting to connect to:
 Drupal version        :  7.28
 Site URI              :  http://default
 Database driver       :  mysql
 Database hostname     :  127.0.0.1
 Database username     :  root
 Database name         :  db_name
 PHP executable        :  /Applications/MAMP/bin/php/php5.5.10/bin/
                          php
 PHP configuration     :  /Applications/MAMP/bin/php/php5.5.10/conf
                          /php.ini
 PHP OS                :  Darwin
 Drush version         :  7.0-dev
 Drush temp            :  /tmp
 directory
 Drush configuration   :
 Drush alias files     :
 Drupal root           :  /Applications/MAMP/htdocs/drupal
 Site path             :  sites/default

I'm running drush in the drupal folder.

I'm using 127.0.0.1 instead of localhost in my settings.php.

I have the following setup in my ~/.bash_profile:

export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.5.10/bin:$PATH"
export PATH
export DRUSH_PHP="/Applications/MAMP/bin/php/php5.5.10/bin/php"
export PATH=/usr/local/bin:$PATH

I've also created a symbolic link to mysql as follows:

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

If I run:

$ php -i | grep php.ini

I get:

Configuration File (php.ini) Path => /Applications/MAMP/bin/php/php5.5.10/conf
Loaded Configuration File => /Applications/MAMP/bin/php/php5.5.10/conf/php.ini

Which means I'm using the same PHP version either in my apache server than in drush.

Now, I have no clue whatsoever on why drush is not properly working. Maybe one of you have an answer for this and hopefully for all of us who might have encountered this problem.

Thanks in advance!


texts:
I want to get a list (dump) of routes used?

Example:

/user/register
/user/logout
/custom/route
/node/27/some-description


texts: How to create Ubercart recurring order with initial $0.00 charge

texts:
Is there any way to configure (or trick) Ubercart (7.x-3.4) into accepting an order with initial 0 charge, then subsequently charge non-zero amount?

Goal is to offer a promotion with $0.00 initial charge, then start charging after n-number months or days.

When 0 is set as the cost of the recurring product, Ubercart responds with an erroneous error about no payment method being set up.


texts: Use of a global variable ('submission counter')

texts:
I'm trying to construct a registration form (of a node) wich stores serial (ascending) values in a hidden field.
The form is open to unregistered users.
I made it with rules and variable (every time a node of type xxx is saved, the global variable is +=1 and stored in the correct field), but... If two nodes are submitted at the same time, this variable can be dupplicated.
Any ideas on how avoid this behaviour?
Thank you.


texts:
I'm installing D7 on Ubuntu 12.04. I've been following the procedure explained in this page. And this is the error I'm getting:

I've already made MySQL database called 'drupaldb'.
I've also checked PHP and it's installed and it's running. I'm configuring NGINX to run D7 on it.
Please help!


texts: Looking for an entityreference widget that allows to preselect an entity bundle

texts:
I'm using one entityreference field in many entity types (bundles) because of the convenience that gives in Panels (just one relation to add in context).

However, the drawback is that the standard entityreference widgets show one bunch of target entities, which is not userfriendly.

What I want is a widget that includes a select field for the entity type (bundle) in order to filter the select field next to it.

I saw the Entityreference View Widget but but I'm looking for something more simple, just two select fields of which the first filters the second.


texts: Programmatically (via php code) create content of a specified type

texts:
In drupal 8 I have created a bespoke content type... I now would like to create content of the bespoke content type via Php through user interaction.  For example, the user clicks a button and it triggers a function in my module which I am creating.

I have used the following code:

$node = Node::create([
  'type'        => 'article',
  'title'       => 'My title',
   ]);
   $node->save();

Which does create content in the content area of the admin panel, but... The content type column is empty?

Am sure someone will all ready have done this type of thing before so any help will be most welcomed.


texts: How to grant "edit any file" permission only to files attached to a certain node type?

texts:
The same question in other words:

How a file can inherit edit permission from node permission which is attached to?

Hi all,

I have 2 node types: articles and cars.

A file entity field is attached to both so users, through media module, can attach images to articles and cars.

Now I want a moderator role that can edit files attached to cars ONLY.

How to accomplish this?

Granting "Edit any files" to Moderator allow him to edit every files, articles attached files also, but I don't want this.

Thank you for any help


texts: How to display link to the next/previous most recent node from current node (if it does not belong to a book)?

texts:
I would like to display the next and the previous most recent node from the current node (if it does not belong to a node).

It is somewhat similar to the pager available to the book page, except here the current node as well as the links to the next/previous nodes are not in a hierarchy and do not belong to a book.

Assuming I have 4 nodes - node1,node2,node3,node4 (all belonging to a set of node types I want to use) and each published consecutively one after the other. Then if the user is on node3, he/she should see the links for node2 and node4. If currently on node2 then node1 and node3 links should show up. If they navigate to node1, then a link for node2 should be displayed and so on and so forth.

Also, the  next and previous nodes can only belong to a pre defined set of node types.

I am using D7 and wouldn't mind using either a custom function or a views block to implement this. Any ideas on how to go about it?


texts: Can node_url be accessed in page.tpl.php?

texts:
Calling debug($node) in page.tpl.php seems to show that the node object is not fully populated at this stage.

I would like to access node_url in my page template so that I can add certain CSS classes for some nodes without having to use the nid.  Is there maybe a way to access a more fully populated node object in template_preprocess_page()?


texts:
I need exactly this module: http://drupal.org/project/content_access which unfortunatly does not work anymore with drupal 7.18 and i dont want to search for the problem right now...

so is there any alternative? I need it to restrict users which are not in the role x to view certain sites.


texts: How to get the content of a node with Devel Path?

texts:
I am quite new to Drupal an would like to get the Data of a Node. With the Devel module I read out the Path to the information I like get with PHP.

$var->location['postal_code']

How can I access this path? I would like to get this info an pass to Javascript. So I think I have to access this path with PHP and then use drupal_add_js to pass it to JS. But I don`t even know where to put the PHP code.

Any suggestion?


texts: No release history available stops dependent modules download

texts:
I am creating my first make file to retrieve a custom module 'CUSTOM_MODULE' from github and running into trouble getting the dependent modules to be installed.

Here is make file at the Drupal site to install the module:

api = 2
core = 7.x
projects[CUSTOM_MODULE][type] = "module"
projects[CUSTOM_MODULE][subdir] = contrib
projects[CUSTOM_MODULE][version] = 7.x-1.0
projects[CUSTOM_MODULE][download][type] = "git"
projects[CUSTOM_MODULE][download][url] = "http://github.com/to-git-repo.git"
projects[CUSTOM_MODULE][download][branch] = "master"

To Get the custom module

 drush make someMakeFile.build --no-core --contrib-destination=sites/all

This install the CUSTOM_MODULE in sites/all/modules/contrib, however. It doesn't install all the dependencies as specified in the CUSTOM module local make file:

api = 2
core = 7.x
projects[] = audiofield
projects[] = block
projects[] = blog
projects[] = comment
projects[] = context
projects[] = jw_player
projects[] = libraries
projects[] = strongarm
projects[] = taxonomy
projects[] = text
projects[] = uuid_features
projects[] = video
projects[] = video_presets
projects[] = views
projects[] = node

When run in debug mode(--debug)

    ...
Found makefile: designssquare_com_blog.make [40 sec, 6.69 MB]                                                                                [ok]
Downloading release history from http://updates.drupal.org/release-history/audiofield/7.x [40.01 sec, 6.73 MB]                                                                  [notice]
/Users/maxit/.drush/cache/download/http---updates.drupal.org-release-history-audiofield-7.x retrieved from cache. [40.01 sec, 6.74 MB]                                          [notice]
Downloading release history from http://updates.drupal.org/release-history/block/7.x [40.06 sec, 6.74 MB]                                                                       [notice]
/Users/maxit/.drush/cache/download/http---updates.drupal.org-release-history-block-7.x retrieved from cache. [40.06 sec, 6.75 MB]                                               [notice]
No release history available for block 7.x
Returned from hook drush_make_process [40.06 sec, 6.7 MB]                                                                                [debug]
Command dispatch complete
    ...

From the first line, it is processing the local CUSTOM_MODULE make file, however. It stops on second dependent module - 'block' and doesn't continue with the rest of the modules? While i would remove 'block' module as dependent (since it is part of core), my desired behavior would be it continue with the rest of the dependent module downloads, so the deployment completes with rest of the modules downloading.  How I would specify such a behavior? Thank You

p.s. Drupal 7.x, Drush Master, Mac


texts: Deciding between (CCK) Fields and Taxonomy for a list of options. Pros and cons?

texts:
Sometimes I wonder why to choose Term reference or a regular List (float/integer/text) over the other, when I would like to "force" my users to select one or multiple values from a list.

Taxonomy vocabulary and a Term reference field pros:

new terms can be added right in the textbox (see "Autocomplete term widget (tagging)")
separate sites are created automatically for the different terms where referenced nodes are listed (no separate view has to be added, but can be if necessary)
views can easily be created
terms hierarchy
terms can be reordered easily
list of terms can be extended easily
terms are easily fieldable, which means more display possibilities when viewing a given node
?

Term reference field cons:

?

List (float/integer/text) field pros:

views can easily be created
the field is closely related to the given content type, no separate vocabularies have to be added
?

List (float/integer/text) field cons:

after adding some nodes with the given field, and going to "Field settings" for changing them, I get the message: "There is data for this field in the database. The field settings can no longer be changed." (example screenshot)
?

I would appreciate if you could tell me some other pros/cons over the other when having to force the user to select some values from a list.


texts: sorting the parent on basis of total flag count of his children

texts:
I have a problem in getting the total flag count of all children belong to a parent. so that on basis of it i can sort to the parent.i have 2 parent A and B, and each parent has own children. like:

Parent A:-
child1 flag count=3

child2 flag count=0

child3 flag count=1

Parent B:-

child1 flag count=4

child2 flag count=1

child3 flag count=2

child4 flag count=0

So flag count of all children in parent B is greater. so in sorting, parent B should come first (because has 7 flag count in child node) then Parent A (flag count of all child nodes is 4)...

How can i get result


texts: How to toggle views filter when user click on tab?

texts:
i got 2 tabs and i want to achive this goal: once user click on tab 1 for example, its shows him a filters for tab1, if he clicks on other tab, its toggles the form to other "sory by" forms elements related to tab2, im using drupal 6 and jquery
attached image for demo: http://www.media396.com/tmp/tabsexampleugly.png


texts: Changing a Profile type Machine Name broke the Admin/People search

texts:
I'm working on a Drupal 7 website in which there are several Profile types.
As part of a task, I had to change the "Label Name" and the "Machine Name" of one of them: specifically Professional Courses was changed in Professional School.

Later on, I've realised that this substitution have broken the search in the Admin/People page. Precisely, if the Administrator, from the Admin/People page, searches the users with the Profile type just mentioned, the search shows no results.
I've discovered that the View managing this page (Admin/People), has kept the old Machine Name in the query, which means that role has been cut out.

I’ve tried to fix this error by changing the query using the following code inside a views_pre_execute function in a custom module I've developed:

$query = db_select('users', NULL);
$query->condition('users.uid', array('0'), 'NOT IN');
$query->fields('users', array('uid', 'name', 'mail', 'status', 'created', 'access'));
$query->addJoin('INNER', 'profile', NULL, 'users.uid = profile.uid AND (profile.type IN ( \'master_school\', \'employee\', \'summer_school\', \'professional_courses\', \'digital_friend\', \'phd_school\', \'professional_school\' ))');
$query->orderBy('users.access', 'DESC');
$query->range(0, 100);

$view->build_info['query'] = $query;

However, this code changes the query inside the View, but didn’t fix the problem.
How can I fix this bug? Should I go back to the old Machine Name?
Thanks!

P.S. I'm using Profile2 and Administration Views modules.


texts: Show all revisions with entity reference field referencing a specific entity

texts:
Here is what I am after:

I have an entity reference field that references nodes.

I want to build a view that shows a list of all revisions that have this field referencing a given entity.

Here is what I have tried so far:

New view displaying content revisions.
New relationship: Referenced entity.
New contextual filter NID using the relationship.

Now this works, but only returns one result: the current node that is referencing the nid argument in the contextual filter. I want it to list all revisions that have historical data referencing the NID in the argument of the contextual filter.

Has anybody built a view that uses a contextual filter to show revisions that reference a given NID by an entityreference field?


texts:
How can I bootstrap Drupal 8 from an external script?

This an example script from the RabbitMQ Work Queues tutorial.

require_once __DIR__ . '/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;

$connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$channel = $connection->channel();
$channel->queue_declare('task_queue', false, true, false, false);
echo " [*] Waiting for messages. To exit press CTRL+C\n";
$callback = function ($msg) {
  echo ' [x] Received ', $msg->body, "\n";
  sleep(substr_count($msg->body, '.'));
  echo " [x] Done\n";
  $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
};

$channel->basic_qos(null, 1, null);
$channel->basic_consume('task_queue', '', false, false, false, false, $callback);

while (count($channel->callbacks)) {
  $channel->wait();
}

$channel->close();
$connection->close();

Within a worker script like this, I need to be able to create nodes.

How can I bootstrap Drupal 8 in this script?

Php Access User Data from external script? and Bootstrap from external script bootstraps passing a fake request to the kernel, which to me looks like a work-around.

In Drupal 7 you could do something like this, apparently.

// Bootstrap Drupal.
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);


texts: Using Views API to create a status field based on other field values (Sortable and Filterable)

texts:
I need a status field to appear in a view with a table format that has values like "Needs Attention", "Awaiting Payment", "Not Interested", etc...

These values are based on values of other fields attached to the node such as a date field indicating the last time of interaction, payment received toggle, etc...

This field needs to be sortable and filterable for good reporting; so, I've started reading-up on the Views API to create custom Views Data, but I'm having trouble figuring-out where to attach the SQL expression that calculates the value.  I've seen some tutorials that are close, but they talk more about getting your custom SQL table into views and using expressions on those, but not one working with existing node field values.

Does anyone know how and where to set this up, or has anyone found something on the web describing this?


texts: Performance using location based information and proximity filters

texts:
I'm building a site where each piece of content is geocoded with latitude and longitude. Information will be shown based on proximity to a location chosen by the user. It seems like it would be faster if the information was shown based on city or state arguments because then Views can be cached. If every page view requires a proximity search of nodes from a lat/lng coordinate that no two users will ever share, I imaging the database will be getting a big work out.

A proximity search is fine, but how do I show other nodes in context of proximity whether it is state, town, city, or country?
What would the information architecture be?


texts: Creating a Block view for Other nearby stores

texts:
I want to create a  block to display all nearby commerce stores . I have setup  a view of type commerce store . Inside the View  I have displayed fields.

In contextual filter "WHEN THE FILTER VALUE IS NOT AVAILABLE"  Provide default value  -> Raw value from the url ,path component = 2 and  Use path alias  . The path on which this is displayed is mysitename.com/store/store:id . and under more exclude this display .

Under Filter Criteria - Commerce Store: geofield (field_geofield) - proximity . What value should be "selected from source of origin point" and what should be passed in "From " value.


texts: How do I correctly inform the system about my module's new config?

texts:
I'm working on a module that already comes with a config file in mymodule/config/install/mymodule.settings.yml, and I'm working on a new feature that requires its own set of configuration in mymodule/config/install/mymodule.newfeature.yml.

I assume I need to put the following code in an update hook.

function mymodule_update_8003() {
  \Drupal::service('config.installer')->installDefaultConfig('module', 'mymodule');
}

But if I do this, will sites that have overridden my existing configuration (from mymodule.settings.yml) get hosed, or is there another way to tell Drupal about my new configuration?


texts: Drupal PHP filter being overwritten in Lexicon Module

texts:
I've been using the PHP code text format on my Drupal website and I have been encountering a frustrating issue with the Lexicon Module. I bet the answer is dead obvious, but I haven't been able to figure it out.

After I write my PHP code in the appropriate text format (php code) in the Lexicon modules "optional introductory text field", I hit save, and everything displays as it should on the page (great!). Problem is when I go back to make changes, "Full HTML" is selected as the text format and the PHP code has been replaced with HTML. When I then choose PHP Code as the text format, I can see some of the code I wrote (not all) but it's commented out with HTML comments. I know that my PHP code has been converted and replace with HTML not only in the input field because if I hit save again, then there is no PHP script saved - just garbled HTML gets displayed on the page.

Does anyone know how to use the PHP text format and make sure their PHP code actually sticks around if the content type is revisited?  The reason I need to put PHP code in this field is because I want to do a language check of the current user and display text in either English or French.


texts: Printing out translated Views' variables

texts: I have a View, with its title translated to all enabled languages. When in tpl file I say: print $views->human_name, the title printed is stuck at the original language though. Any workaround for that, please?


texts: Where is the base domain stored in database D7

texts:
Is there an equivalent row to the Wordpress "Home" and "Site"? In otherwords, where can I look in the database to figure out what the domain the site is on?
 I'm using mysql


texts:
I have an example content type "Cars" and two vocabularies: "Country" with some terms of countries and "Brand" with some terms of brands.

The content type will have three more field that will be term references: Country, Brand and Type of cars.

I'm using a view page with path /cars that displays all the contents from that content type. The "Country" and "Brand" I'm using them as a exposed filters.

So my goal is to create a menu links from the left sidebar with type of cars like Hatchbacks, sports cars, city cars... etc. and will display the number how many cars are hatchbacks, how many sports cars....

When a user click on some of the menu links from left like for an example "Hatchbacks" it will display all the hatchbacks. And after that the filters Country and Brand will stay so a user can filter them.

My question is how can I create such menu links and will display the numbers of the nodes?

I'm using Drupal 7.


texts: Create a view field that contain the sum of specific fields for a specific user

texts:
I created a content type (Donation) that contains 3 fields:

a Donor Name field (user reference).
a date field (for the donation month).
the amount of the donation.

I am trying to create a view that returns a table with 2 columns:

one for Donor Name
one for the total/sum of all donation for that Donor.

My question: How can I achieve the second column (the sum of donations for the specific Donor/user) using views?


texts: I am using MAMP to host a Drupal-7 database on Mac OS 10.12 (Sierra).  It works just fine until the first time I sign out and shut down my computer.  When I come back, and try to "add content", I am informed that I have not yet defined any "content types". Yet when I go to "structure => content types" they are all there, as are all the pages I have already created. I can edit existing pages and do everything else. Status report looks clean. Is this a database problem? A MAMP problem? Something else?


texts: How to get value of Textarea in node add form?

texts:
In my node add form I have added one text area :

function mymodule_form_alter(&$form, $form_state, $form_id) {
    if ($form_id == "contenttype_node_form") {
         if (!isset($node->nid) || isset($node->is_new)) {
             $form['extra']['#title'] = t('Title (Extra)');
             $form['extra']['#type'] = 'textarea';
             $form['extra']['#required'] = TRUE;
             $form['extra']['#cols'] = '15';
             $form['extra']['#resizable'] = FALSE;
             $form['extra']['#rows'] = '5';

             $form['#submit'][] = 'my_trans_submit';

        }
    }
}

function my_trans_submit(&$form, &$form_state){
  $swed_title = $form['extra']['#value'];
}

Above code display one textarea just after title field in my node form. I Need the value entered in this text-area when user click on save node and then I want to use that value and save translation by running node save function. I can get this on form submit, but at that time node is not created and nid is not available.

How can I get value entered by the users in the above textarea once the node is saved and the node ID will be available, allowing me to use node_save()? Do I have to use a form field? I was not using a form field as it creates a new entity table.


texts: Get a sortable link in Views table display

texts:
I have an content type (bundle) "Journal" that has a field "journal number" (integer field) and an entity reference to "Document" bundle. I have a view that lists"document" objects as a table. I want to add there a number of journal referencing to the "Journal" item. It can be done via Relations in Views. But then I want to see this number as a link to corresponding journal. I see two ways there:

.1. that number is shown as a link via "override" option of the field with hardcoded url. (I use pathauto with custom patterns which means that I'm to monitor that hardcoded with "override patterns" urls to be correspondent to their actual urls provided by pathauto)

Pros: the field is sortable as an integer (I want it to be that).

Cons: if Pathauto patterns change, the views overide patterns should be changes correspondingly by hand.

.2. Add a field "Link" referencing to that journal and override this field with a journal number field.

Pros: linking system works without any crutches: Pathauto pattern changes -> link to journal will still work.

Cons: The overriden property is NOT SORTABLE

How can i get both beiing a link and sortable ability as a number for a field?


texts: How to set pragmatically Minimum order subtotal limit in Ubercart Drupal?

texts:
I am using the Ubercart module for my site. And I need to set Minimum order subtotal pragmatically not for admin panel. I am going to create a custom module to apply this condition but not getting any hook.

Any suggestions?


texts: Multiple content types in views in order one by one

texts:
I have 3 content types (A, B, C).

I need to output all of them in views in order:

A1
B1
C1
A2
B2
C2
...

I need to get the last node with content type A, then the last node of content type B, then the last node with content type C, then the node of content type A created earlier etc.

So, is it possible to alternate content types in views?

Thanks a lot!


texts:
I'm working on a Drupal 8 site, and I'd like to adjust how the results (/admin/structure/webform/manage/form-name/submission/ID/edit) display – the client doesn't want to see all of the fields and submission-related information (UUID, URI, etc.), and wants to see all of the form submission fields filled out here as well.

I see that there's an option for submission views, but I don't see a similar option that applies to the Edit tab. I also see there's a Webform Views Integration module, but that looks more like what I'd want if I wanted to put a view within a form.

Is there configuration I'm not seeing to adjust the submission edit screen, or a better method of reviewing submission details on a page whose display I can customize?

Thanks!


texts: How to use Views Excel Export or Views data export to export a filtered table?

texts:
A while back I asked a question about how to pass a list of columns to display in a views table and a solution closest to what I wanted to do was a module:

Views Dynamic Fields

I was positively shocked that the description of the project mentioned the second part of what I need to do here. Export that view to an Excel spreadsheet.

  This module provides additional advantages when used with the Views Bonus Pack module or the Views Excel Export module to generate an xls file from a view. The xls file will only display the fields you have chosen on the rendered view instance in browser.

I need to let the user choose the columns, then render the view with those columns and expose filters for all chosen columns, apply them, then download the result in an excel file. Unfortunately I was not able to find  a description how do I actually do that. Using the xls feed option I don't get any fields from the view itself (seems like I need to add the fields manually again) which I can't imagine works with the filters from the view itself. Exporting the file works, but it only shows the default "Title" field (without adding fields to the feed manually).

I had the same problems with Views data export, creating a new data export started with a default "Title" field and I don't think you're supposed to add the same filters again.

Let me know if you have any experience with those modules or ever had to export a view to a spreadsheet.


texts:
I used Field Collection in my previous sites and I faced some performance issue, So this time I am looking a alternative for Field Collection. I find a answer Alternative to Field Collection.

but I can't find much on how different or similar these solutions specially [Field Collection and Paragraphs].

Maybe someone can help to explain? So that I can make a good decision.


texts: Getting views contextual filter from url for display suite block

texts:
I have a URL for an event content type that concatenates two other content types, namely "name-of-venue" and "name-of-performer" with "date-of-event", so the url is "name-of-venue/name-of-performer/dateofevent".

I wish to place a block on the event content type that shows only the events for that venue.

I have tried to configure the contextual filter as shown on the screen shot,

using the PHP code:

  $np = explode('/', drupal_get_normal_path($argument)); if
  (!empty($np[3])) {   $handler->argument = $np[3];   return TRUE; }
  else {   return FALSE; }

However this does not return just those events for that specific venue, but for all venues.

Consequently I fear that I am not actually exploding the url and so failing to obtain the NID for "name-of-venue" that I need for the contextual filter.

Any suggestions would be very much appreciated.

Thank you.


texts: Showing popup after user registration using the "Popup message" module

texts: How do I show a popup to a user after he/she has registered, using the Popup message module?


texts: Colorbox inline style="display:none" doesn't disappear

texts:
I am using colorbox module.
I have an inline modal that works o.k, this is the code:

view content

    <input name="name" type="name" />
    <input name="phone" type="phone" />
    <input name="email" type="email" />

This code is an a view header.

When I click the link the modal pops but it is empty.
I've noticed that the style="display: none;" in the div does not disappear.

What can cause this?

Any help will be great.


texts: How can I remove a theme that is no longer in core?

texts:
Drush/Drupal 8 is throwing errors because a theme is 'enabled' that is 'missing'. The theme is/was part of core (test_stable), and I'm having difficulty getting it to uninstall.
I understand that the theme code needs to be there in order to uninstall, but this being core makes that difficult. I can manually place the module there locally, but would need to create a patch to actually have it installed (and then uninstalled) on the remote environments via composer.
The "Module Missing Message Fixer" module addresses this scenario with modules, but not themes.
I'm pretty sure enabling this theme in the first place was an accident. I'm hoping someone can help me determine if there is a way to do this w/out creating a patch that installs this old theme.


texts: Plugin to make selecting a page on a menu easier

texts:
I'm in the process of building a drupal site and wonder if there is an easier way to create menu items.

When I create a menu item in a menu I need to manually enter the url of the link for the item.  Is there a plugin available that will allow me to select from a list all the content created in the system so I can simply select the page I wish it to link to?

Obviously it would also need to allow me to type in a link for custom modules etc?

Does this exist as a plugin?


texts: Cannot post new content after installing varnish

texts:
Our drupal 7 site was running so slow it was almost unresponsive, so I had to install varnish 2.1.5 this weekend. I got it up and running, and everything is now lightning fast, users can login and everything else is good... except that none of our authors can post new content.

When new content is posted, whether it's from the admin overlay or the actual node/add/news path, the URL just reloads and nothing happens. The form data is all in the Request Payload, the SESSION cookie is set, Varnish supposedly isn't caching... and yet nothing happens. I even installed the varnish module for drupal, but that only seems to handle reporting, and not actually doing anything.

Here's my default.vcl file.

I'm not seeing anything suspect in the vcl, but it certainly seems to be screwing something up.

Edit: I should point out that I don't have any issues changing settings in admin, or doing anything else, other than posting content, so it's not like all forms are broken. It might have something to do with ckeditor which is only present on the new content pages, but that seems like a stretch to me.

Edit 2: Realized I can create new blocks as admin, which uses the ckeditor which means that doesn't have anything to do with it. No new entries are getting put inserted into the node table and there's nothing suspicious in the watchdog logs.


texts: How to force the canonical URL to use http?

texts:
On our page we use the Metatag module to show a canonical meta tag. In the configuration we use the [current-page:url:absolute] token. This works fine, but the problem is, that whether the page gets accessed by HTTP or HTTPS this protocol is used in the canonical URL.

For SEO purposes we want the canonical URL to be the same and use HTTP for both protocols.

How can we achieve this?


texts: How to programmatically set a Views display to override style options

texts:
I am working on the Charts module and have a stubborn issue that I'm trying to resolve.

Charts provides a Views style plugin and a Views display plugin called Chart Attachment. The display plugin extends the Attachment display plugin and sets the View's format to Charts. However, I run into an issue where I really need the Chart Attachment's formatting settings to apply to its display only ("This chart_extension (override)"). If it applies to all displays, it ends up breaking the Chart because the whole idea behind the Chart Attachment is for it to be different than its parent.

Here is what the Format settings should look like immediately after clicking "Add" -> "Chart attachment" in the View displays section:

Note the italic font on Chart and Settings within the Format section.

When you click on Chart from that attachment, this is what you should see without clicking anything else:

So how can one code the Display plugin to enforce style format options to "This chart_extension (override)"?

Or, if there is another approach that accomplishes the same thing, I would be open to that.


texts: save the value of a custom form in the database

texts:
Why isn't the code saving values in the database?

module_load_include('inc', 'firstform', 'firstform_node_form_alter');

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

$items['submit_driven_ajax'] = array(
    'title' => 'send your email',
    'page callback' => 'drupal_get_form',
    'access callback' => TRUE,
    'weight' => 3,
);
return $items;

}

function firstform_intro() {
$markup = t('The AJAX example module provides many examples of AJAX including forms, links, and AJAX commands.');
return $markup;}

function firstform_form($form, &$form_state) {
$form['box'] = array(
    '#type' => 'markup',
    '#prefix' => '
',
    '#suffix' => '
',
);
$form['email'] = array(
    '#type' => 'textfield',
    '#required' => TRUE
    , '#description' => "Please enter your email name.",
    '#ajax' => array(
        'callback' => 'firstform_text_driven_callback',
        'wrapper' => 'box',
        'name' => 'email1',
    ),
);
$form['submit'] = array(
    '#type' => 'submit',
    '#ajax' => array(
        'callback' => 'firstform_submit_driven_callback',
        'wrapper' => 'box',
        'name' => 'submit1',
    ),
    '#value' => t('Submit'),
);

return $form;}

function firstform_submit_driven_callback($form, $form_state) {
$element = $form['box'];
$element['#markup'] = "your email ({$form_state['values']['email']}): " . date('c');
return $element;}

function firstform_text_driven_callback($form, $form_state) {
$element = $form['box'];
$element['#markup'] = "your email ({$form_state['values']['email']}): " .date('c');
return $element;}

 function firstform_block_info() {
$blocks = array();
$blocks['firstform'] = array(
    'info' => t('Form mail'),
    'weight' => 0,
);
return $blocks;}

function firstform_block_view($delta = '') {
module_load_include('inc', 'node', 'node.pages');
switch ($delta) {
    case 'firstform':
        $block['subject'] = t('');
        $form = drupal_render(node_add('firstform'));
        $block['content'] = $form;

        break;
}
return $block;}

  function firstform_node_insert($node){
  db_insert('firstform_node_form_alter')
->fields(array(
  'nid' => $node->nid,
  'email' => $node->firstform['email'],
  'date' => $node->firstform['date'],
))
->execute();}

function firstform_node_update($node) {

 if (db_select('firstform_node_form_alter', 'a')->fields('a')->condition('nid', $node->nid, '=')->execute()->fetchAssoc()) {
db_update('firstform_node_form_alter')
  ->fields(array(
    'email' => $node->firstform['email'],
    'date' => $node->firstform['date'],
  ))
  ->condition('nid', $node->nid)
  ->execute();
  }  else {
firstform_node_insert($node);}}

    function firstform_node_delete($node) {  db_delete('firstform_node_form_alter')
->condition('nid', $node->nid)
->execute();}

When I add firstform.install, the firstform_node_form_alter table is not created.

function firstform_schema() {
 $schema['firstform_node_form_alter'] = array(
'description' => 'Stores email settings for nodes.',
'fields' => array(
  'nid' => array(
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
    'description' => 'The {node}.nid to store settings.',
  ),'email' => array(
    'type' => 'varchar',
    'not null' => TRUE,
    'default' => 0,
    'description' => 'Node Form Example 1 textfield',
  ),
  'date' => array(
    'type' => 'int',
    'length' => 256,
    'not null' => FALSE,
    'default' => '',
    'description' => 'Node Form date textfield',
  ),
),
'primary key' => array('nid'),
'foreign keys' => array(
  'dnv_node' => array(
    'table' => 'node',
    'columns' => array('nid' => 'nid'),
  ),
),
 );
return $schema;
}


texts: Load external libraries in a custom block

texts:
I need to implement a custom block using JavaScript. These are the steps I took.

I created a custom module
I created a custom block by creating a class which extends blockbase
I created a JavaScript file
I defined a library in libraries.yml file and included the JavaScript file
I attached the library to the block using #attached

So far so good. In the JavaScript file, I am trying to use the open source Datatables library, but I am unable to add it.

This is the code that implements the block.

/**
 * @file
 * Contains \Drupal\custom_cms_blocks\Plugin\Block\TopNewsBlock.
 */

namespace Drupal\custom_cms_blocks\Plugin\Block;

use Drupal\Core\Block\BlockBase;

/**
 * Provides an 'Active forum topics' block.
 *
 * @Block(
 *   id = "top_news_min_block",
 *   admin_label = @Translation("Top News Min Block"),
 *   category = @Translation("Custom CMS blocks"),
 * )
 */
class TopNewsBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function build() {
     //Fetch data
     return array(
      'type' => 'markup',
      '#markup' => '

Artist / Band	Album	Song

Muse	Absolution	Sing for Absolution

',
      '#attached' => array(
        'library' =>  array(
          'https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js',
          'custom_cms_blocks/top-news-library'
        ),
      ),
     );
  }

}

Can you explain me how I can include an external JavaScript file in a block?


texts: Group order items in drupal commerce cart

texts:
When I add the same product twice to cart:

actually: there is 2 separate orders (1x Chocolate cake $3)
expected: one solid order - 2x Chocolate cake $6

How to make the cart to dispay grouped orders?
thx.


texts: hook_field_validate on unlimited value field

texts:
I've developed my own field type, with its own widget and own formatter etc. This field is a composite field with text fields, radio selectors, and file upload widgets. (The code is 1000+ lines so too long to post here)

I'm just in the process of sorting out the validation and I'm running into a small issue.

Using the field_example.module I've used the hook_field_validate and hook_field_widget_error together to produce the validation of the elements.

I'm validating one of the textfields in the widget, and it's called query. If query is empty, then the rest of the fields on this widget is required (e.g. file upload, title override etc).

This works on limited value fields which don't have an Add another item button, and don't get automatically an empty row added on Edit. However on Unlimited value instances, the validator is catching the last empty row which is supposed to get ignored.

The field module has a hook_field_is_empty which is working last time I checked. How can I avoid this extra last empty row from being validated? This comment on the API page seems to confirm my problem too.

The code for hook_field_validate:

function hook_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
  foreach ($items as $delta => $item) {
    if(empty($item['solr_query'])) {
      $override = $item['override'];

      $img_preview = $override['img_preview'];
      $img_large = $override['img_large'];
      $ov_title = $override['ov_title'];
      $ov_desc = $override['ov_desc'];

      if(empty($img_preview)) {
        $errors[$field['field_name']][$langcode][$delta][] = array(
          'error' => 'solr_field_img_preview_invalid',
          'message' => t('Preview image is required when no Object reference is supplied.'),
        );
      }

      if(empty($img_large)) {
        $errors[$field['field_name']][$langcode][$delta][] = array(
          'error' => 'solr_field_img_large_invalid',
          'message' => t('Main media is required when no Object reference is supplied.'),
        );
      }

      if(empty($ov_title)) {
        $errors[$field['field_name']][$langcode][$delta][] = array(
          'error' => 'solr_field_ov_title_invalid',
          'message' => t('Title override is required when no Object reference is supplied.'),
        );
      }

      if(empty($ov_desc['value'])) {
        $errors[$field['field_name']][$langcode][$delta][] = array(
          'error' => 'solr_field_ov_desc_invalid',
          'message' => t('Description override is required when no Object reference is supplied.'),
        );
      }
    }
  }
}

The code for hook_field_widget_error:

function hook_field_widget_error($element, $error, $form, &$form_state) {
  switch ($error['error']) {
    case 'solr_field_img_preview_invalid':
      form_error($element['override']['img_preview'], $error['message']);
      break;
    case 'solr_field_img_large_invalid':
      form_error($element['override']['img_large'], $error['message']);
      break;
    case 'solr_field_ov_title_invalid':
      form_error($element['override']['ov_title'], $error['message']);
      break;
    case 'solr_field_ov_desc_invalid':
      form_error($element['override']['ov_desc'], $error['message']);
      break;
  }
}

The code for hook_field_is_empty:

function hook_field_is_empty($item, $field) {
  $empty = TRUE;

  // Trim white space first
  $item['solr_query'] = trim($item['solr_query']);

  if(!empty($item['solr_query'])) {
    $empty = FALSE;
  }
  else {
    // If the Solr Query field is left empty then check
    // all essential override fields are filled in.
    $override = $item['override'];

    $img_preview = $override['img_preview'];
    $img_large = $override['img_large'];
    $ov_title = $override['ov_title'];
    $ov_desc = $override['ov_desc'];

    if($img_preview && $img_large && !empty($ov_title) && !empty($ov_desc['value'])) {
      $empty = FALSE;
    }
  }

  return $empty;
}


texts: Adding a CSS class to every form in Drupal 6 in a theme

texts:
I would like to add a class to every form tag that could appear on a page. Because it's strictly for theming purposes, I would like to do that in my custom Drupal 6 theme.

How should I do that?


texts: using drupal 7 functions in external files

texts:
I feel that the above title isn't very well worded since I can't figure how to state it properly using few words. Anyway, what I'd like to do is this:

$.post("foo.php", data, function(msg) {
   //the js part is easy enough to handle
});

This is simple enough but how do I get foo.php to use Drupal 7's functions? While it would probably make my life much easier to use ordinary php code to do all my database queries, I'd like to stick with Drupal functions to play it safe.


texts: hook_file_dowload() randomly thinks user is anonymous

texts:
I have a custom module implementing hook_file_download() for both public and privately managed files. At the head of my hook implementation I have the typical declarations to access the $user global:

function contractor_file_download( $uri ) {
  $caller = 'contractor_file_download';
  global $user;

  devlog( $caller.': uri is "'.$uri.'", user is "'.$user->uid.'"' );
  devlog( $caller.': globals user is "'.print_r( $GLOBALS['user'], 1 ).'"' );
  ...
}

The problem I'm having is that $user contains the anonymous user sometimes, if that makes any sense. Although it makes no sense, when testing via an OSX machine, any browser, the $user is always the valid logged in user. But when testing via any flavor of Windows, about 70% of the time both $user and $GLOBALS['user'] both contain the anonymous user. Yet, in all instances, the "My Account" link can be clicked and the correct logged in user profile loads.

What could cause $user to contain the anonymous user even after the user has logged in?

Additional info: the files being accessed getting the anonymous user are all private managed files.


texts:
I have nodes that I want people to be able to vote on. I am currently using the Rate module for this. My use case also requires me to be able to change vote values on individual nodes if necessary. Please how would I do this?

I do not want to go into the database directly. The end user needs to be able to do this in the Drupal interface. I would also like to be able to restrict to access to this feature to certain roles using the permissions system


texts: Is it possible to manage Drupal running on a Windows server using drush on linux via a Samba mount?

texts:
I have been trying to set up drush on my linux desktop (hereafter called client) to control a remote Drupal site running on Windows using XAMPP (herafter called server).

The Drupal root on the remote server is mounted via Samba on the client at this location : /path/to/remote/server1/drupal

I am using the following drush alias:

$aliases['drupalserver1'] = array(
  'root' => '/path/to/remote/server1/drupal',
  #'remote-host' => 'drupalserver1.mydomain',
  #'remote-user' => 'myuser',
  'uri' => 'http://drupalserver1.mydomain',
  'os' => 'Windows',
);

Now, as I understand it, this tells drush that it is a local installation of Drupal, not a remote one since I left commented the remote-host and remote-user entries.

Drush then reads the settings.php file on the server (via the samba mount on my client), which specifies drupalserver1.mydomain (rather than localhost) and the necessary other configurations.

Database connection is successful as is bootstrapping:

 Site URI                        :  http://drupalserver1.mydomain
 Database driver                 :  mysql
 Database hostname               :  drupalserver1.mydomain
 Database username               :  root
 Database name                   :  drupal
 Database                        :  Connected
 Drupal bootstrap                :  Successful
 Drupal user                     :  Anonymous
 Default theme                   :  acquia_marina
 Administration theme            :  seven
 PHP configuration               :  /etc/php5/cli/php.ini /home/myuser/.drush/php.ini
 Drush version                   :  5.9
 Drush configuration             :
 Drush alias files               :  /home/myuser/.drush/examples_example.aliases.drushrc.php /home/myuser/.drush/myorg.aliases.drushrc.php
 Drupal root                     :  /path/to/remote/server1/drupal
 Site path                       :  sites/default
 File directory path             :  sites/default/files
 Temporary file directory path   :  C:\xampp\tmp

Now, both the Drupal files (/path/to/remote/server1/drupal) and the mysql DB are hosted on a Windows machine, so using 'os' => 'Windows' in the alias makes sense.  I even wonder if this line is even taken into account since remote_host is not used.

Is there any hope that the configuration I am proposing works at all ?

Using Drupal 7.


texts: I personally tend to hate WYSIWYG editors. They take time to load and just love plain old HTML, so I just disable the editor entirely. However, I would like to have HTML from the database to be prettyfied or beautified or ... well, loooking sexy for the time of editing with indents, newlines, etc. Any module out there that does that?


texts:
I seem to have done something to mess up the View / Edit tabs which appear above page content when you are logged in with appropriate rights. The tabs appear but they are no longer clickable. If I access the "edit" link via the dashboard, I can edit the page contents no problems - it's just the handy short-cut that has stopped working.

Anybody know how to fix this?


texts: Under what circumstances are views wrapping divs required?

texts:
When I embed a view, I'm seeing the following wrapping divs (Note: I'm using just the core views module templates):

    // Content I care about here

I've seen the same kind of component on a number of projects: A paragraph (or block, or whatever) where a user can manually choose a number of blog posts, via entity_reference, or they can enter a tag and have the component populate with the most recent blog posts of that tag. Typically, I embed a view with contextual filter for the most recent by tag option, and just display the field if they're manually chosen.
The annoying issue I run in to is that the markup is different, largely because of these two divs. For example:
// Manually Selected:

// Tag selected:

I see that the js-view-dom-id-ETC div is added in views-view.html.twig and can be easily removed - my assumption here is that if my view is not interactive (no paging, no filters, it'd never be refreshed in any way - it's really just used as a query builder) then it's totally fine to remove this div.
The views-element-container div is a little more complicated to get rid of, but again, I'm assuming it's fine to do so if my view is not interactive.
Doing a string search of the views module for views-element-container, I can see that it's only referenced in tests.
From a functional standpoint, are my assumptions correct here? Are these divs only necessary with interactive views that use AJAX?
Edit:
Per my testing, it seems removing these two divs does no harm for my embedded views with no interaction.


texts: How can I get the invoicing and shipping profiles for a user?

texts:
How can I get two separate profiles, one for shipping and one for invoicing? I can get the default profile for a user, but there does not appear to a type associated with it.

In Drupal 7 I could use commerce_addressbook_get_default_profile_id to get the default profile per type, but I don't see this function or an equivalent in Commerce 2.

I'm porting a custom module from a Drupal 7 online shop to a Drupal 8 online shop. This custom module synchronizes user and order data to Navision which has separate fields for shipping and invoicing.
Ideally I'd also be able to use hook_profile_update to sync the profile updates to Navision.


texts: Does variable_get() first go to 'variable' table in the database or the $conf array in settings.php?

texts:
I can't tell from the source for variable_get() for Drupal 6 whether it first looks for something in the variable table in the database, or the $conf array in settings.php.

Also, if I were to add something in some code to the $conf array, would I need to do anything in order for variable_get to see it?

global $conf;
$conf['myvalue'] = 'newvalue';

If 'myvalue' were set to 'oldvalue' in settings.php, then what would I need to do in order for $conf['myvalue'] to now return newvalue instead of oldvalue?


texts: How to add .current class into menu link when page is being viewed

texts: I have a custom menu - its a module with html links in the .tpl file, set on the website as a block. I wanted to know is it possible to configure drupal so it dynamically add .current class to those links so I can style it when particular page is being viewed. Thanks for help.


texts: Is there a way to import records into webform database from user uploaded CSV/XLS?


texts: Hide or remove the "Remove" button, "Quantity" box, and Price for specific product/SKU on cart page of Ubercart

texts:
I have a zero-dollar product that, once added to the cart, should never be removed until checkout is completed. Currently, that product has the "Remove" button, "Quantity" field, and Price that all products are displayed with in the cart. How can I remove those three items just for this one product/SKU?

Thanks!


texts: Custom field widget form - Multiple values

texts:
I've create a custom field form widget for an entity reference field. When only one value is allowed it shows a (filtered) select list, but I want to allow user to assign multiple reference values to that field.

In my use case I want it to be shown as checkboxes when multiple values are allowed, but by default it shows my checkboxes in a 'add-another' fieldset.

How can this be accomplished?

Below some code, $type is now a field setting and is manually set.

// Construct element
$widget = $element;
$widget['#delta'] = $delta;
$type = $settings['option_limit_type'];

... extra logic ...

switch ($type) {
      case 'select':
        $widget += array(
          '#type' => 'select',
          '#prefix' => '
',
          '#suffix' => '
',
          '#options' => $options,
          '#delta' => $delta,
          '#element_validate' => array('_entityreference_hierachy_option_limit_validate'),
          '#default_value' =>  $saved_target_id,
        );
        break;
      case 'checkboxes':
        $widget += array(
          '#type' => 'checkboxes',
          '#prefix' => '
',
          '#suffix' => '
',
          '#options' => $options,
          '#delta' => $delta,
          '#element_validate' => array('_entityreference_hierachy_option_limit_validate'),
          '#default_value' =>  $saved_target_id,
        );
        break;
    }
return $widget;


texts: "Deprecated function: implode()" on GMap Drupal module

texts:
I have containerised a legacy Drupal 7 website with Docker. This is the docker-compose file:
version: '2.0'
services:
    drupal:
        build: .
        ports:
         - "8080:80"
        links:
         - mysql:mysql
    mysql:
        build: ./db
        ports:
         - "6603:3306"

The drupal container uses the official drupal:7.72 image, whereas mysql stems from mysql:5. The database container is responsive and reachable from the Drupal container. The main page of the website loads correctly, but it shows this error message:

Deprecated function: implode(): Passing glue string after array is
deprecated. Swap the parameters in
Drupal\gmap\GmapDefaults->__construct() (line 107 of
/var/www/html/sites/all/modules/gmap/lib/Drupal/gmap/GmapDefaults.php).

There is a similar error reported for a different function in Drupal 7.70. But apparently it was resolved with 7.71.
How can this particular error be solved? Would editing the GmapDefaults.php file be an option?


texts:
I have a standard rule regarding commerce stock

Completing the checkout procces << minus from stock

Unfortunately my payment gateway does not require a return to the store and then
rule gets lost, does not count properly store

How to make the magazine was negative regardless of the return to the store after payment


texts:
I have two login boxes on the same page and, I would like to integrate different behaviors to those based on some arguments.

I'm calling myself the forms with drupal_get_form('user_login');. I would like to pass a variable to the form:

drupal_get_form('user_login', $myvar);

And then be able to get it from a hook_form_alter():

function mymodule_form_alter($form, $form_state, $form_id, $myvar) {
  // some code here
}

But i can't find a way to do this.


texts:
Im looking for a way to create a text template or a way to make one, where, when you create a node of a specific content type, a text is preloaded into the node. (Similar to Word-Templates)

At the moment, whenever I habe to write a status report, I have to copy paste it, but I want this to happen automatically.

Any help would be greatly appreciated.

Best Regards.


texts: How to override items per page in cloned view?

texts:
I have some Views page and there is a pager with 10 items limit per page. I cloned this View and I want to have 6 items per page in this cloned View, but this is not possible. Every time I try to change it, it's changed on the main View as well.

How I can override this for cloned View? Is there any way to do it programmatically somehow?


texts: Migrating compound data structures from XML

texts:
How would you migrate a complex data structure in XML format, such as:

<products>
  <product>
    <name>Product 1</name>
    <price>3.99</price>
    <colour-options>
      <colour>red</colour>
      <colour>blue></colour>
    <colour-options>
  </product>
</products>

How would you migrate data in this format, into a content type? I'm guessing that the best way would be using the Migrate module.


texts: Getting the number pad to show up for text fields

texts:
I would like to make entering data easier for my users who use the mobile version of my site. I've been searching around both Android and Drupal documentation and eventually found this: https://stackoverflow.com/questions/3372380/how-to-force-keyboard-with-numbers-in-mobile-website-in-android

Which says that using

<input type="number" />
<input type="tel" />

will bring up the number pad for the user.

I would like to figure out the best way to change all of my integer and decimal fields to have type="number".

I'm aware of doing a hook to do this but I have a lot of fields which are numbers and I was wondering if there was a more effective way to change ALL the fields rather that me writing a line for each of the fields. Maybe if I had an array of all the fields and then programically went through all the fields in the array?

Thanks


texts: View commerce product image and price fields

texts:
In Drupal 7 commerce I ran into a problem.
I want to display the latest 3 items placed in the show_product content type, with attributes from the store. There are several entities in the store, displayed in the same node with the product reference field, all with different attributes and images.
Imagine every online clothing shop will face the same problem regarding sizes and colors.
So, in Views I need a relation on "Content: field_prodref - product_id" to show the attributes from the entities.
The view shows all the products from the store. Is there a way to bypass this so the view shows only the show_product display node with price field and image?


texts: Access referenced entity in Rules using hook_entity_property_info

texts:
I am using the Reply module for comment threads on a custom entity (we'll call it myentity). I'd like to create a rule that triggers when certain properties of myentity are met. However, the Reply module has very minimal entity_property_info, and so there's no way for rules to reference myentity in a condition.

The Reply module creates a Reply entity, that references an entity via entity_id column and an entity_type column. So, I created a property_info_alter hook as follows:

function mymodule_entity_property_info_alter(&$info) {
  $properties = &$info['reply']['properties'];

  $properties['entity_id'] = array(
    'label' => t("Entity id"),
    'description' => t("The entity this reply is associated with."),
    'type' => 'entity',
    'getter callback' => 'entity_property_verbatim_get',
    'required' => TRUE,
    'schema field' => 'entity_id',
  );
}

When I create a condition in rules of "Entity is of Type", I expect to find my new property as an option like reply:entity-id but it doesn't. It only appears in the condition "Data Comparison".

I feel like I'm missing something very simple, but really can't put my finger on it. How do I get this property to appear as a referenced entity that I can then evaluate in Rules?


texts: How to load a node given a menu link id?

texts:
I have this id via $link->getParent():

menu_link_content:6cf83fce-228f-42da-bc39-bea06c767510

How do I get the node id of that menu link?


texts: How to keep Views 2 RSS feed output from stripping out video, embeds, etc.?

texts:
I've got a basic blog built on Views 2 on a D6 site, with a couple displays built using the views style plugin 'RSS Feed'. Our content team frequently posts various embeds using iframes or flash objects which work fine, except when viewed through an RSS reader where these items (and other basic HTML tags like  or ) are stripped out.

I've already tried creating a separate template for my view from the default template:

  <item>
    <title><?php print $title; ?></title>
    <link><?php print $link; ?></link>
    <description><?php print $description; ?></description>
    <?php print $item_elements; ?>
  </item>

but I'm not able to modify the $description variable or catch it before the input format filter is applied. What is the best way to do this?


texts: hook_node_access() returning NODE_ACCESS_DENY is ignored

texts:
I am trying to block the current user from performing any action (view, update, delete) on a node. The user should only be able to view, update, delete the node being displayed if he is the owner of the node, or the owner of the node is a subuser of his (I am using the Subuser module).

The function below returns the correct value for the various tests I performed, but when the function returns NODE_ACCESS_DENY, the access isn't denied. The user can still see the node.

Is there something I am missing?

function mymodule_node_access($node, $op, $account) {
  $type = is_string($node) ? $node : $node->type;
  if (is_object($node)) {
    if ($node->type == 'my_content_type') {
      // Determine the current uid and, if the user doesn't have the right role, deny the access
      if (is_array($account->roles) && in_array('vip', $account->roles)) {
        $current_uid  = $account->uid;
      } elseif ( is_array($account->roles) &&
                !in_array('administrator', $account->roles)) {
        return NODE_ACCESS_DENY;
      } else {
        return NODE_ACCESS_ALLOW;
      }

      // Determine the node owner.
      $node_owner = $node->uid;

      // If the node owner is the same as the current user, allow to view the node
      if ($current_uid == $node_owner) {
        return NODE_ACCESS_ALLOW;
      }

      // If not, check if the node owner is a subuser of the current vip user
      $node_owner_profile = user_load($node_owner);
      if (isset($node_owner_profile->field_parent[LANGUAGE_NONE][0]['value'])) {
        if ($node_owner_profile->field_parent[LANGUAGE_NONE][0]['value'] == $current_uid) {
          return NODE_ACCESS_ALLOW;
        } else {
          return NODE_ACCESS_DENY;
        }
      } else {
        return NODE_ACCESS_DENY;
      }
    }
  }

  return NODE_ACCESS_IGNORE;
}


texts:
I am new to drupal and drush, so please do not close this if it's naive.

My setup:

Windows 7
Xampp 1.8.3 (PHP 5.5.6/Apache 2.4.7/PHP 5.5.6)
Drupal 7.26
Drush 6.3-dev

Intention:

Back up my site and restore on a separate machine using drush
    archive-dump and drush archive-restore

Action: I went into the folder where I have installed drupal and issued the command drush archive-dump

Result:

Archive saved to                                                            [ok]

C:\Users\srihari.sahu/drush-backups/archive-dump/20140206101025/drup
al.20140206_101027.tar.gz
C:\Users\srihari.sahu/drush-backups/archive-dump/20140206101025/drup
al.20140206_101027.tar.gz

When I go in the folder C:\Users\srihari.sahu\drush-backups\archive-dump\20140206101025\ I don't see anything. The folder is blank.

What am I missing?


texts: How do I alter certain module form output

texts:
Some of my node types use fields from extra modules (such as Open Hours or Get Locations). How do I change the way those modules render their fields inside the form? I mean Get Location for example renders fieldset with fields in it. I'd like to change it at all. Also I'd like to change the order of fields and so on.
Is there anyway to make it using something like field--field-name.tpl.php for output fields?
Sorry if this is a common question but I couldn't find any complete guidance on this.


texts: Why is the View import option not shown in the views UI?

texts:
I'm trying to export/import a view from a dev site to a qa site. Views UI is enabled. However, when I go to structure>views I don't see the "+ import view" option, only:

"+ Add new view" "+ Add new view from template"

Anybody any idea?


texts:
I wanted to provide functionality in which where user decides to cancel his account, he can download all the post that he has created as txt file. Is there any drupal module that helps to achieve this, or at-least that allows to export node as txt file in Drupal 7.

I have gone through Print module, but it does not support txt file and I can not use PDF option, as this will take long time to generate PDF of all usaer created node upon cancellation of account.

Please suggest how can I proceed.

-- Many thanks for your time.


texts: Why is the button to install a new module missing in the admin interface?

texts:
I am new to Drupal and am attempting to install pathauto. But when I click on "extend," I don't have a "install new module" button.

Any suggestions?


texts: How to let view display selected field content according to nid

texts:
I have a content type "banner" with Field Collection Fieldset, each fieldset is having a image upload field and a text field to enter node ID.

Eg output:

Image A, nid=1
Image B, nid=2
Image C, nid=3

I would like to have a view block, appearing in every page, and shows Image A when the page nid is 1, shows Image B when nid is 2.

I know this should be something related to filter or contextual filter, but I can't get the correct steps to configure. Is there any way to do it?


texts: Is it possible to have a batch job run in a modal

texts:
I created a form that on submit it creates a CSV file via batch API. It works perfectly when submitting the form regularly but can't get it to work from a Ctools modal.

Could it be that it just isn't possible because of the ajax?


texts: How to unblock my own admin account after 5 failed login attempts?

texts:
I entered the wrong admin password more than 5 times, so Drupal has blocked my entry.

I've change the user password directly in MySQL and then tried to login, but is still doesn't work. Also, if I click the request new password link, I don't get an e-mail.

How can I unblock my account?


texts: How to detect entity translation without using path prefix or domain?

texts:
We have a situation where we want to have Content Translation enabled. It is our understanding that this is using Entity Translation(from D7) that is now in D8 core. This also means that there will be one Node (ID), but there will be a table to hold translations for the fields.

Goal:

Enable Content Translation for Article content type and make all fields translatable
Create an English page call Test-Page
Click Translate and add translation to Spanish
Enter in the Spanish content for the body and title field

Expectation:

As a site visitor, When i clicked on the Language Switcher and select Spanish, I should see Spanish content
As a logged in user (admin or content editor) when i view the English version I should see English content on the edit screen for body and title
As a logged in user when editing the Spanish translation I should see the Spanish translations for body and title.

Issue:

Whenever we click on the Spanish translation we are always served up the English content
When i change the language using the Language Switcher to Spanish, we are still served up the English content

How can we setup the translations so that the issues above do not occur?


texts: Making unique nid-based identifiers for titles using Bootstrap collapse fields

texts:
I created a view where I'm displaying only one content type, with four titles from content pages, one subtitle, and the content ID (nid) included in the fields for my view. I hid all these fields, and now I'm trying to create a Bootstrap collapse layout in the custom text field.
What is the best way that I can make each title show based on the NID of each content page? Basically, I need the user to be able to click each title, and make something unique show up in each of the 4 titles... For instance, the subtitle field only shows up underneath one particular content title. But so far, when I click ANY title, the subtitle field shows up (it shows up underneath the title that I want it too, but I definitely don't want it to show up when I click an unrelated title).
I tried creating unique identifiers, as you can see below, but no dice. Any advice is greatly appreciated!

    {{ title }}

     {{ field_file }}

    {{ title }}

    {{ field_file }}
    {{ field_subtitle }}
    {{ field_file }}


texts: How to call Ajax callback on form submit to display results

texts:
I want to get results, after validating and add fields as well in result like i want to add checkbox in result

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

  $form['d_id'] = array(
    '#type' => 'textfield',
    '#title' => t('D id'),
    '#size' => 60,
    '#maxlength' => 60,
    '#required' => TRUE,

  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Search'),
    '#ajax' => array(
     'callback' => 'v_custom_ajax_handler',
     'wrapper' => 'display-dept-ajax',
     'method' => 'replace',
     'effect' => 'fade',
   ),
  );
$form["prefix"] = array(
    "#markup" => "

");
$form["suffix"] = array(
    "#markup" => "
");

  return $form;
}

function v_custom_ajax_handler($form, &$form_state) {

  if (!empty($form_state['input']['d_id'])) {

  $form["department name"] = array(
    "#markup" => "
Department Id : ""

");

  return  $form["department name"];
  }
}


texts: I want to alter the HTML structure for a particular form in my site.  Specifically, I want to add some wrapper DIVs around a few sets of form elements.  What's the "Drupal 7" way of doing this?


texts: How to add product display nid to user order view?

texts:
On a typical Drupal Commerce website a user can see the following tabs on his user-page:

View
Edit
Orders
Address Book

I am trying to figure out how to get Products tab added to this list, which would list all the Products (actually Product Displays to be exact in Drupal Commerce terms) purchased by the user. It would be very much like Orders page, but instead of Order numbers this page would be outputting Product Display nids, titles, etc.

Alternatively, getting Product Display nids listed on the Orders page would suffice to my purposes, if this is easier. The order page is represented by the 'commerce_user_orders' view, but I can't figure out how to get product display nid there as there is no any product-related options. There is a "Line items" option which lists Title of the product, but doesn't link to actual Product Display page. Basically I need users to be able to go to the specific Product pages from their orders pages directly associated with the product displays.


texts: Get "previous" and "next" buttons on view

texts:
The view I want to create consists of two parts:

An overview page with all the products, that is sortable using Draggable Views.
The url given by /collection/
A specific page that is shown when a user clicks on a product in the overview.
The url given by /collection/[title]

Now I want prev / next buttons on the product page, based on the order given by Draggable Views.

I've searched for a couple of hours but cannot find anything that will do the trick. Can someone point me at an option or function that accomplishes this?

Thanks in advance!


texts: How to group results by multiple fields?

texts:
I have values in database like:

x submits file 1

x submits file 2

y submits file 1

y submits file 3

x submits file 1(again)

I had my output with aggregation settings as group results together as

x submits file 1

x submits file 2

y submits file 1

y submits file 3

it just grouped file 1 submissions of x

i want it to be :

x submits file 1,2

y submits file 1,3

Can anyone please help?


texts: Drupal multi-site subdomain and subpath going to same site

texts:
Is it possible for Drupal to handle both subdomain and subpath for a single site in a Drupal multi-site environment?

For example:

foo.example.com ---> 'foo'

example.com/foo ---> 'foo'

Is this possible? Would I run into any issues?


texts: Horrible frontend performance on large CCK forms = poor UX. What are my options?

texts:
I have a pretty large node form for one of my content types. Let's say it has about 100 fields. A lot of these fields are text values with unlimited values, so the user uses an AJAX button to 'Add another item' to each of these. Visually, this form isn't all that intimidating, because I've used Field Groups to keep things reasonable.

Problem: Clicking 'Add another item' is freaking slow. Like really slow.

I figured it was server performance, but then I checked it out in Firebug - the request isn't actually taking that long, but WOW - client side CPU usage (in Chrome, Firefox and any other browser I've tried) hits 100% and stays there for up to 11-12 seconds, and then the AJAX request completes.

That's insane.

So at this point I'm not sure what my options are. Can I break the form apart somehow? Workflow-ng style? A lot of people mention Field Groups as a way to organize a ton of fields, but that doesn't help performance, obviously.

Any help appreciated.


texts: Trying to get property of non-object throws exception that cannot be handled

texts:
In a custom Drupal 8 module I decided to wrap a line of code in a try...catch block, in case $node was null.

I understand that in php errors and exceptions are different, and according to Error message - Trying to get property of non-object this is an error, so will not be handled by try...catch, and the code should continue to run after the error.

However when this code runs under Drupal 8 the error hander raises an exception. So I added the try...catch block. But the exception is still unhandled crashed the program.

This is a cut-down version of my code:

$node = null;
try {
  // The next line results in an unhandled exception
  $f = $node->field_example;
} catch (Exception $e) {
  // Never gets here
  watchdog_exception('example', $e);
}
// Never gets here

Am I missing something? Surely this can't be the intended behaviour?


texts:
I made a module, that outputs the data when the user opens a page /courses

function courses_menu()
{
  $items['courses'] = array(
    'title'            => t('Courses'),
    'page callback'    => 'courses_output',
    'access arguments' => array('access content'),
  );
}

function courses_output()
{
  return "some HTML";
}

How can I add this data to the main page below the node contents?


texts:
We made a visibility rule to display a field when a second field has been filled, and display another field when the second field is empty.
It works well, but since we updated Ctools and some Drupal modules, it gives false output.

What I did is:

Adding a field with a visibility rule to display the field based on another field value
(I left the value empty to display the field when it is empty.)
Duplicating that field, and adding the same visibility rule, for which I then selected "Reverse" to display the field when it contains any value

The problem is that the visibility rule doesn't apply for the case when the field is empty, but it works well when the field is not empty, even if I disabled the second rule.

How does the plugin (for the visibility rule) know about empty and non empty fields?

I know that it could be solved with PHP code, but I need to know what I am doing wrong.


texts: Automate hyperlink to send variables to webform

texts:
Here's the background for what I'm tring to accomplish:

I am using Webform 6.x-3.11 and have a generic sign-up form located at “/project-sign-up."
The webform has a hidden field with its default value set to "%get[project-title]."
I have a custom Content-type called Project that holds data specific to various community outreach projects.

What I am trying to do is displaying a link at the bottom of each "Project" page saying "SIGN UP!" with the "href" pointing to "/project-sign-up?project=[project-title]." However, I cannot figure out how to create the link through the CCK fields of the content type. I have also tried creating a node attachment through Views UI (views_attach) to append a link (with its output rewritten) to the "Project" node, but to no avail.

Could anyone point me in the right direction?


texts: Do breadcrumbs show by default in Drupal 8? I have created nodes, added them to the menu, and made some parent child relationships in the main menu. The breadcrumb in Bartik only shows 'Home'. Is there a trick or config to flag to get the breadcrumbs to show?