texts: Why/How I could remove index.php in the URL

texts:
I have added a RewriteRule to force https on one domain at the end of my .htaccess file

RewriteCond %{HTTP_HOST} ^www.mydomain\.be [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}

It is working fine except that after that, I get a /index.php/ inside all URL

If I add RewriteEngine on before like the following:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.mysite\.be [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}

Then my /index.php/ problem is solved...

I am happy with that, but I don't understand why

Note: Those lines are added at the end of a regular drupal .htaccess. I mean no change in it except that I have uncommented the all to "www" rule (before my https rule at the end)

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

There are no special apache2 conf as welll


texts: How can I suggest a template file specific for a content type?

texts:
In Drupal 8, is there a way to get html.html.twig to only show on a content type like html--blog.html.twig? The suggestions in the debug don't seem to give me that option.

<!-- FILE NAME SUGGESTIONS:
   * html--node--1222.html.twig
   * html--node--%.html.twig
   * html--node.html.twig
   x html.html.twig
-->


texts:
In my custom module amap, I have amap.routing.yml with (among others) this route:

amap.distribution_inscription_many_form:
  path: '/amap/editPlanningMany'
  defaults:
    _form: '\Drupal\amap\Form\DistributionInscriptionManyForm'
    _title: 'Update Planning'
  requirements:
    _permission: 'edit distribution inscription entities'

I'd like to have a link in the title of the route, something like
Update Planning Click here

Drupal 8 API documentation says in Structure of routes

  _title: The page title for the route. It may differ from the menu link title.
  _title_arguments: Additional arguments for the title text passed along to t().
  _title_context: Additional context information for the title text passed along to t().
  _title_callback: A PHP callable (typically classname::method) returning the page title for the route.

but I don't know how to use it...
How can I do that?


texts:
I have a  Content Type 'Teams' which have name as Title field, Image field and Date of birth field using Date module.

I want to display Today's birthday in block. I've tried using views but could not achieve it.

Is it possible to display in drupal. Please Help


texts: Trying to retrieve tid from field_report_group in my module. I can not seem to be able to grab it. Any help would be appreciated.


texts: How can I upload a number of excel files by a cron, with no need to browse and upload from the user interface? I have already made it, but I want these file to be automatically uploaded to a particular table on a cron run or on a single click.


texts:
I was wondering if it is possible to change the background color of a table row.

I want to display certificate files, and if that certificate is going to expire in longer than 30 days the color green would be good. If it is less then 30 days color orange and if it's expired color red.

I tried finding it on the internet but I can't find anything like this.

This is how my current column data looks like.

'c3' => array(
        'data' => array('#type' => 'item', '#markup' => t('@uploaded', array('@uploaded' => date('d-m-Y', $val->upload_date)))),
    ),

I already tried adding '#class' => array('bgcolor' => '#ffffff'), or just 'bgcolor' but that doesn't work.

Thanks in advance!

Complete code

$qry = db_select('push_notifications_api', 'n');
$qry->join('push_notifications_certificates', 'u', 'n.ios = u.cert_id');
$cert_table = $qry
->fields('n', array('app_name', 'ios'))
->fields('u', array('cert_id', 'cert_name', 'upload_date', 'expiration_date'))
->OrderBy('u.expiration_date', 'ASC')
->execute();

$form['certificates']['table'] = array(
 '#theme' => 'table',
 '#header' => array(t('Application'), t('Certificate'), t('Uploaded'), t('Expiry Date')),
 'rows' => array(),
 '#weight' => 30,
);

foreach($cert_table as $key => $val) {

$form['certificates']['table']["#rows"]["'r$key'"] = array(
    'c1' => array(
        'data' => array('#type' => 'item', '#markup' => t('@app_name', array('@app_name' => $val->app_name))),
    ),
    'c2' => array(
        'data' => array('#type' => 'item', '#markup' => t('@cert', array('@cert' => $val->cert_name))),
    ),
    'c3' => array(
        'data' => array('#type' => 'item', '#markup' => t('@uploaded', array('@uploaded' => date('d-m-Y', $val->upload_date)))),
    ),
    'c4' => array(
        'data' => array('#type' => 'item', '#markup' => t('@expiry', array('@expiry' => date('d-m-Y', strtotime($val->expiration_date))))),
    ),
);
}


texts:
I have been working on website with drupal 7.
The website went live at 8/2016, I've noticed recently that I keep getting logged out from the site and have to log in regularly when browsing.
The problem has start with me at 21/12/2016.
I read related questions, all the answers were talking about :

http/https conflict , I made sure that the site is only http version
www/ !www , I made sure that all the www versions will be directed to !www version
cookie problem , I have tried that on different browsers, and the problem was the same.
timing issue : The server team has turn off the firewall and reset the time and server, but nothing happened
session table size: I have cleared all the record in the session table, then tried again !
caching issue: I didn't use any caching module, it's drupal core caching and it's not enabled
module updates : I haven't update any module since the website went live, and it was working properly for 3 months
session expiration, the server team put these values to unlimited!
php upgrading issue: there wasn't any upgrade on the server.

All the solution above didn't work for me. Can you advice please with any suggestion ?


texts: How to restore uploaded backup in Drupal 7 (public files or entire website) correctly?

texts:
When trying to restore public directory I see:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'temporary://cvetmagazin-2016-03-13T16-28-59.tar__0.gz' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => cvetmagazin-2016-03-13T16-28-59.tar_.gz [:db_insert_placeholder_2] => temporary://cvetmagazin-2016-03-13T16-28-59.tar__0.gz [:db_insert_placeholder_3] => application/octet-stream [:db_insert_placeholder_4] => 166375 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1457901164 ) в функции drupal_write_record() (строка 7316 в файле /home/user/drupal_fish/apps/drupal/htdocs/includes/common.inc).

However, Drupal accepts database dump without errors. How to fix that? Thanks.


texts: How do I create a total blank page without any header and footer?

texts:
I am using Drupal 6 and I am stuck in a situation where I need to create a blank page without any header footer which comes as a part of your theme when you create a new page in Drupal.

I have searched lot on this problem  :

Drupal link that I used to get solution, but not helped.
Create a content type to get blank page  solution also not able to solve my problem.

Can any one help me to create blank page without any theme components.

I also read about creating a hook but I am not able to create any hooks.

How I can resolve this issue?


texts: Problems with Language Switcher placement

texts:
I have some trouble with the placement of the Language Switcher on a German/English Drupal 7 site. I have read many pages without finding an answer I could work with which may be due to that fact that I messed things up a bit, so please excuse if this seems obvious. And sorry, I am pretty sure that I have misused the concept of the Language Switcher as well as CSS...

What I want: Language Switcher should be in the top of the header on the left as seen in many sites.

What I have: Language Switcher IS in the top of the header on the left BUT it has some shortcomings I would love to get rid off

I have placed it absolute which makes it ugly for mobile viewers.
It disappears when I am logged in (maybe it is placed too far above?).
There is a white box with the ID block-locale-language near the Language Switcher which obviously was part of it but which configuered to death...

Here is what I did in the style.css

/*Language Switcher*/

#block-locale-language{
  position: absolute;
  left: 21.2%;
  top: 2.0em;
  width: 0;
  height: 0;
  border-bottom: none !important;
}

#block-locale-language ul{
  list-style-type: none;
  width: 210px;
}

#block-locale-language li {
  width: 77px;
    float: left;
}

and here is a shot:


texts: Creating a module arguments page with a shorter URL

texts:
I'm creating two pages with a custom the module. The first page makes an API call to create an XML object and then lists all objects. Each object contains 10 entries but i only display 3 of them. From here clicking on an object directs users to a module argument page.

Is there anyway for me to create an argument page that doesn't have 10 different entries in the URL?

/**
 * Implements hook_menu().
 */
function my_module_menu() {
  $items = array();
  //general page
  $items['my_module'] = array(
    'title' => 'My Module List',
    'description' => 'My module list Page',
    'page callback' => '_my_module_page',
    'access callback' => 'user_access',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
      );
  //single event page
  $items['my_module/event/%/%/%/%/%/%/%/%/%/%'] = array(
    'page callback' => '_my_module_arguments',
    'page arguments' => array(2, 3, 4, 5, 6, 7, 8,9,10,11),
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );

  return $items;
}


texts: Adding a "title" field to video thumbnails in the Video Module

texts:
I would like to attach a textfield field to the video field. How can I go about doing that programmatically?

How do you attach a field of a field?


texts: I'm having a problem getting Context to work properly

texts:
I'm having a kind of weird problem with the Context module in my Drupal 7 environment.  I have the module installed and enabled, however, when I go to Structure --> Context --> Add, the Add Context Admin UI appears and under "Conditions" whenever I select one of the choices, the box to the right of it does not activate like it should, so I cannot put in a path or whatever.  Nothing at all happens.  It's the exact same for the "Reactions" as well.

It works fine in my development environment and the environment with the problem was migrated from the development environment, so I don't understand why it won't work.

I have tried completely uninstalling the module (including deleting the 'Context' folder from the server) and re-downloading and re-installing, flushing the caches, etc.  Everything I can think of and I still get the problem.

Is this a problem anyone else has seen and how do I fix it?

Thanks


texts: Getting Files to show up on new submitted Module page

texts:
I have a module that is ready for public use, and I have created a Drupal Account and created a development sandbox, and even uploaded the files via git. Now, I am very much a newb regarding git, so perhaps I have done something wrong. I have attached 2 screenshots of my module page screens (public facing page and the edit page).

Now I am pretty sure that the reason I cannot promote to a full project as seen on this page is because I need to create an issue so that the Drupal team can review the module. This page says to create an issue with specific details included. However, for Component, I am supposed to select either 'Module', 'Theme', or 'Feature'. I would like to select Module, but the only options that are provided at this time are 'Code', 'Documentation', 'Miscellaneous', and 'User Interface'. What am I missing? What additional steps do I need to follow to get this module publicly published?


texts: Entity Type Manager: How to retrieve webform entries with webform_submission_data conditions

texts:
I would like to get the webform entries submitted by a user with a particular webform_submission_data field value. E.g. field_account_type = "normal"

How can I supply such a condition?

$submission_storage = \Drupal::entityTypeManager()->getStorage('webform_submission');
$submissions = $submission_storage->loadByProperties([
  'webform_id' => 'my_form_id',
  'uid' => $uid,
  'field_account_type' => 'normal' // Not found exception!
]);


texts: Which tables should be emptied when clearing database-stored cache manually?

texts:
Prior to D8 to clear cache manually one could truncate all tables beginning with cache_.

In Drupal 8 there are still tables starting with cache_, but there's also a cachetags table.

Is the advice in D8 still to truncate cache_* if you need to clear cache manually? Is it safe/required/recommended to truncate the cachetags table along with the cache_* tables?

I'm aware there may be contrib modules doing things differently, I'm mostly interested in what core does, and what's considered "best practice" for Drupal 8 in general.


texts: using entity reference fetch different fields automatically

texts:
using entity reference, i am able to relate to nodes with one another. Thats great. The user while entering their blog has an option to relate it to nodes of my custom content type. This works great. Now i want that once the user has selected the node to be related to, the blog should not only show the title of the n node but also other fields from that referenced node. How can i achieve this?

Regards


texts: Creating/registering a user (of a custom profile type) when a certain webform is submitted?

texts:
Before all else - Here's my current code.

function hook_webform_submission_insert($node, $submission) {

  $password = user_password(8);

  //set up the user fields
  $new_user = array(
    'name' => $form_state['values']['e_mail'],
    'mail' => $form_state['values']['e_mail'],
    'pass' => $password,
    'status' => 0,
    'init' => $email,
    'roles' => array(
      DRUPAL_AUTHENTICATED_RID => 'authenticated user',
      6 => 'custom role',
    ),
    'field_dealer_fname'=> $form_state['values']['first_name'];
    'field_dealer_lname' => $form_state['values']['last_name'];
    'field_dealer_company' => $form_state['values']['company_name'];
    'field_dealer_phone' => $form_state['values']['phone'];
  );
 $account = user_save(null, $new_user)

    ->execute();
}

I'm very new to Drupal, but intermediate experienced in Web dev in general. I just recently inherited a client from a previous employee before I joined, and he exclusively used Drupal (7, at that.)

Anyways, he previously had a system to set up a new user through this user-submitted webform, but that functionality apparently died 2 months ago in some sort of host migration. Now, I'm trying to figure out a way to accomplish this task with the already existing webform (v 3.27) and database.

That being said, from what I've found, I'm trying to use a webform Submission Hook to call the (Webform) values

first_name,
last_name,
company_name,
phone,
e_mail

to fill the adjacent (Custom) user profile fields of "Dealer_profile" (along with the default ones)

field_dealer_fname
field_dealer_lname
field_dealer_company
field_dealer_phone

So, referring back to my code, my thought process is:

//create a random 8 char password
  $password = user_password(8);

I was thinking this would be the equivalent of saying "these profile values = this user submitted value"

//set up the user fields
  $new_user = array(
    'name' => $form_state['values']['e_mail'],
    'mail' => $form_state['values']['e_mail'],
    'pass' => $password,
    'status' => 0,
    'init' => $email,
    'roles' => array(
      DRUPAL_AUTHENTICATED_RID => 'authenticated user',
      6 => 'custom role',
    ),
    'field_dealer_fname'=> $form_state['values']['first_name'];
    'field_dealer_lname' => $form_state['values']['last_name'];
    'field_dealer_company' => $form_state['values']['company_name'];
    'field_dealer_phone' => $form_state['values']['phone'];
  );

and ultimately, save this information and execute the hook?

 $account =    user_save(null, $new_user)

    ->execute();

However, I feel like the hook itself is also wrong. This whole hooking thing in Drupal is a little odd to me, coming from mostly Wordpress use. Unfortunately the documentation is a little barebones, or in some way difficult for me to figure out how these things actually work. I was also just kind of thrown into this, and just have to figure everything out! Help is appreciated!


texts:
I used Drupal 7 and the Data module to import a table into Drupal. I could import the orphaned table, but my table has a column of type "timestamp" which does not show up when I try to edit the schema of the data table. I get the following error:

  PDOException: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'published': ALTER TABLE {resource_profiles} CHANGE published published INT NOT NULL DEFAULT 'CURRENT_TIMESTAMP'; Array ( ) in db_change_field() (line 2988 of C:\xampp\htdocs\drupal\includes\database\database.inc).

I followed http://drupal.org/node/1466122, and added the timestamp datatype to /includes/database/mysql/schema.inc.

Where can I edit the schema information for my data table?


texts: How to compare form value in an ajax call

texts:
I have a date picker in my custom form. 'from_date'. When I change the value in this, I need to call a function and compare the date value with another custom value and need to show a popup using custom plugin alertify. I have been succeeded up to creating an ajax_call_back function. But I'm stuck in retrieving form data and showing the popup.
...

$form['from_date'] = array(
        '#type' => 'date_popup',
        '#date_format' => 'd-m-Y',
        '#ajax' => array(
            'callback' => 'check_date',
            'event' => 'change',
        ),
        '#attributes' => array('class' => array('date_popup_frm'),)
    );

....

function check_date($form,$form_state){

//how can I compare the value with $value which I will get after calling an SP

}


texts: How do I save the user submitted values of a multi-step node editing form in the database after last step submission?

texts:
In Drupal 7, I am trying to programmatically create a custom content type. I have defined my custom content type implementing hook_node_info().

For my node editing form, I am using hook_form() and defined my custom node's title here. I used hook_form_alter() to convert my node editing form into a multi-step form, where I used the following code.

if ($step == 4) {
  $form['actions']['finish'] = array(
    '#type'   => 'submit',
    #value'  => t('Submit'),
  );
}
// Add validation handler.
$form['#validate'][] = 'mymodule_form_validate';
// Add submission handler.
$form['#submit'][] = 'mymodule_form_submit';

function mymodule_form_validate($form, &$form_state) {
  drupal_set_message(t('validating multistep form'));
}

function mymodule_form_submit($form, &$form_state) {
  switch($form_state['triggering_element']['#value']) {
    case $form['actions']['next']['#value']: // if 'Continue >>' is clicked.
      $step++;
      $form_state['rebuild'] = TRUE;
      break;
    case $form['actions']['finish']['#value']: // if 'Submit' is clicked.
      $form_state['rebuild'] = FALSE;
      // To Do.
      // Store the values from the form in the database here.
      drupal_set_message(t('Your form has been submitted'));
      break;
  }
}

My multi-step form is working great, but I am stuck on my last step of the form, where I save the user submitted values in the database. I am not getting any reference on this topic.
I am looking for information on how to save my this node in the database, what hooks to use, and some more details. Please guide me in the right direction.


texts: Migrate API: map fields outside the item_selector

texts:
I'm working on a migration of a JSON with this format:

{
  "departement": "19",
  "conseillers": [
    {
     "code": "A24",
     "nom": "DUNAC",
     "prenom": "Roger",
    },
    {
     "code": "A25",
     "nom": "DUNAX",
     "prenom": "Roged",
    },
    { ... }
  ],
}

I'm using the URL plugin with JSON

source:
  plugin: url
  data_fetcher_plugin: http
  data_parser_plugin: json
  item_selector: conseillers

There is no problem mapping each element inside the group: [conseillers]

fields:
    -
      name: code
      label: 'Code identifiant technique du conseiller'
      selector: /code

But the rest api moves to the parent level the global information like "department"

So, How can I map the "conseiller" value which is outside the item_selector?

Thanks!


texts:
With many responsive designs it is not possible to assign image dimensions as they will be determined by the view-port dimensions. However some scripts, such as Packery, require image dimensions to be known to enable them to arrange items correctly, without overlapping or leaving large gaps. One solution often suggested (e.g. at https://drupal.stackexchange.com/a/77330/14365) is to use imagesloaded.

I have looked at other Drupal modules such as Views Isotope and Field Slideshow which both use imagesLoaded. They each implement it in a different way and I am looking for the correct way to add it in to the Packery module.

My understanding is that: First, a call to add the imagesLoaded script needs to be added to the module file. (The script itself is added to the libraries directory within a folder named 'imagesLoaded'). Secondly, the imagesLoaded() must be declared with the JavaScript file which currently contains:

(function($) {
  Drupal.behaviors.packery = {
    attach: function(context, settings) {
      for (var packery in settings.packery) {
        var $container = $('#' + packery);
        $container.packery(settings.packery[packery].settings);
      }
    }
  };

}(jQuery));

Within the above I need to add in:

$('#container').imagesLoaded( function() {
  // images have loaded
});

Does the way that imagesLoaded is added within the module effect if it becomes a function?
Adding the script side-wide is not really appropriate as it is only required in combination with the use of Packery. Does this mean it should be added in a certain way?


texts: How can I use aggregation in multiple field in view

texts:
I want to group by multiple field but I don't know how it works.

In my view, I have :

Code A | cmd Date | Quantity | Price A | Total |

And I want to regroup by Code A then regroup by cmd Date.

For each CodeA I have multiple order in the same month and I want to regroup them, then sum quantity and total. Like :

|Code1 | 09/2015 | 15 | 5 | 75€ |
|----------|10/2015 | 10 | 5 | 50€ |
|Code2 | 08/2015 | 11 | 7 | 77€ |
|----------|11/2015 | 10 | 7 | 70€ |

Someone can help me ?

Thanks


texts: Disallow purchase if coupon code is not entered?

texts:
I have a product that is part of a Groupon-like promotion. The customer purchases a promo code at the Groupon-like website and those coupon codes are entered into my Ubercart system as 100%-off discounts. I want to only allow this particular product to be purchased when one of those specific codes has been entered into the cart. In other words, the credit card entry panel would not appear until they have entered a valid code for that product's promotion.

Is that possible? If so, how might I accomplish that? Rules/Conditional Actions?

Thanks!


texts: How to print the path alias without "/" in views

texts:
I would like to print the path of a node in a view, but without the "/".

With "Content:path" the trailing slash before the alias is always there.

ie:

path-of-node

in stead of
/path-of-node
Any suggestions, pls?


texts: header("Location: /") redirect in template file only works if user is logged in. Why?

texts:
I was developing a new feature for a client, and deployed it live today.  However, due to circumstances out of my control, they decided to implement an alternative solution and asked me to implement a temporary redirect.

This feature was a standalone full screen flash app that did not fit the site theme at all.  So, I implemented the page as a custom html--pagename.tpl.php file and loaded the page-specific JS and CSS.  It is a custom template for an existing content type.

Now, since the client wants a temporary redirect, I added

header("Location: /");

as the first line of PHP code in the template to redirect any access to that URL to the index page.  However, this only works if the user is logged in.  Anyone
else can view this page and the header code seems to be ignored for some reason.

This URL loads regardless of the Published status set to Published or Unpublished.  In the morning, I will modify the .htaccess to execute a 302 redirect, but would like an explanation for this behavior for future reference.


texts: Multisite or multiple sites setup with Open ID server

texts:
I am working on a project where I have a basic site with a sets of modules and configurations. Currently when I get a new client for this project in order for him/her to use their own site, I setup a subdomain, load a basic DB and copy the basic site files over.

This setup has work for me, but now I am having to deal with more clients and the manual process will just make it hard to manage and maintain. Ideally I will love to have it a single set of files will connect each user DB and I don't care if instead of subdomains (they are nicer) I have to use sub-directories.

What will be best for this setup multisite or multiple sites, and will it make sense to have a centralize account (open id) server?

  Note: I was thinking in register the users in a single place and then they can login into their private sites using this centralize
  account system. Otherwise each site will have to have a user 1 account
  with a password to be manage for each site.

Thank you


texts: How do I a custom entity operation with a webform submission?

texts:
My lack of D8 experience is going to show by just how many unknowns I have here. I hope someone can link some of the pieces for me.

I created a custom action using hook_entity_operation_alter() on the admin/structure/webform/manage/dis_document_generator/results/submissions page as you can see below. I'm guessing this will show up on various other pages to which is fine.

Currently as you can see the url is set to the current page but this needs to change once I have a controller redirect to. Also, it would be nice to add this operation through a controller instead of a hook but that's not important at the moment.

    /**
     * Implements hook_entity_operation_alter()
     */
    function dis_doc_gen_entity_operation_alter(array &$operations, \Drupal\Core\Entity\EntityInterface $entity) {
      if ($entity->getEntityTypeId() === 'webform_submission' && $entity->bundle() === 'dis_document_generator') {

        static $operation;
        static $permission;

        if (is_null($operation)) {
          $user = \Drupal::currentUser();
          $permission = $user->hasPermission('utilize mq client');

          $url = \Drupal\Core\Url::fromRoute('<current>');

          $operation = [
            'title' => t('Send XML'),
            'weight' => 8,
            'url' => $url,
          ];
        }

        if ($permission) {
          $operations['send_xml'] = $operation;
        }
      }
    }

I was using WebformSubmissionNotesForm.php as a sample to create a controller because it looked relatively simple but I'm not sure if it's a best choice because I don't actually need a form. I'm just going to perform an action and then return however using it for now.

The router for it is this:

entity.webform_submission.notes_form:
  path: '/admin/structure/webform/manage/{webform}/submission/{webform_submission}/notes'
  defaults:
    _entity_form: 'webform_submission.notes'
    _title_callback: '\Drupal\webform\Controller\WebformSubmissionViewController::title'
  requirements:
    _entity_access: 'webform_submission.notes'

With my module being called dis_doc_gen I gather that my router details should look like this?:

dis_doc_gen.webform_submission.sendxml:
  path: '/admin/structure/webform/manage/{webform}/submission/{webform_submission}/sendxml'
  defaults:
    _entity_form: 'dis_doc_gen.sendxml'
    _title_callback: 'Send XML'
  requirements:
    _entity_access: 'dis_doc_gen.utilize_mq_client'

where my permission is called utilize mq client and so I believe it would be represented here as dis_doc_gen.utilize_mq_client.

Finally, WebformSubmissionNotesForm.php sits under webform/src. The one plugin I managed to do for my webform had to go under webform/src/Plugin/WebformHandler so I'm wondering since this is off a webform submission whether I need to place a controller at:

webform/src or
webform/src/Plugin/WebformHandler or
webform/src/Plugin/WebformSubmissionHandler.

Last, webform defines WebformSubmissionNotesForm in it's header like this:

<?php
/**
 * Defines the WebformSubmission entity.
 *
 * @ingroup webform
 *
 * @ContentEntityType(
 *   handlers = {
 *     "form" = {
 *       "notes" = "Drupal\webform\WebformSubmissionNotesForm",

Since I can't have that hardcoded like that for my new controller I gather that's fine because I can just attach my controller through the interface.


texts: Publishing events on a calendar to an individual/a specific group/ or all

texts:
Hey I'm new to drupal and trying to create a calendar that users can publish different items to.

there are different roles involved say:
worker,
supervisor,
manager.

workers are divided into groups.

Are there modules that would allow a supervisor or manager to post an event that
1) only a single worker could see,
2) that only a group of workers could see,
3) that everyone  could see.

Would user-relationships handle this?


texts: How can I assign values to radio buttons with the forms api?

texts:
I made radio buttons with the forms api using this code:

"sex" => array(
    '#type' => 'radios',
        '#title' => t('Sex'),
        '#options' => array(t('M'), t('F')),
)

It works perfectly, but instead of storing an M or an F in the database, it stores a 0 or a 1. How can I decide what value is stored for each option?


texts: How do i print image title in custom node for image gallery

texts:
I use content types for image gallery and write own custom node for image gallery all images are show in custom node by following code but i don't know how to print the image title.

In this code i have given static title 'Circles and Cycles ' and i need dynamically title of every image.

<div id="node-<?php print $node->nid; ?>" class="node-gallery">

    <?php
        $imgcount = count($node->field_gallery_image['und']);
        for ($i = 0; $i < $imgcount; $i++) {
        $image_uri = $node->field_gallery_image['und'][$i]['uri'];
            // url
            $masthead_raw = image_style_url('gallery-thumb', $image_uri);

    ?>

          <a href="<?php print file_create_url($node->field_gallery_image['und'][$i]['uri']); ?>" rel="group-<?php print $node->nid; ?>" class="product-link">

 <img class="image<?php print ($i + 1);?>" src="<?php print $masthead_raw; ?>" />

Circles and Cycles

      <?php
        }?>


texts: Create duplicate registration form with extra fields

texts:
I have a site built using Drupal 7. The site has a registration form now. There is a new requirement to add a couple of new fields in the registration form and put it in a new page.

http://example.com/register is the existing registration form and user submitting this form will be registered. http://example.com/newpage is a new page with some content and registration form with two extra fields. When users submit this page, a new user account will be created along with saving the new fields to the user profile.

How can I implement this?


texts: Making sticky results in Search API Solr

texts:
We want to be able to promote some nodes on the search results.
I thought about using the "Sticky" option, so if a node is sticky, it should be on top of the results.

I've tried using the "Boost" option in the index field settings but it doesn't work.

Is there any way of achieving that?

(Using Drupal 7, Apache Solr 4.6.1 and Search API)


texts: View's path prevents 404 page from showing

texts:
D7, Views 3. I'm kinda puzzled with how Views path work. I have these paths at my site:

mysite.com/people - a view displaying a list of all people

mysite.com/people/alice - an article about Alice

mysite.com/people/bob - there is no such article at mysite.com

When I go to /people/alice I get my article. And when I go to /people/bob I naturally expect to get a 404 page. But /people view is shown instead, probably seeing the "people" part of the path and thinking I've called /people view with some parameter. As I do not expect /people view to have any parameters and always want it to display a list of all people, how do I tell it not to get into Drupal's process of resolving its paths?


texts: Ubercart Product import containing HTML formatting in product description

texts:
Help me to import ubercart product import with product description contains html styling.

Currently I am using Feeds and Ubercart Feed Mappers.

Source data in excel format.

I try to import CSV file but all the styling and bullet points are not showing correctly.

So I need to import product information with long text and style.

which format should i use to upload this type of Style Information.


texts:
I've been using Drupal 8 for a while now and while it's not bad, it does slow down development a bit, as the whole framework is more strict. Which is a good thing to some, but I know of many people like me, who prefer having the freedom of easily creating modules, versus having to set up the new folder structure etc.

So my question is, can one survive without upgrading for the foreseeable future? And what is the longest time one can realistically go without upgrading?


texts: Using regex path pattern on Themekey module

texts:
Currently on the themekey config page for regex instructions it shows:

  regular expression, including delimiters and modifiers (see PHP
  Manual)

But is there an example of how to setup a url pattern whre I want to only match paths that end with /organize?


texts: Show only specific fields on Edit page when a Term is selected

texts:
How do I show on (content type) Edit page only specific fields?
For example if I have selected the Laptop term then I should see Procesor, RAM and HDD fields and if I select TV term then I should see Screen size, Brand, Screent type fields.


texts: Twitter like notification when new posts are made

texts:
I was wondering if there was a module out there that could replicate something to what Twitter do when you have new Tweets you haven't seen in your timeline (so a notification of how many new items there are without refreshing the page).

See examples of what I mean, not the best at explaining things. preferably without using node.js as it hasn't worked for me so far!

Thanks in advance


texts: How do I display, in a ColorBox popup, a caption AND a title (caption from image 'alt' attribute and title from 'title' attribute

texts:
I am trying to display in a ColorBox popup, a caption AND a title (caption from image 'alt' attribute and title from image 'title' attribute).
The colorbox is opened when an image is clicked.

Here is an example of what I want to do.

The img will be something like the following.

<img typeof="foaf:Image" src="http://localhost:4444/img.jpg" width="336"   height="254" alt="LEGEND / CAPTION balbalblalblalba balbalblalblalba balbalblalblalba" title="TITLE balbalblalblalba balbalblalblalba balbalblalblalba" class="">

Do you have any idea of how can I do that?

I am using:

Colorbox 7.x-2.10
Drupal 7.35

The colorbox module settings are the following.


texts: How do I get name and label of fields in user profiles?

texts: I want to get the list of fields added to user profiles(listed here admin/config/people/accounts/fields). I need machine name and label of each field. How do I get them?


texts: How to add an existing custom field to a new content type

texts:
In my new module I am writing, I am creating a new content type.  In this new content type, I want to attach custom fields for a media player: the media player from MediaFront and a File field with a Media File Selector widget type.

As I understand it, these fields are already defined; I just need to create an instance of each field.  How do I create an instance of each field, and then configure the extra parameters?

I haven't come across any good tutorials on how to do this.


texts: Node access-control modules for members-only pages

texts:
I am building a straightforward Drupal 7 site that has public pages and members-only pages. There is just one kind of member. Right now access control does not need to be finer than that. It seems my choices are the modules Content Access, Nodeaccess, Simple Access, node privacy byrole, Taxonomy Access Control and Taxonomy Access Control Lite. To achieve what I need, I could control access either by role, or by using a taxonomy term like "members-only". Both would work.

All these modules are still under development for D7, and are in varying stages of (un)completion and bugginess. For some, development seems erratic or stalled. In addition, their UX's are of varying complexity for the non-sophisticated content editor.

(Another alternative to all of these modules is to create a separate content type for members-only pages, and just use the built-in content-type permissions. That seems inflexible and duplicative, but it is a way out.)

My question is a practical one, given the current reality: which one would you choose for use now or in the next few months, for this use case, and which one seems to have the brightest future?

FOLLOWUP (7 months later): After trying Content Access (CA) and Taxonomy Access Control (TAC), I settled on TAC. Content Access can do by-node access control, but the UX is not simple, and I wouldn't want to subject my editors to it. I find that using a taxonomy term to designate access can essentially be an abstraction mechanism: a single term can represent a complicated set of access choices. For one content type (calendar events), I vary the the access based on taxonomy. For another (members-only pages), I just use a one-term taxonomy vocabulary that is a required field (so its value can't change). So for me, TAC's functionality is a superset of CA. I also needed Field Permissions to selectively expose the fields in calendar events.


texts:
Why is my hook_node_validate implementation being called when I try to delete a node through the node editing form (by clicking the delete button at the bottom of form)?  Validation fires and then my node doesn't get deleted which is not what I want.

I can delete without any problems when clicking on delete link at admin/content but not whenclicking delete button on node edit form since validation fires and fails.  What could be the reason for validation firing here?


texts:
I am developing a module, but the hooks I am adding are not invoked from Drupal. It happens with more than one hook.

I read the documentation for the hooks, and I cannot find anything that would explain why this happens. I verified I am using the correct parameters, and returning the correct value.

What am I doing wrong? Is there anything I am missing?


texts: How to theme table row to link particular column data?

texts:
I have created a list of table records in admin section using the following code.

class userDownloadedFiles extends ControllerBase{ public function userList() {
$header = array(

  array('data' => $this->t('Username'), 'field' => 'name', 'sort' => 'asc'),
  array('data' => $this->t('Email'), 'field' => 'mail', 'sort' => 'asc'),
);

$db = \Drupal::database();
$query = $db->select('users','u');
$query->innerJoin('users_field_data','ufd','u.uid=ufd.uid');
$query->fields('ufd', array('name','mail'));
$table_sort = $query->extend('Drupal\Core\Database\Query\TableSortExtender')
                    ->orderByHeader($header);
// Limit the rows to 20 for each page.
$pager = $table_sort->extend('Drupal\Core\Database\Query\PagerSelectExtender')
                    ->limit(20);
$result = $pager->execute();

// Populate the rows.
$rows = array();
foreach($result as $row) {
  //Get URL to user profile
  $profile_url = \Drupal::service('path.alias_manager')->getAliasByPath('/user/'.$row->uid);

  $rows[] = array('data' => array(
    'name' => "$row->name",
    'mail' => $row->mail,
  ));
}

// The table description.
$build = array(
  '#markup' => t('List of users who have downloaded model drawing or requested an account for downloading one.')
);

// Generate the table.
$build['user_info_table'] = array(
  '#theme' => 'table',
  '#header' => $header,
  '#empty' =>t('There are no records yet.'),
  '#rows' => $rows,
);

// Finally add the pager.
$build['pager'] = array(
  '#type' => 'pager'
);
return $build;  }}

But the a tag used in username column is displayed as it is not appearing as link. This is how it appearing

Please guide me how to make it likable and how would I do it for other columns too.


texts:
For a Taxonomy Vocabulary on my Drupal 7 site, I have added several custom fields for each Taxonomy Term, and want to have two different ways of viewing the Term information: a summary and a detailed view.

I've created the two Views for summary and detailed (myterm-summary/% and myterm-detail/%). But now the question is how to create a link between them. I'd like a link on myterm-summary/% to link to myterm-detail/% as a "Read More..." link. Is there some View element I can add to the View to create a custom link, using the dynamic URL variable  in the process?

I know I can create a Rich Text block header or footer for the View, but can I refer to the URL variable in that text block somehow?


texts: Group search results by content type and limit count

texts:
I am trying to group search results by its content type. Also, I want to show not more than 4 results per content type.

For an assumption, it should look like this:
Content type1-
  Result1
  Result2
  Result3
  Result4
Content type2-
  Result5
  Result6
...

I am able to achieve this using TEMPLATE_preprocess_search_results().

function custom_preprocess_search_results(&$variables) {
  $variables['search_results'] = '';
  $resultTypes = array();

  // Divide results
  foreach ($variables['results'] as $result) {
    $resultTypes[$result['bundle']][] = $result;
  }

  // Create fieldsets
  foreach ($resultTypes as $resultType => $resultTypeResults) {
    $value = '';
    $i = 0;

    foreach ($resultTypeResults as $result) {
      $value .= theme('search_result', array('result' => $result, 'module' => $variables['module']));
      $i++;
      if ($i == 4) {
        $value .= l(t('Show more'), current_path(), array('query' => array()));
        break;
      }
    }

  $variables['search_results'] .= theme('fieldset', array('element' => array('#title' => $resultType, '#children' => $value));
  }
}

But this is not an optimal method, since I trimmed down the results per content type (but actually they exist). Say if Content type1 has 10 actual results and Solr's maximum results per page is set to 10, then I will end up showing first 4 results of only Content type1.

Please suggest an ideal method to list 'n' matched results of every content type.

Thanks!


texts:
I want to include a whole new theme into a site to run along side the existing site on new pages (which make up another 'site' on this installation)
.
I have thought that I could just create new page templates prefixed with the new site name within the existing theme and it would all be seperate, but I didn't think about the stylesheets and scripts in the theme.info file.

I want to use completely new html, js, and css as the current stuff is horrible (I can just not render the current scripts and css, but I am wondering if there is a better way.). I also want to avoid unnecessary impact to the current installation as there are already 3 sites running on it.

Is this the best way to add another simple site to an existing Drupal installation?


texts: Make one part of a form depend on other part of a form via AJAX

texts:
In Drupal (7) Form API, it is possible to let one part of a form depend on a single form element, e.g. a select element, via AJAX. This allows to build drilldown forms with unlimited depth.

However, sometimes I would like one part of a form to depend not just on one single select element, but on an entire section of a form, e.g. all elements within a fieldset.

I am going to give some background. But please don't get lost in details.

Example for simple drilldown

A form with:

one select element to choose a field.
another select element to choose a field formatter. This one depends on the former, because different formatters exist for different field types.
a fieldset to choose the formatter options. Every formatter has different options, so this one would depend on the formatter dropdown via AJAX.

So far this is all doable with Form API, and I already made it work successfully. (If you want, look at renderkit and cfr modules).

Example for not-so-simple drilldown

This is what this question is about.

A form with

A select element to choose a type of entity relation. The options are: Entity reference field, taxonomy term reference field, entity author, or "profile2 from user or author".
In case of one of the two field types, a further select element to choose which field. The options will be all the entityreference fields, or all the taxonomy term reference fields. (entity author does not have any options).
In case of "profile2 from user or author", there is another select element to choose the profile type.
There could be other entity-to-entity plugins that would give us other option forms.
Below all of this, another select element to choose a view mode for displaying the selected entities. This will show view modes for the target entity type of the relationship.

In case of "entityreference field", the target type is only known after choosing the exact field. Maybe for other entity-to-entity plugins, other form elements would define the target type. So the form below (to choose the view mode) would need to be reloaded with AJAX whenever something changes anywhere in the form above. The form would no longer depend on a single element, but on a whole bunch of elements.

I need to stress that the upper part of the form is dynamic and pluggable, so we cannot hardcode targeting any specific elements.

Ideas so far

One idea was to put the entire upper form into a modal, so that the
lower part of the form would only reload after the modal is submitted and closed. I think this is more or less what Views is doing.

Another, cheaper idea would be to have one toplevel select element to choose the entity type, and then then have both parts of the form depend on this toplevel select. So e.g. you could only choose entityreference fields where the target type matches the entity type you chose before.

Any other ideas?


texts: Why does js click function run multiple times?

texts:
I'm creating some accordion functionality for fields and paragraphs using a combination of twig templates and a custom JavaScript file.

Everything prints as expected and the basic accordion functionality works; however, the click function script is running multiple times, causing an "expand-collapse-expand-collapse..." behavior. See image:

Here is the script file:

(function($, Drupal) {

/* Add span to wysiwyg button classes for alignment
------------------------------------ */
Drupal.behaviors.accordionFaqFunction = {
  attach: function (context, settings) {
        $('.toggle').click(function(e) {

                e.preventDefault();
                var $this = $(this);

                if ($this.next().hasClass('show')) {
                        $this.next().removeClass('show');
                        $this.next().slideUp(350);
                        console.log("hiding");
                } else {
                        $this.parent().parent().find('li .inner').removeClass('show');
                        $this.parent().parent().find('li .inner').slideUp(350);
                        console.log("showing");
                        $this.next().toggleClass('show');
                        $this.next().slideToggle(350);
                }
        });

  }
};

})(jQuery, Drupal);

Why is the script running multiple times?


texts: Custom template for specific vocabulary term

texts:
Hi guys i hope you can help me with this, i made a vocabulary called Colors and inside this i have the terms: red, green, blue.

I was wondering, how can i make custom templates for each term, for example, for mysite.com/colors/red i want a different template than for mysite.com/colors/blue

I saw that it's possible for nodes, but don't know if it's possible for taxonomies. How can i do this?

Edit: for Drupal 7


texts: ReflectionException: Class \MenuBlockKernelViewSubscriber does not exist

texts:
Doing a simple staging to production migration, copied all files, and the database,. Imported the database successfully but now when visiting homepage of the site I get the below error message/messages:

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

**ReflectionException: Class Drupal\menu_block\EventSubscriber\MenuBlockKernelViewSubscriber does not exist in ReflectionClass->__construct() (line 30 of /var/www/vhosts/cpp.org/httpdocs/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterEventSubscribersPass.php).**
ReflectionClass->__construct('Drupal\menu_block\EventSubscriber\MenuBlockKernelViewSubscriber') (Line: 30)
Drupal\Core\DependencyInjection\Compiler\RegisterEventSubscribersPass->process(Object) (Line: 141)
Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object) (Line: 788)
Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1322)
Drupal\Core\DrupalKernel->compileContainer() (Line: 896)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 472)
Drupal\Core\DrupalKernel->boot() (Line: 668)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)


texts: Difference between Relation and term reference field

texts:
Can anyone explain, what is the difference from practice point of view between relation (by Relation module) and term reference?

I mean if I will use as product attribute taxonomy term, what type of attribute connection I should use?


texts: How to process different URL page via Drush?

texts:
I'm testing the following Drush 8 command (using --uri parameter):

drush --uri=https://www.example.com/custom/path ev 'var_dump(current_path());'

however when printing current_path(), it always returns the same, default page. To clarify, specified page exists.

According to this page, I think it should work this way.

How I can make Drush to parse an URL of my choice?


texts: How to display a variable in callback hook_menu?

texts:
I'm creating a page with Hook_menu and I would like to display the user agent that page. This is my code to generate my page.

/**
 * Implements hook_menu().
*/
function custom_module_menu() {
    $items = array();
    $items['custom_module'] = array(
        'title' => 'My Custom Module',
        'description' => t('Best Custom Module'),
        'page callback' => 'custom_module_back',
        'access arguments' => array('administer site configuration'),
    );
    return $items;
}

function custom_module_back(){
        $output =  array(
            'first_para' => array(
                '#type' => 'markup',
                '#markup' => '
Test
 '
            ),
        );
        return $output;
    }

I try to set a variable like this $user_agent = $_SERVER['HTTP_USER_AGENT']; and then call it after the p tag.

Like this

function custom_module_back(){
            $output =  array(
                'first_para' => array(
                    '#type' => 'markup',
                    '#markup' => '
Test
 ' $user_agent,
                ),
            );
            return $output;
        }

And this did not work.

How can I display a variable into a callback ?


texts:
Problem: Translation tab under node/edit is missing for some nodes and visible for others, considering the fact that all nodes are same content type.

Example: I have a content type property and the "Enabled, with translation" option is also marked.

Let’s say I have 5 nodes type property"node1, node2, node3, node4 and node5". The translation tab for node1, node2 and node5 might be visible but missing for node3.

Core: Drupal 7

languages enabled: English, Russian and Romanian

List of enabled modules for translation:

Content translation

Translation overview

Language Icons

Localization update

Entity Translation

Block languages

Contact translation

Field translation

Internationalization

Menu translation

Multilingual content

String translation

Taxonomy translation

Translation sets

User mail translation

Variable translation

Views translation

Multilingual panels


texts: How to send a Group email based on date field using Rules?

texts:
I'm using the Group module and I have a Group content type called Events with a date field. I am having trouble figuring out how use Rules to send an Email on the same day as the date field to all the members of the Group.

I've tried creating a rule but it's just wrong:

Event: runs on cron
Condition: group content, datefield equals, is node type Event
Action: get group members from group audience, loop group members, send email

Most of what keeps showing up in my searches to answer my question, are not for Group content.

Any help?


texts: Random default image for a CCK image field

texts: Is it possible to use a random default image for a CCK image field, if the user doesn't provide an image?


texts:
function mythemename_pager_next($text, $limit, $element = 0, $interval = 1, $parameters = array()) {
  global $pager_page_array, $pager_total;
  $output = '';

  // If we are anywhere but the last page
  if ($pager_page_array[$element] < ($pager_total[$element] - 1)) {
    $page_new = pager_load_array($pager_page_array[$element] + $interval, $element, $pager_page_array);
    // If the next page is the last page, mark the link as such.
    if ($page_new[$element] == ($pager_total[$element] - 1)) {
      $output = theme('pager_last', $text, $limit, $element, $parameters);
    // The next page is not the last page.
    } else {
      $output = theme('pager_link', $text, $page_new, $element, $parameters);
      //$output = '

';
    }
  }

  return $output;

}

How to make NEXT PAGE link visible on last page? For example we have 3 pages and i am on the 3rd page and i should see NEXT page link. Please assist to me with function above, thanks!


texts: drupal_add_js best practice to include inline code or script file

texts:
While reading the API page for drupal_add_js, I kept wondering what is the best practice to include inline JavaScript or a JS file.

It seems like it works exactly the same even if you omit 'file', 'external' or 'inline' like in this example :

Without 'file'

drupal_add_js('misc/collapse.js');

With 'file'

drupal_add_js('misc/collapse.js', 'file');

So the question is rather simple. Why would I choose one over another and what is the standard way of coding this ?

Thanks !


texts: Weird node edit form behavior with feeds imported nodes

texts:
got a weird situation going on. I imported a bunch of nodes from a csv file using the feeds module to a particular content type. This conent type have different type of field like address field, entity reference, and a lot of long text.

All records from the file are imported and I can see all the nodes properly. But when I go in edit mode, All the text fields are empty. Title, address, dates and links fields are ok, but all text are empty. The data is in the database as well as showing on the node, but not in the edit mode.

This is of course causing me problems as when you have to edit, you"loose" all the text. I have a multilingual site...but all those node are set to english...and it's working. The only thing I saw was the fields table didn't seem to get the language value from the node set by the feeds. But I updated it manually in the table and it's not helping anyway.

Th encoding of the csv is utf-8..and I use \n as line break....it's an export of mysql.

Any idea why it's doing this? What I am doing something wrong? Is there a special trick to apply to prevent this...it's driving me crazy..

Thanks


texts:
I just tried to implement Drupal Multi site installation with the link 2 Minute Multisite With cPanel. We found Warning: symlink() [function.symlink]: File exists in /home/ioss/ashokks/sites/test1/index.php on line 5. We are trying to installing the below domain http://test1.ashokks.com/index.php, i have already setup Drupal 7 in ashokks.com, and we add sub domain test1. We want a Multi drupal site test1, with the sub domain of ashokks.com

Thanks in advance


texts:
I am looking a way to create a food menu sign up sheet.
Login user can select food menu from the list, If somebody picks the food, it is disabled, so nobody can sign up for that item again. Is there anything like this out there?


texts: Importing 'alt' and 'title' fields does not work for custom image migration

texts:
I'm doing a D7->8 custom migration. While images (even multiple) get imported fine via a separate file migration based on d7_file, 'alt' and 'title' tags are not migrated at all.
The images are imported via

field_galerie:
  plugin: iterator
  source: field_galerie
  process:
    target_id:
      plugin: migration
      migration: luxus_files
      source: fid

Any help appreciated!


texts: How do I generate a search snippet similar to core search for a custom search API page?

texts:
I installed solr and search_api and search_api_pages. It's all working as expected but, for now, my new search page need a lot of configuration to display correctly. Unlike drupal core search, which automatically just renders a snippet, with search_api one has to configure a view mode specific for search for each content type.
For now, I am looking for a quick and dirty way to generate the exact look and feel of drupal core search.
I looked at drupal core search and it seems the results are processed using search_excerpt function. I am not sure how core search generate this snippet but I am interested in doing the same for my custom search api page.


texts: User registration form throws validation errors on already unset profiles´ fields

texts:
Using Drupal 7 with Profile2: I have a number of profile types, with different fields, some of which I want a registrant to already fill up during the registration process. I´ve checked "Show during user account registration" for all. In my custom module, I´m first taking the registrant´s choice of profile, then unsetting (unset(); also tried hide() and ...[#access]=FALSE) all the other profiles and then rendering the registration form. This 'shows up' correctly because I only get to see the chosen profile fieldset. However, when I submit the form I get validation errors (required fields) on the unset profiles´ fields. So apparently only unsetting/hiding/etc. won´t do the trick. What am I missing?

Appreciate any help!

Best,
Mir


texts: Giving Add and remove option to select and deselect from one list to another

texts:
I want to make user able to chose from one list of select options to another . A good example is in the picture here .

. Could you please tell me if there is a module to achieve this?
I tried using two select elements in the form and some jquery . But that is not working perfectly .
The problem is when user once select the options and visit next time , the previously chosen list does not appear . Thank you .


texts: how to retrieve field collection data associated with a node

texts:
I have an event node which contains a reference to a gallery field collection. If I do a dump of the $variables variable, I can find this

$variables -> field_gallery_image['und'][0]['value']

but I don't know where to use that value to do a table look up to actually find the data in the field collection. I was able to find that id number in the field_collection_item table, and then was able to find that id in the field_data_field_image table (I have an image field), but I'm not sure where to go from here.


texts: How to non-destructively test file-detection functionality

texts:
I am writing tests for a module that is dependant on an external library, located in:

sites/all/libraries/mylib

I have written a hook_requirements to check for the presence of this library and display it in the site status report.

However, I cannot find information or documentation about testing for the presence/absence of external files reliably. The verbose run of my test currently shows that it detects the file in my sites libraries folder.

Right now I am playing around with workarounds like moving the contents of mylib during the test setup call but that seems problematic to me because of the potential issues if tests are not completed.

Any ideas?


texts: Generically detecting changed fields in a custom form prior to saving a node

texts:
I'm adding certain fields from a content type into a custom form using field_attach_form(). When the form is submitted I'm processing those fields by calling field_attach_form_validate() and field_attach_submit() from #validate and #submit callbacks.

At that point, I want to compare the post-submit, prepared node object to the original node and only bother to node_save() it if any of the fields have changed. Therefore, I begin by loading the original node using entity_load_unchanged().

Unfortunately, the field arrays in the original node object don't match the field arrays in the prepared node object which is waiting to be saved, even if no changes have been made to the fields, so a simple "$old_field == $new_field" comparison is impossible. For example, a simple text field appears like this in the original:

$old_node->field_text['und'][0] = array(
  'value' => 'Test',
  'format' => NULL,
  'safe_value' => 'Test',
);

Whereas in the prepared node it appears like this.

$node->field_text['und'][0] = array(
  'value' => 'Test',
);

You might think to just compare the 'value' key, but then you run into fields made up of other elements which don't have 'value' keys. For example, let's look at an address field where there is no 'value' key and there are keys in both the old and prepared nodes which don't have counterparts.

Old node

$old_node->field_address['und'][0] = array(
  'country' => 'GB',
  'administrative_area' => 'Test',
  'sub_administrative_area' => NULL,
  'locality' => 'Test',
  'dependent_locality' => NULL,
  'postal_code' => 'Test',
  'thoroughfare' => 'Test',
  'premise' => 'Test',
  'sub_premise' => NULL,
  'organisation_name' => 'Test',
  'name_line' => 'Test',
  'first_name' => NULL,
  'last_name' => NULL,
  'data' => NULL,
);

Prepared node

$node->field_address['und'][0] = array(
  'element_key' => 'node|page|field_address|und|0',
  'thoroughfare' => 'Test',
  'premise' => 'Test',
  'locality' => 'Test',
  'administrative_area' => 'Test',
  'postal_code' => 'Test',
  'country' => 'GB',
  'organisation_name' => 'Test',
  'name_line' => 'Test',
);

For empty fields, there is yet another discrepancy.

Old node

$old_node->field_text = array();

Prepared node

$node->field_text = array(
  'und' => array(),
);

Can I generically compare any field's old and new value to detect whether it has changed or not?
Is this just an impossibility?


texts:
I have a button in my custom module

  function sign_up_form_user_register_form_alter(&$form, &$form_state, $form_id) {
    $form['captcha']['#suffix'] ='<input type="button" id="test" name="test" value="OK">';

    $form['#attached']['js'][] = array
      (
       'type' => 'file',
       'data' => drupal_get_path('module', 'sign_up') . '/js/sign_up.js',
    );

         $form['actions']['submit'] = array("#type" => "submit", "#value" => "Create Account",
        "#ajax" => array(
        "wrapper" => "formwrapper", "effect" => "fade", "method" => "replace",));
   }

Note: Ive removed the callback key of #ajax inorder to avoid page refresh.

In my sign_up.js I made an ajax call when this button is clicked.

  $(function() {

      $("#test").click(function(){

         $.ajax({url:"/path/to/normalphp/page/userLogin.php",success:function(response){

          alert(response);

      }});
    });
  });

The onclick is working and the ajax call is also successful.

In my userLogin.php (not a module file.Normal php file) I just hardcode the uid and call user_login_submit() .

<?php

 chdir($_SERVER['DOCUMENT_ROOT'].'/');
 define('DRUPAL_ROOT', getcwd());
 //Load Drupal
 require_once './includes/bootstrap.inc';
 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

  $account = array('uid' => 49); //existing uid
  user_login_submit(array(), $account);

The result which I expect is to automatically redirect the user to welcome screen.But this is not happening.When I try to login with this user from the drupal login page its successful.
This is just a test as I wanted to customize my registration screen (make ajax calls,jquery validations etc) and then automatically redirects to welcome screen when the validation is success.
Note: I have already done the settings in drupal where email notification is not needed.
Can someone help me out in this?


texts: Theming: when I use a smaller device, my main content goes behind my sidebar

texts:
I am making a sub-theme from the basic theme for Drupal 7. The side bar works fine on all sizes above 480px in length, but on 480px or below, my content goes behind my sidebar and there is a horizontal scrolling bar. I can see the content when I scroll, but I want all the content to fit in the main content area and not in space to the left or extra space to the right. I set my sidebar to the css code of

position: fixed;


texts: user picture changes after saving profile

texts:
to solve a problem related to the expiration date of some users on my website I made a module that updates just the "expiration" field when a user successfully place an order.
The structure of the module is very simple and is as follows:

<?php

/*
 * Implementation of hook_order()
 */
function update_exp_date_uc_order($op, &$arg1, $arg2)
{
  if ($op == 'update' &&
      $arg1->order_status == 'payment_received' &&
      $arg2 == 'completed')
  {
    // parameters
    $exp_date_field_name = 'field_participant_expiration';
    $exp_date_field_name_aut = 'field_participant_expiration_aut';

    // get order user ID
    $order_user_id = $arg1->uid;
    // load the user
    $user_fields = user_load($order_user_id);
    // get the current expiration date of the user
    $current_exp_date = field_get_items('user', $user_fields, $exp_date_field_name);
    $current_exp_date_aut = field_get_items('user', $user_fields, $exp_date_field_name_aut);
    $current_exp_date = $current_exp_date[0]['value'];

    if ( isset($current_exp_date_aut) && !empty($current_exp_date_aut) ) {

        if ( strtotime($current_exp_date_aut) > strtotime('now') ) {

            $edit_exp_date = array($exp_date_field_name => array(
                'und' => array(
                            0 => array(
                                'value' => gmdate("Y-m-d", strtotime($current_exp_date_aut)+(365*24*60*60))
                                ),
                            ),
                ),
            );
        }
        else {
            $edit_exp_date = array($exp_date_field_name => array(
            'und' => array(
                        0 => array(
                            'value' => gmdate("Y-m-d", strtotime('+1 year'))
                            ),
                        ),
            ),
        );

        }
    }
    else {
        $edit_exp_date = array($exp_date_field_name => array(
            'und' => array(
                        0 => array(
                            'value' => gmdate("Y-m-d", strtotime('+1 year'))
                            ),
                        ),
            ),
        );

    }
    user_save($user_fields, $edit_exp_date);

  }
}

It works as expected but I just realized that it deletes the user profile picture.
Do you guys have any idea why?

To quickly solve this issue I was thinking of doing something like:

$temp_picture = $user_fields = user_load($order_user_id);
$temp_picture = $user_fields->picture;

user_save($user_fields, $edit_exp_date);
user_save($user_fields, $temp_picture);

I am sure there is a more compact way to code it and suggestions are more than welcome.

My real questions are:

why are the pictures deleted after saving the user? (I set an automatic profile picture, which doesn't work, but it could be related...)
is the quick fix I posted above gonna work?

Thank you in advance.
Guido


texts: Checkbox so user can decide whether image should be displayed or not

texts: I would like to add a checkbox yes / no whether the image field should be displayed or not in a node.


texts: Where to add custom theme function that generates HTML?

texts:
I am making a theme for Drupal 7 that includes an HTML5/CSS3 animation in the header. The animation works fine, but I want to generate the HTML for it dynamically so there is an element of randomness.

At the moment I am doing this via a pair of simple for loops in page.tpl.php but I am aware this isn't really the best place to put the code. I have spent a little while searching and most answers seem to deal with modifying variables or code that Drupal puts out, whereas this is generating some completely new HTML.

What is the "Drupal way" to handle this? Just add a custom function to template.php that I call (themename_mycustomfunction) or do it in the preprocessor function (themename_preprocess_page) to add the generated HTML as a variable?
Thanks

EDIT: This is the code I've currently got located at the top of my page.tpl.php. Nothing fancy, just generates some divs with the classes that the CSS3 animation will use. Where is the best place to put it though?

    <?php
    for ($i = 1; $i <= 10; $i++) {
        ?>
        <div class="block o<?php print rand(1,3); ?> w<?php print rand(1,6); ?> x<?php print rand(1,9); ?> start">

        <?php
    }
    ?>
    <?php
    for ($i = 1; $i <= 20; $i++) {
        ?>
        <div class="block o<?php print rand(1,3); ?> w<?php print rand(1,6); ?> x<?php print rand(1,9); ?>">

        <?php
    }
    ?>


texts: Rules send email containing tokens from submitted node displays token for empty field

texts: I have a rule that sends the contents of a node to an email address on save, I am including the contents of the mail with tokens. However, if the field is blank then instead of not showing, the token itself shows in the email. Is there any way to prevent this from happening, or include all the fields in one token?


texts:
Using Drupal 8, I need to create several content types. They'll be used in a multilingual site, so I installed the Configuration Translation module from the core to translate the field labels. I can succesfully do that, but I need to create a feature (using Features module from the core) to export the content types and import them easily in the production site.

The problem is that the Features module doesn't export the configuration translation, even including the languages in the feature.

Is there any way to export the content types with their configuration translation and import them seamlessly into another site?

Exporting the entire site with the Configuration Synchronization seems to do the trick, but is more difficult to import because requires a clone site, and I only want the content types.


texts: Drush Aliases into Remote Hosts not Working - Tried everything

texts:
I've been struggling with a drush-related issue for awhile now and have more 'evidence' to write about. So here's what's going on: I'm trying to drush INTO two different servers (one on bluehost, another on rochen) and I get the same errors when I use my local drush on my computer to drush into either server. The error is Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

I get this error trying to drush @rochen status OR drush @bluehost status (the @name being the name of my alias files rochen.aliases.drushrc.php and bluehost.aliases.drushrc.php respectively.

I have installed drush on both servers already and can do drush commands on both using putty terminal.

I can drush just fine into Pantheon and any local sites I setup. I can also SSH into both rochen and bluehost just fine using Putty (I'm on Windows).

If I use drush --root=/home/username/public_html --uri=websiteurl status
it returns results...which is weird because I thought that command was supposed to be the same as doing drush @alias status which gives the error.

So I think maybe I have something wrong with my alias. See my alias file (I've confirmed the root is OK with my sysadmin):

<?php
$aliases['bluehost'] = array(
    'root' => '/home/username/public_html',
    'uri' => 'http://url.com',
    'remote-host' => 'url.com',
    'remote-user' => 'username',
);

// the following line is something I've tried to add in hopes it would help but it doesnt
//$options['ssh-options'] = '-o PasswordAuthentication=no -i C:/keys/ppkfile.ppk';

SOLUTION:

I fixed the permission denied error, the stdin: not a tty error, AND the bash: drush: command not found errors all in one fell swoop. See here: http://learningwithsage.com/wp/?p=236.


texts: How should I structure a node migration that has three locations?

texts: I have a situation where I need to migrate a D6 node that has three location fields.  The example code shown in the drupal module documentation (  https://drupal.org/node/2018113  ) isn't working.  I either get no addresses or four copies of the node.


texts: Using a custom field as a sub-field in another custom field

texts:
I posted a while back and have now successfully implemented a custom field (this was an extension of the DateRange field type to add control over presentation etc...)

I have a few other use cases where I could do with having a modified daterange field as a sub-field in another custom field type, now I know I could implement in the same way in each new custom field type, however, it would be much simpler if I could just drop in my custom daterange field. If this is not possible, is it best just to make my custom daterange the base type and extend this for each field type I need to create? Or is there another solution (I don't want to use paragraphs as I can't get the degree of customisation I want)


texts: Any way to create a permissions-like sea of checkboxes?

texts:
Basically I am looking for something like this (square brackets are checkboxes):

  A  B  C  D  E
1 [] [] [] [] []
2 [] [] [] [] []
3 [] [] [] [] []


texts: Create a new page of particular content type and make it home page during drupal installation

texts: I am building a installation profile. I want to create a page of particular content type and make it as front page during drupal installation. How do i do this?


texts: Views multi-value 'smart' separator "comma" or "and"

texts:
So I have a multi-value field which I want to separate with commas, but have the last value separated by " and ".

So for example, multi value field values

  Array("Apple", "Orange", "Banana")

I wish to output this as:

  Apple, Orange and Banana

But using the "simple separator" won't do this. I also tried 2 views hooks hook_views_pre_render and hook_views_post_render but can't figure out how to achieve this. Do I need to render the whole view again into $output? If so how do I go about doing this? Or does anyone have a simpler solution? A contrib module maybe?

Thanks.


texts: How to make the Webform submit button use an uploaded submit-image?

texts:
I am building a D7 website and I want the following feature for the site admin, regarding the Webform module:

When the admin creates a webform, the admin uploads a submit-image and this image is used as the submit button for the webform. so if he uploads a "click-me.png" I want the path to this image to be used in the input[type=image] class="form-submit" src="/path to uploaded image"

Is there a simple way to achieve this, or do I have to seperately hardcode the behaviour I want for each webform?

P.S. By default webform's submit button is of type "text" and not "image", but I easily managed to change this using this excellent solution.


texts: Drupal's attach behaviours : react on all newly loaded content?

texts:
I've got two different modules which in many ways work together. One of the things they work together on is that module A loads content via AJAX, and module B needs to attach event listeners to the content loaded.

However, it appears that when content is loaded via AJAX by module A, only the 'attach' function of Drupal.behaviours.a gets invoked, and not the 'attach' function of Drupal.behaviours.b. Both functions gets invoked on page load, but not on subsequent AJAX content loading.

// This runs every time module A loads new content.
Drupal.behaviors.a = {
  attach: function(context, settings) {
    alert('a:attach');
  }
}

// This only runs on page load, but never when module A loads new content.
Drupal.behaviors.b = {
  attach: function(context, settings) {
    alert('b:attach');
  }
}

How do i make the 'attach' function of Drupal.behaviours.b run every time any module loads new content?


texts:
I need to output the form id of a webform entity.
I load a chunk of enabled webforms directly from the database by using

\Drupal::entityTypeManager()->getStorage('webform')->loadMultiple();

Afterwards I have to output the form_id's of the webform entities.

How to achieve this? I cannot see any "form_id" stored in the returned entity object.

UPDATE:

I can use the following script to receive a static version of the form id:

$target_form_id = str_replace('email_confirm_redirect_2_', '', $entity->getSubmissionForm()['#form_id']);

Still not really professional


texts: Can Joyride Jquery Button take us to another page?

texts:
Stop #1

We will see this on first stop(Ask saheel what to be written   here).     Any valid HTML will work inside of Joyride.

Update Events

We will see is some random things about Upcoming Events Here too.

Final Closing

If it works fine, we have Achieved Level 3

Recent Article

**
We will see whether this page would take us there.Go to Desired Page
**

I have written this code but what I want is, jquery Joyride should take the user to another page when the last pop up has appeared and user clicks on it's button where an automatically triggered action would run. So far I am unable to do that. Is it even possible?
PS: ****** would be replaced by the desired page address.


texts:
How can i reorder fields in "node/add/"?

the current order:

title
vocabularies
body
...

i would like to have

    title
    body
    vocabularies

...


texts: how to remove module-created links from menus?

texts:
I've ended up with two basic pages in the navigation menu and there seems no way to get them off.

The pages are just plain ol' pages; the pages are not created by a module. I am using the Drupal 7 core Book Module. One of the pages in question is a book; the other is a child page of the book. The book has other child pages which are not listed in the navigation menu. The Book navigation menu works fine.

admin/structure/menu/manage/navigation has no "Delete" Links by the pages.
editing the page, there is no "add page to menu" specified. I've even tried turning that on, creating a menu item, then turning it off again. The pages still list in Navigation.
I've tried drush cc all

I have the option to disable these pages, but clearly that's just wrong. Can anyone help?


texts: Feature automatically reverts on cache clear

texts:
I have an issue with Features which contains a view.  If I update the feature and then clear the Drupal cache, the view will revert to the configuration in the updated feature.

My understanding was that a feature would not be reverted unless it is specifically made to (e.g. manually revert the feature).  Is this a wrong assumption?

Here is more information of what I have tried.  On server A, I modify a view which is contained in a feature.  I then update the feature so that it contains the modification to the view.  I then commit the updated feature to git.

Now, I log into the other server, and pull in the changes from git (e.g. bring in the updated feature).  If I go to the feature's admin page I can now see that it is overridden (so far so good).

I then clear the drupal cache (e.g. via performance page or drush cc all).  If I now check the feature status, it is set to default and the view has also been modified.

Why would the feature and the view change on cache clear if I haven't specifically reverted the feature?

UPDATE:
It seems the issue only occurs if the status of the feature on Server B was 'default' prior to deploying the updated feature. See following scenarios:

SCENARIO 1:
Feature on Server B is in 'default' state.  Updated feature from Server A is deployed to Server B.  The features admin page shows on Server B now shows the feature to be "Overridden" (expected given we have deployed updated feature).

If I now clear cache, the feature's status has now changed to 'default' and examination of the relevant view shows that the changes in the updated feature have been applied.

SCENARIO 2:

Feature on Server B is already in 'Overridden' state, due to a local change I made to the view.  The updated feature from Server A is deployed to Server B.  The features admin page shows feature on Server B to be "Overridden" (expected given we made local changes to relevant view).

If I now clear cache, the feature is still shown as "Overridden" and the relevant view has not been altered.

As you can see in SCENARIO 1 the updated feature is automatically reverted on cache clear, but in SCENARIO 2 it is not.


texts:
I feel like I'm misunderstanding something at a fundamental level when trying to author my drupal site. Two content types, both created by me, are available - faq and page. The faq type is a basic question + answer type, and will be pulled into an FAQ list block which I created. The page type is for a generic authored page, and has a body property of type entity_reference_revision which allows content to be authored using Bootstrap Paragraphs.

Some sources online say that you just have to check the "Promote to front page" box to get a node to be the front page. Others say that you have to provide a URL path for the node. I've tried both, and neither causes the site's front page to display the authored page I've created.

Instead, on the front page, I see a list of the items that have been promoted to the front page.

How can I get my authored node to replace the content of front page, so that if I navigate to the root route (/), I see the authored page?


texts: how to create a user programmatically using comment_presave hook?

texts:
I am using this code.

function MY_MODULE_comment_presave($comment) {
  $name = 'test';
  $email = 'test@test.com';
  $password = user_password(8);
  $fields = array(
    'name' => $name,
    'mail' => $email,
    'pass' => $password,
    'status' => 1,
    'init' => '',
    'roles' => array(
      DRUPAL_AUTHENTICATED_RID => 'anonymous user',
    ),
  );
  $account = user_save('', $fields);
}

I get the following error.

  PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name': INSERT INTO {users}

How do I solve this error?


texts: User login using a token or ID (no password)

texts:
How I am able to create a form/link to let assigned/special users to log-in to the system without entering their username and password?

I want them to be able to use a link/token to login to system instead.

This is mainly for development purpose and I am aware of the security risks on the live website

Thank you in advanced


texts:
I need a list of main menu item links to display on a page (sort of a sitemap).
How would I accomplish this in Drupal 7?


texts:
I want to provide a block where user can convert the currencies as desired and get the latest conversion rate.

I'm using Currency module. But there is no any set up guide for it, so I'm unable to use it. Can somebody tell me how to set it up?

If it is not possible in this module, is there any other module?


texts: Replacement pattern for one value of a multivalue field in views

texts:
Rewriting the results of a views field, I wonder if there is a way to use a replacement pattern for the first, second and third value of a multivalue field.

In my case, as example:

I have tried to use this rewritten tags field:
   [field_tagging:0]
   [field_tagging:1]
   [field_tagging:2]

However, this is not rewritten/recognized as replacement patterns.

The result I need, is that in the views field has three tag links, which have a rewritten path (in this case it also uses !1 for the contextual value in the URL)


texts: Make wysiwyg editor automatically go to the next line when it reaches the edge

texts:
I have a problem with he wysiwyg editor.  When I enter a text and it reaches the end of the form, it doesn't automatically add a line break like what StactExchange does, but it goes on and on.

How can make this:

To appear this way?


texts:
<div class="fr_search">
  <form action="/"  accept-charset="UTF-8" method="post" id="search-theme-form">
    <input  name="search_theme_form" id="edit-search-theme-form-1" size="15" value="" class="form-text" />
    <!-- … -->
  </form>
 </div>

The above code is generated by the Drupal Search module. I want to add this code to the form.

<select class="search_l" onchange="selectSearch(select)">
  <option value="0">whole site search</option>
  <option value="1">google search</option>
</select>

How do I do this?


texts:
I am using Drupal 8 and I am creating an internship placement system where students sign up and have a skills field (using taxonomy terms).

Employers can create job postings, which have same skills field.

How do I link matching fields (skills) in a view so that when a student logs in they only see jobs related to their skills?


texts: How do I add a Confirm Order button in Commerce Checkout?

texts:
Using Commerce Kickstart 2

With the default checkout, the payment is taken on the Review page. Then the next page (Payment) processes with the merchant (in our case Authorize.Net).

Then there is a Confirmation Page... and the only pane on that page is Express Checkout Review and confirm' (does that refer to Paypal?).

I guess I'm expecting to a see a 'Confirm Your Order' button of some kind, but it never appears. Basically, the order is processed and goes immediately to 'Completed'.

How do I get that Confirmation page to appear?

Customers will expect to see a Confirm Order page -after- they have entered their payment... rather than going -immediately- to 'Completed'.


texts: Per-item commerce shipping rules working but charging for same item twice

texts:
I've read similar looking posts, but nothing addresses my particular problem.

I have 2 shipping rates and rules setup and no longer confusing each other (thanks to rfay's excellent vimeo tutorials and the discussion here: https://drupal.org/node/1415638)

One is for domestic and I'm trying to add a 50 cent per item shipping charge to a $3 base.

The other is international and I want it to add a $3 per item shipping charge to an $11 base.

I have things basically setup like rfay documents in https://drupal.org/node/1415638

And it's sort of working. The problem is it appears to be double-counting one of the items - I'm probably saying this wrong.

e.g., 4 domestic items should be base ($3) + 3*50 cents = $4.50, but it is currently computing $5.00

My international rule is behaving in the same way. How do I avoid this double-dipping?


texts:
We are facing really big issue with the cron. Our site is running on 2 ec2 instances under the load balancer. We have lot of cron tasks which are performed every day. But the problem comes when the cron run, during this time all instances start processing the cron jobs, and site will not be accessible for the users. Here all the instances are sharing the same db including the staging instances(another 2 instances). I don't understand that, why all instance's CPU utilization is going high when cron run(all 4 instances).

Because of this behavior, what we are planning now is, to move the cron to a separate server, there it will perform all the jobs. But I'm not sure how I can achieve this.

How can I move the cron job to a separate server?


texts: Displaying sub content (entity references) of node based only with specific taxonomy

texts:
I have been working on a solution that would allow training courses to be created using Drupal 8 as the backbone. I have elected not to use the "Courses" module and am simply using custom content types.
At this point I have the following:
Course Content Type -> which contains entity references (1 or more) to Slide Content Types -> which contain Entity references (1 or more) -> to Text or Media content (these are also custom content types). I chose not to use Paragraphs for a few reasons.
Right now I just have "Text" and "Media" content types, but plan on creating additional content types that can be added to a slide -> which in turn is added to the course.
The Text/Media both include a "Taxonomy" term that can be selected.
My goal is to be able to view a course and filter the content (the text/media) based on whether they contain a specific Taxonomy term.
I am considering how to do this using custom views, but cant figure out how to reference the Taxonomy term of the entity referenced content rather than the course object itself.
The end goal would be to have a single course object that may have some content with the Taxonomy term: student and other content with the taxonomy term instructor (some may have both taxonomies selected). I would then be able to view the same course and see some content if I view it as the instructor and different content if it is viewed as a student.


texts: How do I use the Commerce Fulfilment module drag and drop?

texts:
I have created orders and I'm using the Flat Rate Shipping module. Everything is working except the Fulfillment module. When I select the Fulfillment TAB I get an error:

  EntityMetadataWrapperException: Unknown data property
  commerce_product. in EntityStructureWrapper->getPropertyInfo() (line
  335 of...

I wonder what I'm doing wrong?
Anybody get this module to work? I'd love to hear about a success and maybe get some help. Thanks


texts: How to display a table view and an add/edit form on the same page?

texts:
I'm trying to build a page in my site where users can create a new project (fill out a few text boxes to give the project a title/description), see a list of all of their projects, and edit any of those projects.

I've created a new content type called "Projects" that includes all the text fields needed for creating a new project. And I've figured out how to use Views to display a list of user projects. I've tried to display these 2 elements together using Panels, but that means I need to create a new Variant for both the Node View and the Node Edit pages, which feels clumsy in terms of development. And the end result on the web site is 3 slightly different pages (one to create a new project, one when you click on a particular project to view it, one when you edit the project). But ideally, it would feel like one slick page.

Am I taking the right approach with using Panels, or is there another module or approach that is better?


texts: How to automatically install civicrm extensions in drupal+civicrm installation profile?

texts:
We are building a Drupal distribution / installation profile similar to CiviCRM Starter Kit. This will install Drupal 7 and CiviCRM 4.3 while installing the distribution.

We want to add some CiviCRM Extensions like "Extended Reports for CiviCRM" etc. in our distribution so that whenever user will install the distribution, these CiviCRM Extensions also gets installed by default.

We have added these CiviCRM Extensions in drupal-org.make file like below,

libraries[nz.co.fuzion.extendedreport][download][type] = get
libraries[nz.co.fuzion.extendedreport][download][url] = "https://github.com/eileenmcnaughton/nz.co.fuzion.extendedreport/archive/master.zip"
libraries[nz.co.fuzion.extendedreport][destination] = "extensions"

and these get downloaded/unzipped when we run drupal packaging script (drush make). But we are not sure how to enable them as part of the distribution installation.

We know we can add the Drupal modules in profile.info file like below,

dependencies[] = civicrm

but don't know how and where to add CiviCRM Extensions so that they get installed as part of distribution / installation profile setup.

Please suggest how can we install CiviCRM Extensions automatically as part of installation profile setup.


texts: Is there a way to disable user_node_load on non-admin pages without hacking core modules? My theme doesn't use user data so this function results in needless database queries.


texts: Set a page to be only viewed by users who are logged in

texts: I have created a page that I would like to be visible only for logged in users and admin.


texts:
I want to extend the simple text the Webform module allows for radio buttons to include HTML markup.

The Drupal Options Markup module purports to add markup to the text for radio buttons. It does, but it also seems to be very buggy and causes missing index errors in the Webform module.

Hand coding seems to be a better option. Digging into hook_form_alter, I can see where the array is built.

Here is the question: How do add markup to the plain text of the #options array. From the forms api reference, the t function is used. Can I insert HTML into that?

   '#title' => t('Selected'),
   '#options' => array(
      0 => t('No'),
     1 => t('Yes'),

The result I want can be seen in the Illustration from webform options markup.


texts: How to prevent access to a page but allow query

texts:
I have a page defined by Views module.
(for example: http://namedomainnn.com/cvstaff)

However, I want user only allow to access using query command)
(for example: http://namedomainnn.com/cvstaff?name=user1)

How can I prevent any users to access without query.


texts: How to add error message to commerce checkout form element?

texts:
I created a simple module to add additional validations to the commerce checkout module checkout form but I don't know how to add an error message to the storage array so it can behave like any error message from the commerce checkout module.

Can you help me with this ?


texts: How do I create shortcodes for displaying nodes according to tags?

texts:
I want to create a shortcode, which is a specific code that lets you do nifty things with very little effort. Shortcodes can embed files or create objects that would normally require lots of complicated, ugly code in just one line.

I would create it for displaying the nodes on the basis of tag. The final shortcode will look like [article tag=sports]. WordPress provides the shortcode API but there is not any option for Drupal 7.


texts: How to use node data in content type as hierarchical select

texts:
I have a content type having the following fields

Project Type (Node Reference - Select List)
Project Name (textfield)
Manager (user reference - manager role) - Select List
Employee (user reference - employee role) - Checkboxes

Created two nodes as following

node-1(see Image)

Project Name - Project-1

Manager Name - Manager-1

Employee   -  Emp-2, Emp-3

node-2

Project Name - Project-2

Manager Name - Manager-3

Employee    - Emp-1

I need to use these fields data in another content type like follows

All Project names to be listed in select list(like node reference). If I choose Project-1 , the relative Manager Name (Manager-1) and Employees(Emp-2, Emp-3) should be loaded automatically(like hierarchical/chain select).

Is there contributed module available for this or I need to create a custom module for this?


texts:
I currently have a project where I am inserting mulitple records into Drupal using node_save. Its usually a couple of hundred at a time. For some reason, sometimes the node_access table ends up empty, resulting in the data "appearing" deleted to the users.

Does anyone know what could possible be happening?

I have reviewed the node_save code and notice is does run a call to rebuild the node_access table via node_access_acquire_grants($node). Currently I have no modules implementing node_access hooks.

My one thought was to just call node_access_rebuild() once I've finished inserting. I also run the process a few times every hour.

Side Note: Drupal may not be the right system for the bulk inserts and volume, but that is not the discussion I wish to have on this question.


texts:
I want to read a simple csv file having 6 rows and 2 columns :

   **name   |  value**
    AJW097  |   1
    BDV763  |   1
    PVWC67  |   1
    WPC028  |   1
    TGI0227 |   1
    W5615C  |   1

I had saved this file here sites/default/files/csvfile.csv

here is the code i am using:

function my_module_form($form, &$form_state) {
$form = array();
  $form['browser'] = array(
    '#type' => 'fieldset',
    '#title' => t('Browser Upload'),
    '#collapsible' => TRUE,
    '#description' => t("Upload a CSV file."),
  );
  $file_size = t('Maximum file size: !size MB.', array('!size' => file_upload_max_size()));
  $form['browser']['upload_file'] = array(
    '#type' => 'file',
    '#title' => t('CSV File'),
    '#size' => 40,
    '#description' => t('Select the CSV file to be upload. ') . $file_size,
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Upload CSV File'),
  );

  $form['#attributes']['enctype'] = "multipart/form-data";
  return $form;
}

function my_module_form_submit($form, &$form_state) {
  $filepath = $form_state['values']['upload_file']->filepath;
  $fp = fopen($filepath,'r') or die("can't open file");

print "
\n";

while($csv_line = fgetcsv($fp,1024)) {
    print '
';
    for ($i = 0, $j = count($csv_line); $i < $j; $i++) {
        print ''.$csv_line[$i].'	';
    }
    print "
\n";
}
print '
';
fclose($fp) or die("can't close file");
}

The problem is it is not reading the file and every time i click on Upload CSV File button it dies and say: can't open file.
where i am doing wrong?