texts: Drupal 7: Looking for suggestions on AJAX-base update to view

texts:
I have a requirement that I'm not sure how to go about implementing. The flow goes something like this:

User clicks button: share your update
Popup window opens
User fills in form and clicks Save
View is updated immediately to reflect update

I'm thinking I'll need a new content type for updates since the view being updated is for node content, not comments.

Anyway, I think I'll need to AJAX-load the node/add form, then somehow trigger the view to update upon saving the node. Perhaps it will work by using the Overlay module? (Note: I would only want the Overlay to be used in this one specific case.)

Anyone done this that can provide some pointers and/or some links?

Thanks,

Dan


texts: I have a module file which fetch data from a link. I have to run this module as a cron everyday. How can I do it?


texts: Accidentally changed the path of an RSS feed page in Views to refer to a menu link item and cannot access Views menu anymore

texts:
I cannot access views from the Structure Menu in Drupal 8 anymore. I accidentally changed the path of an RSS feed page in Views to refer to a menu link item and cannot access the Views menu anymore.

How does one fix this? I get an error that says "The website encountered an unexpected error. Please try again later when trying to access View Menu."

The report log says the following:

"InvalidArgumentException: The internal path component 'http://localhost/drupal/News-Press' is external. You are not allowed to specify an external URL together with internal:/. in Drupal\Core\Url::fromInternalUri() (line 409 of C:\xampp\htdocs\drupal\core\lib\Drupal\Core\Url.php)."


texts: How do I remove the term ID from the view URL?

texts:
I have a content view with an exposed filter based on a vocabulary.

In the URL (for example, mysite/myview?tid=taxonomy+term+(3)), and incidentally in my page title (I use argument.tid to display a title based on the term typed in the exposed filter), there are the name of the term (perfect) but also the term ID.

I only need mysite/myview?tid=taxonomy+term or, better, mysite/taxonomy-term.

How can I achieve this?


texts: Create an e-mail reminder depending on a date field in a custom content type

texts:
I have created a custom content in which there is a date field and an e-mail field I would like to add an automatic email reminder that is triggered on that date and sent to the email specified in the custom field.

What is the correct procedure to do so?


texts: Why would my import of multiple selections work in one content type but not the other?

texts:
I've got two content types that both have one off CSV file imports. They both have fields where you can select multiple values. The csv is comma delimited and the multiple selection data, for the field in question, is separated from the rest of the data by quotation marks, within the quotation marks there are no spaces between values; each value is instead comma separated.

For one of the content types this works perfectly, multiple values are put into the field. This field is a node reference.

However for the other content type this doesn't work instead if there are multiple values in the csv no values are given to the content, there are no error messages in any logs. This field is a multi check-box/radio input. I've checked and double checked to make sure the are no spelling discrepancies and I've ensured the field is set up correctly. If you manually create a new node of this content type you can allocate multiple values within this field.

Both fields are set to take unlimited values.


texts: How do you disable modules in bulk via Drush matching a specific pattern?

texts: Currently I have to disable all of the ubercart modules in bulk, but there are too many of them to do it one at a time via the modules page. And doing it via drush doesn't disable every module related to ubercart sometimes. Is there a quick way to disable these modules via Drush in bulk matching a specific pattern?


texts:
Trying to send HTML mail from Webform using Mimemail

I've copied mimemail-messages.html.twig to my theme's folder and it's properly picked up. Problem is it's applied to all outgoing emails, user registrations and contact forms which is not desired.

Is it possible to isolate the outgoing theme to a single webform ?

I've read https://www.drupal.org/docs/8/theming/twig/working-with-twig-templates and tried re-naming mimemail-messages.html.twig to achieve some greater isolation when applying the theme.

Tried renaming the template to mimemail-messages--webform--myform.html.twig where myform is the form ID picked up from webform/manage/access_list/settings to no success


texts: Twig Tokens in Views not Rendering Inside an HTML Element

texts:
I'm using views to create a custom block of shortcut icons and need the images to link to the corresponding content. Using Rewrite Results I can overwrite the output of the view and have an anchor tag wrap around the image, however when I inspecting the output on the site, the href is blank making the images useless as links. Everything else renders though.

The view uses two fields, all from the same content type (shortcut). It consists of an image and a URL field. The image field is called first and then hidden to get the tokens, and the URL field holds the actual rewrite text. All of the these Twig tokens are listed as available within the Replacement Patterns dialog box.

{{ field_image }}

{{ field_url }}

Does Twig Debug affect the output for content like this? Is there another format I should be using? I tried calling and hiding via CSS the {{field_url}} first, before the rest of the rewrite text to see if it had to do with render inheritance but it still didn't change the blank href output.

Any insight on why the Twig token won't render inside HTML would be GREATLY appreciated. Thank you.


texts: How to access a field value in hook_preprocess_eck_entity

texts:
How can I access a field value in hook_preprocess_entity(&$vars)?

I am able to do the following, but it does not seem like the best approach. What is a better approach?

function mymodule_preprocess_eck_entity(&$vars) {
  $myvalue = $vars['content']['field_myfield'][0]['#context']['value'];
}


texts:
I see that Drupal now automatically adds the 'X-Frame-Options: SAMEORIGIN' header. However, the client would like to give explicit permission to allow a iframe embed to another site.

How do I allow iframe embeds to a particular domain?


texts: Loop through all posted articles and print specific section

texts:
I am trying to create my first Drupal 8 theme. On the frontpage, I want to list all articles with the title, summary, date posted, etc.

I more or less achieved this using views. Basically {{ page.content }} in twig, but found it to be really inflexible and I didn't really get the results that I wanted. What I want to do is just to iterate through all the articles and print each section of that article "manually". For instance:

{% for page in pages %}
  {{ page.content.title }}
  {{ page.content.datePosted }}
  {{ page.content.body }}
{% endfor %}

So that I can have more control of what is happening and not making a lot of configuration in the views module when deploying. What is the best soltuion to achieve this? Thanks!


texts: How to output Taxonomy Tabs in Views (without URL only #hashtag)?

texts:
i want to output a Bootstrap Tab and the Tabs are my Taxonomy Terms of "Meal Category".

I had install the Module "views_bootstrap" and it work without any problems but i can't add a summary for the terms.

If i remove the filter for the terms in conditional filter option i get a tab for each content.. so i get more tabs that i want :(

So my main problem is to filter the term name to one.. and each term in my tab navigation has to output all results.. Currently i get for each content a tab and each tab in my navigation output only one content.

Anybody has a solution?


texts: drush sql-sync structure tables in alias dont work

texts:
It seems that the structure tables dont work on a sql sync from my live site to my dev. Using the following comman:

drush sql-sync @example.live @example.dev

The search_api_server is every time overritten, so it gets synced. So i think also my cache tables get synced. Whats wrong with my aliases?

/**
 * Dev/Local alias
 */
$aliases['dev'] = array(
  'root' => '/var/www/example_dev',
  'uri'  => 'example.dev',
  'path-aliases' => array(
    '%files' => 'sites/default/files',
  ),
  'source-command-specific' => array (
    'sql-sync' => array (
      'no-cache' => TRUE,
      'structure-tables-key' => 'common',
    ),
  ),
  // No need to modify the following settings
  'command-specific' => array (
    'sql-sync' => array (
      'sanitize' => TRUE,
      'no-ordered-dump' => TRUE,
      'structure-tables' => array(
       // You can add more tables which contain data to be ignored by the database dump
        'common' => array('cache', 'cache_filter', 'cache_menu', 'cache_page', 'history', 'sessions', 'watchdog','search_api_server'),
      ),
    ),
  ),
);

/**
 * Live alias
 */
$aliases['live'] = array(
  'remote-host' => '000.000.00.00',
  'remote-user' => 'username',
  'root' => '/var/www/html/example-live',
  'uri'  => 'example.net',
  'path-aliases' => array(
    '%files' => 'sites/default/files',
  ),
);


texts:
I made an update to a site for global search and replace of text across nodes and was too far-reaching. For a specific content type I need to revert my Node update of ~500 nodes.

I found this solution in the VBO issue queue:
https://www.drupal.org/node/1166630

But in evaluating this code a new revision is made by it is not set as the current revision of the node. If I visit the node revisions page and invoke node_revision_revert_confirm_submit a new current_revision is set for the node.

Code I'm trying:

/**
 * Implementation of hook_action_info().
 */
/**
 * Implements hook_action_info().
 */
function revert_last_revision_action_info() {
  $action = array(
    'REVERT_LAST_REVISION' => array(
      'label'        => t('Revert to Last Revision'),
      'type'         => 'node',
      'configurable' => FALSE,
      'triggers'     => array('any'),
    ),
  );
  return $action;
}

/**
 * Action function for REVERT_LAST_REVISION.
 */
function REVERT_LAST_REVISION(&$entity, $context = array()) {
  $node = $entity;
  $revision_list = node_revision_list($node);
  unset($revision_list[$node->vid]);
  if (count($revision_list) > 0) {
    $last_revision = max(array_keys($revision_list));
    $node_last_revision = node_load($node->nid, $last_revision);
    $node_last_revision->revision = TRUE;
    $node_last_revision->log = "Reverted via bulk operation action."; // Log message
    dpm($node_last_revision, __FUNCTION__);
    node_save($node_last_revision);
  }
}

Using devel the $node arrays look the same so I'm confused as to why my revert revision code snippet is not making the new revision the current_revision. The only thing node_revision_revert_confirm_submit is doing is setting $node->revision = TRUE and calling node_save().

Anyone have any ideas?

EDIT: 11/16/2015

As others have mentioned perhaps this has to do with how VBO is initiating the action.

I've also tried the below code but the Node isn't saved.

/**
 * Implements hook_action_info().
 */
function revert_last_revision_action_info() {
  $action = array(
    'REVERT_LAST_REVISION' => array(
      'label'        => t('Revert to Last Revision'),
      'type'         => 'node',
      'configurable' => FALSE,
      'triggers'     => array('any'),
      'behavior'     => array('changes_property'),
      'vbo_configurable' => FALSE,
      'pass rows'        => TRUE,
    ),
  );
  return $action;
}

/**
 * Action function for REVERT_LAST_REVISION.
 */
function REVERT_LAST_REVISION(&$entity, $context = array()) {
  $revision_list = node_revision_list($entity);
  unset($revision_list[$entity->vid]);
  if (count($revision_list) > 0) {
    $last_revision = max(array_keys($revision_list));
    $entity = node_load($entity->nid, $last_revision, TRUE);
    $entity->revision = TRUE;
    $entity->log = "Reverted via bulk operation action.";
  }
}


texts: Disable emails turned into links but keep urls turned into links

texts:
Some users on social sites still enter their email addresses on comment fields.
I'm trying to prevent spammers from harvesting them by replacing the @ character with a graphic. That's really easy to do using the smiley module.

However, I use the text filter option "Convert URLs into links" which turns the email into a mailto link. The smiley filter now breaks the HTML.

I would like to not turn emails into links but keep turning urls into links.
How could I do that?


texts: How to let a user switch between blocks that need to be shown?

texts:
I have pre-defined blocks A,B and C that are meant to be placed in the sidebar_first region. What I would like to achieve is: a visitor could select the block that needs to be displayed for the sidebar_first region when click on a dropdown button containing option A, B and C. This dropdown button should exist somewhere on the same page of these blocks (means the visitor will not do it in the admin pages).
For example, if Option A is selected by default, then only Block A should be shown. If the visitor clicks on Option B, then Block A will be hidden (or removed) and Block B will show up.
The way I could think of is to disable and enable blocks programmatically on clicking the dropdown button, and then refresh the region via ajax, but I have no clue how this can be acheived. I am also open to other approaches.


texts: How to handle config changes on core update?

texts:
I have an 8.6.15 site managed by composer and drush. The db and config exports are in sync.

Roling our new features using drush cim on production works fine.

I now update core to 8.7 by running copmoser update and drush updb successfully, and everything seems to be working as expected.

The update process causes configuration differences between the db and the exported config files

My question:
What is the proper way of handling these config changes?

1) drush updb -> drush cex (seems logical to me)

2) drush updb -> drush cim -> drush cex

The two strategies result in slightly different end configurations.


texts:
I had created menu link using hook_menu

  $items['admin/config/xyz'] = array(
    'title' => 'xyz Webservice Settings',
    'description' => 'Configures the xyz Settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('xyz_services_admin_settings'),
    'access callback' => 'user_access',
    'access arguments' => array('administer xyz configuration'),
  );

I've added this link to the main menu and I am rendering main menu block in the sidebar.

Now, The user goes to home page and that user doesn't have access to the above link but still, he can see the link in the sidebar, Why?

I debugged a little bit and found that drupal is taking parent path 'admin/config' and the user have access to this link maybe that's why he can see the link but why he is taking the parent link??


texts:
I have a data structure where content type research has an entity reference field scientists.
The content type scientists does not have any research reference entity field though.
I can get all scientists that a particular research has through research.
But is there a way to get all researches one particular scientist has? When content types were created I wasn't involved, so I'm trying to see my options whether I can somehow click a checkbox to make this applicable.
When I tried to set up a field with type of entity reference and pointed it to research for scientists, they were empty.
Any help is highly appreciated.


texts: Is this the correct way to make a panels layout

texts:
I have a 'working' panels layout that is getting the job done, but I'm unsure if it's the right way to do it.

Basically I copied the twocol_stacked layout from Panels and fitted it to my needs. The layout I'm looking for is this:

------------
|          |
|----------|
|  |       |
|  |       |
|  |-------|
|  |       |
|  |       |
------------

What shows up when in the panels lay out looks like this:

------------
|          |
|----------|
|  |       |
|  |       |
|----------|
|      |
|      |
--------

My css isn't too strong and I don't know if there is a way to make it display correctly in the panels layout window.  When I put some long text in the left side, it does push the lower div to the right the way I want, it just feels incomplete/wrong.

The css is mostly copied out of the twocol_stacked.css file with a few changes:

.panel-2col-stacked {
  /*  overflow: hidden;  */
  margin-top: 0;
  padding-top: 0;
}

.panel-2col-stacked .panel-col-top {
  width: 99.9%;
  clear: both;
}

.panel-2col-stacked .panel-col-top .inside {
  margin-bottom: .5em;
}

.panel-2col-stacked .panel-col-first {
  float: left;
  width: 33%;
}
* html .panel-2col-stacked .panel-col-first {
  width: 32.9%;
}

.panel-2col-stacked .panel-col-first .inside {
  margin: 0 .5em 1em 0;
}

.panel-2col-stacked .panel-col-last,
.panel-2col-stacked .panel-col-bottom{
  float: left;
  width: 66.9%;
}

.panel-2col-stacked .panel-col-last .inside {
  margin: 0 0 1em .5em;
}

.panel-2col-stacked .panel-separator {
  margin: 0 0 1em 0;
}


texts:
I am writing a custom module, I am trying to use the validateExtensions() method defined from the Drupal core File module inside the FileItem.php file, in my own controller, using the following code.

use Drupal\file\Plugin\Field\FieldType\FileItem;

//Some other Use statement

class someclass extends FormBase {
  $instance = new FileItem();
  //Some Code
  '#element_validate' => array(array(get_class($instance), 'validateExtensions')),

It gives the following error:

  Recoverable fatal error: Argument 1 passed to Drupal\Core\Field\FieldItemBase::__construct() must be an instance of Drupal\Core\TypedData\DataDefinitionInterface, none given


texts: What is the pattern '' referred to in Drupal speak?

texts: Is the pattern  used to denote the front page in Drupal referred to as token or something else? Does it exist in Drupal 8?


texts: Is there any native way to implement AJAX form submission without a button?

texts:
I need to implement a form that automatically saves data on each element change. So I can add a button with ajax callback and trigger mousedown on this button on "change" event using jQuery.
And naturally I should hide this button. So this works ok, but it seems to be some ugly solution.

Is there any native Drupal way to make ajax form submission on each element change without a hidden button?


texts: How to add an argument to a view programmatically?

texts:
I want to add an argument to a view. I want to set this argument programmatically (not by url).

The field i want to filter is not directly in the view query, because this is a field on a node reference, so I cannot use hook_views_query_alter.

How can i can add programmatically an argument to a view?
I mean, which hook is better to do it?


texts:
How can I implement a date pager (e.g. as a contextual filter) in Drupal 8 on a custom entity field?

It seems to me, that the date_views functionality didn't make it into the core yet, and I can't activate the module date api module (8.x-1.x-dev) or date_views module individually (and I don't really know why that is so).


texts: When using the same theme on multisites, what would be the easiest sollution to give each domain another link color?


texts: Webform file upload not working after hook_from_alter

texts:
I have used the following form alter to do some adjustments to my form but after the file upload stops working. I cant seem to find out why. This is the module code.

Any help would be much appreciated.

if ($form_id == 'webform_client_form_3'){
    //image btn
    $form['actions']['submit']['#type'] = 'image_button';
    $form['actions']['submit']['#src'] = drupal_get_path('theme', 'MY_THEME').'/images/submit2.png';
    $form['actions']['submit']['#attributes']['name'][] = 'op';

    //palceholders
    $form['submitted']['forename']['#attributes']['placeholder'] = t('Forename');
    $form['submitted']['surname']['#attributes']['placeholder'] = t('Surname');
    $form['submitted']['post_code']['#attributes']['placeholder'] = t('Post Code');

}


texts: How to retrieve view row attributes when in twig template

texts:
I am using addClass() in hook_preprocess_views_view_unformatted (see my question regarding this at here), and the class is added to each row, but the next stop for the view results is views_view.html.twig, where dumping the rows data with
{{ dd(rows) }}

shows no sign of the attributes part of the row data, which contains the class.


texts: Custom (cck) fields are being ignored during the migration using migration-tools 4.x. Only title and body is imported. How do I fix this?

texts:
I'm running a migration from Drupal 6 to Drupal 8, following roughly the advices in the http://pnijjar.freeshell.org/2017/drupal8-migrate/ guide.

At the moment, only title and body for each node is being imported for each node, despite definitions being correctly put into the .yml files generated by drush migrate-upgrade --configure-only . See an example migrate_plus.migration.d6_node_event.yml below.

I can't figure out what is wrong.

uuid: 51bc9a5e-6caf-4b7a-9b08-e34312467c89
langcode: en
status: true
dependencies: {  }
id: d6_node_event
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags:
  - 'Drupal 6'
migration_group: migrate_drupal_6
label: 'Nodes (event)'
source:
  plugin: d6_node
  node_type: event
process:
  nid: tnid
  vid: vid
  langcode:
    plugin: default_value
    source: language
    default_value: und
  title: title
  uid: node_uid
  status: status
  created: created
  changed: changed
  promote: promote
  sticky: sticky
  body/format:
    plugin: migration_lookup
    migration: d6_filter_format
    source: format
  body/value: body
  body/summary: teaser
  revision_uid: revision_uid
  revision_log: log
  revision_timestamp: timestamp
  field_organization:
    plugin: iterator
    source: field_organization
    process:
      value: value
      format:
        -
          plugin: static_map
          bypass: true
          source: format
          map:
            - null
        -
          plugin: skip_on_empty
          method: process
        -
          plugin: migration
          migration:
            - d6_filter_format
            - d7_filter_format
          source: format
  field_startend:
    plugin: iterator
    source: field_startend
    process:
      value:
        plugin: format_date
        from_format: U
        to_format: U
        source: value
  field_event_venue:
    plugin: iterator
    source: field_event_venue
    process:
      value: value
      format:
        -
          plugin: static_map
          bypass: true
          source: format
          map:
            - null
        -
          plugin: skip_on_empty
          method: process
        -
          plugin: migration
          migration:
            - d6_filter_format
            - d7_filter_format
          source: format
  field_event_speakers:
    plugin: iterator
    source: field_event_speakers
    process:
      value: value
      format:
        -
          plugin: static_map
          bypass: true
          source: format
          map:
            - null
        -
          plugin: skip_on_empty
          method: process
        -
          plugin: migration
          migration:
            - d6_filter_format
            - d7_filter_format
          source: format

...


texts: Is it possible to add or somehow relate a checkfiled to taxonomies?

texts: I am trying to make something with the commerce module and I need to create options for my product and I was thinking making this via a taxonomy, but the options must be clickable (checkboxes) so ... is it possible to change taxonomies to checkboxes? if so, then how?


texts: Prevent view to urlencode contextual filters

texts:
I have 2 views.

View 1 is a small exposed form which collects some data and has some contextual filters.

View 1 is linked to View 2, so when the form is submitted the form redirects to View 2 and inserts the collected data as contextual filters in the url.

The fields in the url are in the form of module[module_field] but they are printed as module%5Bmodule_field%5D in the addressbar in the browser when View 1 redirects to View 2.

But opening manually the same page with the decoded version module[module_field] works.
How can I prevent View 1 to urlencode the parameters for the contextual filters?


texts: Can I remove the "Item successfully added to your cart" popup?

texts: Can I removed the Item successfully added to your cart popup in Drupal Commerce?


texts:
Using Drupal 8, I want to rename and clean all filenames, e.g. If someone uploads file named like this Screen Shot 2016-03-29 at 1.13.21 PM.jpg, I want to clean it so that convert all spaces to dashes - and make everything lowercase, So I should get screen-shot-2016-03-29-at-1.13.21-pm.jpg.

I want to do this on image upload dialog form of CKEditor.


texts: What do array keys in the database definition array mean?

texts:
I have following code in my settings.php file:

$databases['default']['default2'] = array(
  'driver'    => 'mysql',
  'database'  => 'rotary',
  'username'  => 'root',
  'password'  => 'root',
  'host'      => 'localhost',
  'prefix'    => '',
);

$databases['rotary2']['default1'] = array(
  'driver'    => 'mysql',
  'database'  => 'rotary2',
  'username'  => 'root',
  'password'  => 'root',
  'host'      => 'localhost',
  'prefix'    => '',
);

I know that the first keys i.e. default & rotary2 are the database names.

What are the keys default2 & default3 for?


texts: {Date_Repeat} Every day of the week doesn't work

texts:
This question is in regards with Date module (date_repeat)

I am setting the frequency date to "every" "weeks" until a certain time with the following advanced setting:

Day of the week: Every Saturday

but the result doesn't respect my advanced setting and it will repeat the date every "seven days" regardless the length of the month

How do I fix this?

I am using Node Repeat for this purpose.


texts: Is there any way to use SQL Views in Drupal Views

texts:
I have some very tricky reports to develop (with multiple subqueries) and it occurred to me that the Data module would be perfect: I can create my complex queries as SQL Views (I know how to do this), then adopt them with Data and use them as ordinary tables in Views. Perfect!

Except that although you can adopt a SQL View, it won't show up in Drupal Views (apparently because no primary key) and of course you can't add a primary key to a SQL View.

Is there any way round this by using a module to replace the View SQL query? I have searched a lot on the web and cannot get around the problem without coding object PHP which to be honest I find intimidating.


texts: How can I auto tweet any node of a specific type to Twitter?

texts: I know the Twitter module lets you setup automatic tweets of new content to your twitter account, but I am wondering how/if its possible to schedule automatic tweets of old content as well.


texts:
I have module where I'm creating a custom path in hook_menu. When the user visits this page, they are supposed to be redirected to another site, with GET query parameters attached to the redirect URL. So for instance, if they visit http://mysite.com/site-search?query=blah, we are supposed to redirect them to http://othersite.com/different-path?query=blah.

However, we have clean URLs enabled; while I can hit the page http://mysite.com/site-search, it gives a page not found when I try to hit http://mysite.com/site-search?query=blah.

  The requested page "/site-search?query=blah" could not be found.

I tried adding another path for site-search/%, just to get that extra part of the URL, but that didn't work either.

Am I able to get the URL parameters while using clean URLs?

Edit: Here's the code:

function my_redirect_menu() {
  $items['site_search'] = array(
    'page callback' => 'my_redirect_redirect',
    'access callback' => TRUE,
  );

  // testing to see if this will allow me to capture get parameters
  // in the form http://site.com/site_search/q=blah
  $items['site_search/%'] = array(
    'page callback' => 'my_redirect_redirect',
    'access callback' => TRUE,
  );

  return $items;
}

function my_redirect_redirect() {
  // see if we can get the get paramters
  return "<pre>" . print_r($_SERVER,1) . "</pre>";
}

Edit 2 In my example, I transcribed the query string in correctly. It looks like it's a conflict between drupal wanting to use ?q= for its menu routing, and our search host URLs also using ?q= for their queries. If I do query=blah, I am able to hit the page.


texts: use EntityFieldQuery to find user based on custom user profile field value

texts:
I have a profile field profile_full_name (title "full name") which I would like to use for searching users. Unfortunately below code throws an error. I've also tried

EntityFieldQueryException: Unknown field: profile_full_name in EntityFieldQuery->addFieldCondition()

    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'user')
      ->propertyCondition('status', 1)
      ->fieldCondition('profile_full_name', 'value', '%' . $name . '%', 'like')
      ->addMetaData('account', user_load(1)); // Run the query as user 1.
    $result = $query->execute();


texts: Filtering Content based on URL arguments from Calendar Module

texts:
I have a page for the Calendar module on my site. Below the calendar, I have a table view that displays links based on taxonomy terms that correspond to the year-month format of the calendar module URL arguments (which change when the user changes the calendar month). I'm new to Drupal and can't figure out how to filter these results based on whether or not the content term matches the URL arg from calendar. Do I use contextual filters? Thanks for the help.

edit: I should mention I am using Drupal 7.


texts: how to migrate multiple taxonomy terms with entity lookup plugin

texts:
Im using the code below to migrate a taxonomy term with multiple values and I get this error below.  is there a way to migrate multiple taxonomy terms with this plugin? :

InvalidArgumentException: Placeholders must have a trailing [] if they
are to be expanded with an array of values. in              [error]
/var/www/html/docroot/core/lib/Drupal/Core/Database/Connection.php:744

field_states_operating_in:
    - plugin: entity_lookup
      source: field_states_operating_in
      entity_type: taxonomy_term
      value_key: name
      bundle_key: vid
      bundle: states_operating


texts: Setting Panels category for blocks and other pre-existing Content Types?

texts:
When one adds new content to a Panel, they are given a list of categories, each with various Content Types.

Setting the aforementioned category of a Content Type is easy if you're writing your own plugin...

$plugin = array(
  'title' => t('My Plugin'),
  'category' => t('YOUR CATEGORY HERE'),
);

But what about setting that category for Content Types created by other modules?

I ask because I've created a Menu Block and am wanting to put it in a specific category, where all my other custom CTools Panels Content Type plugins reside.

Any thoughts? I'm using D7, by the way. Thanks!


texts: How can I automatically position a block in Drupal 7 (via a script, Drush, etc.)?

texts:
I have a bash script that I use to rebuild my dev environment by re-importing my MySQL database and activating/deactivating modules, etc.

Recently, I've realised that I often need the Switch user block provided by the Devel module.

So, ideally, in my script, I'd like to automatically enable the module in the left sidebar.

This question on how to place a block with Drush looked promising but it suggests using Drush Extras, which according to the README does not work for Drupal 7.

How can I automatically set the position of the Switch user block from the command line?


texts: How to pass an extra argument to an entity form?

texts:
Suppose, I've two entities:

entityA
entityB

A user creates an entityA and has the option of creating multiple types of entityB referenced from a single entityA. For example, a parent-child relationship. Parent being entityA and child being entityB.

In the module, I want the users to select an entityA object, go to a new page page for creating entityB. So, at this point, (add-form of entityB) I should have the data of that particular entityA object that the user clicked on.

So, far I'm able to get "all" the data of entityA on the add-form of entityB, which is of no help as I'm unable to get the specific id of entityA.

The relevant code are:

routing.yml

mymodule.entityB_add:
  path: '/admin/config/mymodule/{entityA}/entityB/add'
  defaults:
    _entity_form: 'mymodule_entityA_entityB.default'
    _title: 'EntityB'
  requirements:
    _entity_create_access: 'mymodule_entityA'

When, I'm shown the form addition page of entityB (type: ../../testentitya/entityA/add), how do I pass the entityA object to the form and what will be the structure of entityB's config schema?


texts: Is it necessary to have a separate voting tag for each rating when using Fivestar?

texts:
By design I will have a ratings page with many things to rate - 30 different Fivestar ratings altogether in the same content type.

Is it necessary to have a separate voting tag for each of these 30 ratings? Because I see there is a character limit on the field in Fivestar tags configuration and I can't input all my voting tags.


texts: Is it possible to run a View from code in a cron hook?

texts:
I'm writing a queued cron process, and need to retrieve some information while doing this. Rather than fiddling around with DB queries, it seemed to me much easier to create a View and then execute it in the code. Which I did (and by the way, the View itself works fine and returns the expected result). Trouble is, although it seems to run fine, it returns no result.

I've tried two different ways of doing this, but both are the same: the result is empty.

First was very simple:

if (!isset($node->og_group_ref)) {
  $regions = views_get_view_result('og_regions');
  }

That left $regions empty, so I tried this, with no better result:

if (!isset($node->og_group_ref)) {
  $view = views_get_view('og_regions');
  $view->execute();
  $regions = $view->result;
  }


texts: I can't add to cart without HTTPS enabled

texts:
I have a quite weird situation here, I assume this problem must be a server side issue, but so far I couldn't figure it out how to fix this.

I have a Nginx server with Varnish (I even disabled it totally still got the error) running a Drupal Commerce website on it, the quite funny issue here is the "Add to Cart" button doesn't work on a session without HTTPS, if I add HTTPS in front of my URL, I can add the product to my cart!

I'd really appreciate any help!


texts: How can I add a field in Entityform / hook_form_alter

texts:
I'm trying to add a field to the form in hook_form_alter. What's the proper way of adding fields in this hook in case of entityform?

I tried to add it this way:

$form['leadname'] = array(
    '#type' => 'hidden',
    '#value' => 'abc'
);

but I have the impression that this is not the way it should be done...


texts:
What to do if you don't want to load JS files on mobile devices? Let's say, the navigation of a website uses javascript (dropdown for example), and that Javascript is loaded within the .info file

Example of the .info file of an Omega Subtheme

scripts[0] = 'js/navigation.js'
scripts[1] = 'js/hoverintent.js'
scripts[2] = 'js/jquery.fancybox.pack.js'

Let's say, I don't want to load scripts[0] on mobile. What would be the easiest solution for this?


texts: How can I add a real name field beside username to user information?

texts:
I want to add a real name field beside the default username when I creat a new user in admin/people/create. How can I do this?

I have checked the RealName module but is not doing what I need.


texts: How to pass dynamic file location in Form API?

texts:
my requirement is to upload files to specific folders. How can I achieve this by using form api. How can I modify below code such that upload_location should be dynamic. Uploaded file should save into the Folder name provided by the user. I tried below code but not worked.

#submit element is not calling custom_document_submit function.

 $form['folder_name'] = array(
      '#type' => 'textfield',
      '#title' => t('Folder Name'),
  );
  $form['document'] = array(
    '#type' => 'managed_file',
    '#upload_validators' => array('file_validate_extensions' => array('xml')),
    '#upload_location' => 'public://',
    '#submit' => array('custom_document_submit'),
    );
function custom_document_submit($form, &$form_state){
  $destination = $form_state['values']['folder_name'];
  $validators = array();
  $file = file_save_upload('document', $validators, 'public://'.$destination);
}


texts:
I have a site that can respond to URNs.  For example, I need to be able to serve up a response to

http://example.com/urn:myscheme:foo:bar:12345

So, I need a router item that can match against the "urn" or "urn:myscheme" portion, and get "foo:bar:12345" as the argument (either exploded or not).

Can hook_menu() be configured this way?

I have tried

$item['urn'] = array(...);
$item['urn:'] = array(...);

without any luck.  I can do this with a hook_url_inbound_alter() trick, but am curious whether it can be done directly.  For the purposes of this question, I can't use path aliases.


texts: Detect the taxonomy term(s) of a node from within a template file

texts:
I have a Drupal 7 site with a content type of event.

I have a taxonomy called "event types" that has 5 options (Party, Conference, Meeting, etc)

I have one template named node--event.tpl.php for styling the standalone event nodes.

How can I detect which taxonomy terms apply to a given event node from within the template file? I need to change some of the presentation logic based on the taxonomy term associated with the event.

I am not using the taxonomy in the URL, so I need to find another method for detecting the event type. Devel doesn't seem to show me any values of taxonomy terms to work with.


texts: How to make a private file visible after changing file URI?

texts:
My task is automatically convert image files to pdf, when they are attached to a certain field. So the field accepts both the images and pdf files, but converts uploaded images to pdf.
The field saves files to private directory.
If I do not apply the conversion, the files are accessible well. But when I apply conversion, I convert images to PDF then save the PDF file into the same directory with the same name but with .pdf extension using the following code in hook_entity_presave:

$file_field = $entity->get('field_invoice_file');
if ($file_field) {

  $file_value = $file_field->getValue();

  if ($file_value && !empty($file_value[0]['target_id'])) {
    $entity_manager = \Drupal::entityTypeManager();
    $file_entity = $entity_manager->getStorage('file')->load($file_value[0]['target_id']);

    if ($file_entity) {

      $filename = reset_m($file_entity->get('filename')->getValue()); //reset_m is my custom function that extracts string from an array of any deepness, do not focus on it
      $uri = reset_m($file_entity->get('uri')->getValue());

      $type = pathinfo($uri, PATHINFO_EXTENSION);

      if (in_array($type, ['png', 'jpg', 'jpeg', 'gif'])) {

        $file_dir_arr = array_reverse(explode('/', $uri));
        unset($file_dir_arr[0]);
        $file_dir = implode('/', array_reverse($file_dir_arr));

        $file_name_arr = array_reverse(explode('.', $filename));
        unset($file_name_arr[0]);
        $file_name_no_ext = implode('.', array_reverse($file_name_arr));

        $new_uri = $file_dir . '/' . $file_name_no_ext . '.pdf';
        $new_filename = $file_name_no_ext . '.pdf';

        mymodule_image_to_pdf($uri,
            $file_dir . '/' . $file_name_no_ext . '.pdf');

        $file_entity->set('filename', $new_filename);
        $file_entity->set('uri', $new_uri);

        $file_entity->save();
      }
    }

  }
}

I made sure that the pdf has been generated successfuly and can be opened in acrobat if downloaded and can be viewed in browser if it is in a public directory. So here is some permissions issue: http://mysite/system/files/myfile.pdf returns dark gray page with a little gray square with white borders in the middle of the page.
If I upload pdf without conversion, it works good, if I upload an image without conversion, it also works good. If I use the same conversion behavior but with files in public storage it also works good.
Please note that I do not get 403 or 404 error (I checked in browser console too), I get 200 response but it looks as I wrote above.


texts: How can I make a read only field  form with node authors' mail address on node edit page?

texts:
I would like to make a read only field form on a node edit page prepopulated with the e-mail address of the node author.
I tried Markup module but couldn't get it done.
Is there anyway to do this?


texts:
I'm reading a lot, searching, asking questions. Measuring thrice before cutting once.

Now it seems to be a straight choice between a pre-built Drupal Commons and roll-your-own based on core-Drupal plus some modules.
I absolutely require a wiki, which doesn’t seem to be in the standard distro, no easily addable as a single module.

I won’t mention standard stuff like forums, but will say that I want a “social networking site” for ex-pat foreign workers in another country.

It would be nice to have some form of Goups of fiends & colleagues and to provide sharing permissions at that level of granularity (e.g, world read, group right/ group read only, etc); joint calendars,  access to blogs, maybe chat rooms or even one form per Group; maybe a photo album, although I suppose they can just refer to their Flikr.

Maybe profiles with some extra stuff like IM, phone #, etc,  where the user can control who gets to read it.

(Plus anything more that you can suggest for such a community, of course)

It looks to me like I would be best to start with Drupal Commons – do you agree?

The only thing is that when I go to download it, it says
6.x-2.0 tar.gz (17.4 MB) 2011-Aug-26 Version 2.0 is a major upgrade
Which seems to imply that it is based on Drupal 6, not Drupal 7. Is that correct? Is it a show-stopper for me? Or can I just install it and upgrade everything?

Sorry if I don’t sound too knowledgeable; I am still not a Drupal user, just a dabbler on my local PC.

Thanks in advance for any help.


texts: How to allow users unsubscribe without logging in by changing the value of a custom field?

texts:
I have a Drupal 7 site with a checkbox (Boolean field) that users check on registration to receive promotional emails.

However, Gmail started blocking some of my emails because they want every email to have a link that users can click to unsubscribe without logging in.

The first idea that came to mind is to link to a webform and then process the unsubscriptions manually, which doesn't sound like any fun.


texts: Wanting to add a drop down menu to reg form

texts:
I want to add a drop down list to the user registration form for users to pick a category for their page to be under when signing up.

I also want it so people can click on a menu and it will take them to a page view that their catagory is under.... for example, clicking on "food" brings up a view with all pages related to food..

Is this done with the taxonomy? Or can I just set up a view to fetch the related shops from the database?

Any ideas?


texts:
Has anyone got the angularjs bootstrap-ui "typeahead" widget to play nice with drupal autocomplete?

seems like a match made in heaven

I will try this in the next week or so - but just checking if anyone has a working example before I set out on the journey.


texts: "render ($user_profile)" in user-profile.tpl.php = no output

texts:
Following the discussion in http://api.drupal.org/api/drupal/modules--user--user-profile.tpl.php/7 I created a user-profile.tpl.php file in my theme directory, but the code

<div class="profile"<?php print $attributes; ?>>
  <?php print render($user_profile); print ("you are here"); ?>
</div>

prints the "you are here" but not the $user_profile array. Any suggestions as to what I might be doing wrong?


texts:
I am struggling with displaying a view in a node. I have installed EVA module and have created a view of products categorized for that node (Restaurant Type).

The entity displays in the node but I'm having trouble contextualizing the view. How do I dynamically provide the context when the page containing the entity is viewed.

I am normally a PHP programmer and a newbie recently thrown into the Drupal framework. I have been able to print out the criteria (in php template) and display the entity but I am failing in making them play together.

I presume that the "Criteria" I am able to pry out of the template is the long way round solution to my issue, how do I configure my "entity view attachment" to display a contextualized list. my file structure always contains the variable and resolves as "*.com/restaurants/steak_houses" where "restaurants" is the node and "steak_houses" is the context criteria.

I need help in feeding that data to the entity.


texts: Is it generally safe to add same Drupal javascript multiple times?

texts:
I am trying to load content via AJAX calls which may include Javascript and its settings.  This works more or less, but I cannot make sure whether a certain javascript code has been inserted and executed before.  Now I need to find out, whether in case of problems resulting from a modules javascript code being executed multiple times, I would need to fix the modules javascript or whether I would have to take other precautions.

My question: Given Drupal's coding standards for Javascript added by modules, should it be unproblematic to execute it multiple times?  I am aware of some modules where the javascript part is badly coded and problems will result, I just want to know whether this is allowed by some Drupal javascript standards (if any exist)


texts: How do I edit serialized values in "config" and "key_value" tables?

texts:
While trying to switch original language of a Commerce product type I've encountered longblob serialized data in config and key_value database tables.
Is there a quick way to edit them, possibly without writing a lot of PHP code?


texts: Node reference to show only author of node

texts:
I have create two content types as Game and Video. For the Video content type, I have created a node reference field that will be referring to the Game type.

Suppose I have 2 users (e.g. user1, and user2) on my site. User1 has created the following nodes:

Game1 (content type: Game)
Game2
Game3

User 2 has created the following nodes:

Game4
Game5

Suppose User1 is going to create one Video node. On the node reference selected list, I just want to see Game1, Game2, and Game3, but it is displaying all Games.

How can I solve it?


texts: Programmatically set the default value for a field

texts:
In Drupal 6, we could use PHP to set default values, but the same code cannot be used with Drupal 7.

I am trying to do this through hook_form_alter(), but the code doesn't work.

function my_form_alter(&$form, &$form_state, $form_id) {
  dsm($form);

  switch($form_id) {
    case 'accounts_node_form':
      $form["field_accounts"]["und"]['#default_value'] = $default;
      // …
      break;
  }
}


texts: Should modules be in source code management?

texts:
I am new to Drupal and I am using Drupal 7.61.

Should the Drupal modules folder be git ignored or included in the source code management for best practices and continuous integration sake?


texts: How to get the media title and url to the media entity

texts:
I have a media file field field_file where the data is saved like:

title: Media Entity 01
file: media_entity_01.pdf

Using twig, is it possible to output the title of the file and the path?

When rendering the full entity using the 'Render Entity' display mode, I can only get the display to output something like this:

media_entity_01.pdf
using twig like this:
{{ content.field_file }}

when i want it to output like this:

Media Entity 01
using something like this:
{{content.field_file.GET_THE_TITLE}}

Is this possible?

Cheers


texts: Attaching a view to a content type that takes the content type's taxonomy terms as arguments

texts:
What I am trying to do is create a content type with a taxonomy vocabulary field. When creating the content type and selecting one or more of the terms, I would like the content type with an attached view to render the node with a list of nodes (ex: teaser views) that share share the content type's selected taxonomy terms.

In the past I have used Insert Views and listed the taxonomy terms. I would like a more elegant solution so a user can just use a selection list or term radio buttons.

How would I go about attaching a view and passing the taxonomy terms of the content type to the "attached" view?

Thoughts?

Thanks.

Rich


texts: How to show blocks by url, when nodes have multiple paths?

texts:
I know that having multiple path aliases to a single node is discouraged, but it is a situation I have to deal with.

My node is accessible via /news/node-1, /baseball/news/node-1 and /basketball/news/node-1. It's the same node, just three different aliases.

I have a 3 menu blocks, only 1 of which should be shown at any given time. I've configured the Page restrictions on the blocks so that they are restricted to certain url path patterns.

The "baseball" menu is restricted to baseball/*, the "basketball" menu is restricted to basketball/* and the 3rd menu is everything else, so I've set it to show on all pages except for baseball/* and basketball/*.

However, my problem is that when I'm browsing to baseball/news/node-1, the 3rd "everything else" menu is the one being shown. My -guess- is that Drupal is looking behind the scenes and seeing that the node is also considered to be /news/node-1 and therefore the path being used to choose my menu block is choosing the 3rd "everything else" menu.

a) Is there a way to see what path Drupal is using when determining which blocks to show based on path?

b) Is there a hook I could implement so that I can directly control which block to show on each request?

c) Any other ideas how I can make sure the correct block is shown?


texts: Delete all nodes where the taxonomy term matches a given value

texts:
I have a content type (example_content_type) with 3 3 fields: title, body, and pks_type. pks_type is a taxonomy term select list field. and 'pks_type'has 2 terms:

Type1, tid = 1
Type2, tid = 2

I have 150 nodes using those taxonomy terms. Now I need to delete all nodes from 'example_content_type' except last 5 nodes, where the taxonomy term ID is 1.

How can I achieve this with db_delete()?


texts: Warning to user for including cursing words in private message

texts:
Drupal 7.
Drupal 6 had a way to configure a rule to check for disallowed words inside the body or subject line of a private message.

I am trying to adapt that rule to Drupal 7.
The purpose of this check is to send a warning message to the sender (email or private message) if banned words are found in his message. This can be expanded to various actions, including a temporary ban then a permanent ban if the user persists.

Here is an export of the first rule (but I can't get it to work:)

{ "rules_warning_to_privatemsg_sender_about_curse_words_" : {
    "LABEL" : "Warning to privatemsg sender about curse words.",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_i18n", "privatemsg_rules" ],
    "ON" : { "privatemsg_insert" : [] },
    "IF" : [
      { "text_matches" : {
          "text" : [ "privatemsg-message:body" ],
          "match" : "word1|word2|word3",
          "operation" : "regex"
        }
      }
    ],
    "DO" : [ { "drupal_message" : { "message" : "Bad word!", "type" : "warning" } } ]
  }
}

Word1, word2, and word3 are the words to check for. They are separated by the "|" (pipe or vertical bar) character.

This format was agreeable with Drupal 6 but I am not sure if that still works with Drual 7.

UPDATE: After studying the Regex website, I was able to get the rule to work changing the expression. See my answer below.


texts: How to retrieve node body from nid with an SQL query in Drupal 7?

texts:
From this question I learned that I have to look in field_data_body to retrieve the body of a node from a database.

field_data_body does not have an nid field though.

What query can I use to retrieve the body from an nid?

To clarify: I simply wanted to quickly fetch a text from a database dump without installing the dump on an actual site. So not looking for PHP here.


texts: Error when get rest resource : The controller result claims to be providing relevant cache metadata

texts:
I try to create a REST resource. I used EntityResource as base. I would like to return my fields in html.
Here is a exemple of my code :

public function get($id) {
    if (!$this->currentUser->hasPermission('access content')) {
      throw new AccessDeniedHttpException();
    }

    $entity = \Drupal::entityTypeManager()->getStorage('node')->load($id);
    $entity_access = $entity->access('view', NULL, TRUE);
    if (!$entity_access->isAllowed()) {
      throw new AccessDeniedHttpException($entity_access->getReason() ? : $this->generateFallbackAccessDeniedMessage($entity, 'view'));
    }

    $result = array();
    $other_entity_dependency = array();
    if ($entity instanceof FieldableEntityInterface) {
      $fields = array();
      $contentType = $entity->bundle();
      if (isset($contentType) && !empty($contentType)) {
        foreach (\Drupal::entityManager()->getFieldDefinitions('node', $contentType) as $field_name => $field_definition) {
          if (!empty($field_definition->getTargetBundle())) {
            $fields[] = $field_name;
          }
        }
      }
      foreach ($fields as $field_name) {
        $field = $entity->$field_name;
        $field_access = $field->access('view', NULL, TRUE);
        if ($field_access->isAllowed()) {
           $value = \Drupal::service('renderer')->render($field->view())
           $result[$field_name]['value'] = $value;
            $result[$field_name]['label'] = $field->getFieldDefinition()->getLabel();

        }
      }
    }

    $response = new ResourceResponse($result, Response::HTTP_OK);
    $response->addCacheableDependency($entity);
    $response->addCacheableDependency($entity_access);

      return $response;
  }

The problem is that when I use a render function, I have this error :

  The controller result claims to be providing relevant cache metadata,
  but leaked metadata was detected. Please ensure you are not rendering
  content too early. Returned object class:
  Drupal\rest\ResourceResponse.

I haven't this issue when I use $field->value instead of \Drupal::service('renderer')->render($field->view()), but I would like to have the html render of fields, for file or image too (these types of fields are empty when I use $field->value).

How can I solve this problem ?


texts:
How can I theme all the menu levels individually in menu.html.twig?

I need to give different markup to the 2nd (child) and 3rd (grandchild) level, and in the twig I only have parent and child.

  {% if item.below %}
    {{ menus.menu_links(item.below, attributes.removeClass('nav'), menu_level + 1) }}
  {% endif %}

Whatever I put in this is duplicated for the child and grandchildren.

I thought that menu_level + 2 might get it. What does menu_level + do?

EDIT:
Thanks to Hudri's tip below I did the following Thanks Hudri!

  {% if menu_level == 0 and item.is_expanded %}
    <li{{ item.attributes.addClass(item_classes) }}>
    <a href="{{ item.url }}" class="dropdown-toggle nav__title" data-target="" data-toggle="dropdown">{{ item.title }} </a>
  {% elseif menu_level == 1 %}
    <li{{ item.attributes.addClass(item_classes) }}>
    {{
      link(
        item.title,
        item.url,
        item.attributes.removeClass(item_classes),
        item.attributes.setAttribute('title', '')
      )
    }}
  {% elseif menu_level == 2 %}
    <li{{ item.attributes.addClass(item_classes) }}>
    {{
      link(
        item.title,
        item.url,
        item.attributes
      )
    }}


texts: How do I enable pagination on a taxonomy term page

texts:
I have a taxonomy term page displaying node teasers. I would like to know how I can enable pagination on it?

Thanks


texts: Need to add HTML characters to Select list

texts:
I have a form using the FAPI that has a select list of currency values as one of its inputs.
I need to be able to add HTML characters such as &euro; $pound; &yen;

The problem is that Drupal is filtering the input and not displaying the desired symbols, but displaying the actual html codes as displayed above.

Is there any way of having Drupal not filter my list?


texts: Node export import into different node numbers

texts:
I use node export to export my nodes from Drupal 6 and import into my new site Drupal 7.

The nodes number is not same with nodes in Drupal 6.

How do I set it same as nodes number in Drupal 6.


texts: Why is it considered improper to directly add an `onclick` attribute to an HTML element?

texts: From a Drupal perspective, why is it considered improper to directly add an onclick attribute to an HTML element instead of using a Javascript behavior?


texts: How to make the "Height" of Views Slideshow Fully responsive?

texts:
I'm working on a slideshow on Drupal 7 with Views Slideshow. The only issue I have right now is to make the Frame "Height"(not the image) responsive when resizing the browser. I found many articles, questions and answers about how to make Views Slideshow responsive, but none of them work properly. I believe the "Frame" is causing this.

These articles I found does not really fix the height of Views Slideshow. Maybe I missing something.
- Make views slideshow responsive - remove inline styles
- Can't remove the height/width of the slide container

----- updated for @Patrick Ryan

I got some error from google chrome web browser after adding these js

----- updated on Aug. 20, 2014 @ 9:46am
I found the following script also fix the height. Its from drupal.org issue views Slideshow for Responsive design on #26

$(window).resize(function(){
  $('.views_slideshow_cycle_main').each(function(){
    var cycleMain = $(this);
    var img_width = 0,
        img_height = 0;
    var clearCSS = {width: "auto", height: "auto"};
    var cycle = cycleMain.children('.views-slideshow-cycle-main-frame');
    cycleElements = cycle.data("cycle.opts");
    cycle.css(clearCSS);
    cycleMain.find('.views-slideshow-cycle-main-frame-row').each(function(i){
      $(this).css(clearCSS);
      var tmp_img_width = $(this).width();
      var tmp_img_height = $(this).height();
      if(tmp_img_width > img_width)
        img_width = tmp_img_width;
      if(tmp_img_height > img_height)
        img_height = tmp_img_height;
      cycleElements.elements[i].cycleW = tmp_img_width;
      cycleElements.elements[i].cycleH = tmp_img_height;
      $(this).css({width: tmp_img_width, height: tmp_img_height});
    });
    cycleMain.height(img_height);
    cycle.css({width: img_width, height: img_height});
    cycle.data("cycle.opts.elements", cycleElements);
  });
});


texts: Drupal 7 Migration - redirect old dynamic urls to new domain name

texts:
I just cloned a drupal 7 site to another domain name. Now i want to only redirect some of the URLS from the old site to the new site. Problem is that I have many (300+) dynamically generated URLs via views. Most likely I will have to do this via .htaccess modrewrites doing a 301 redirect. Basically I want to do is this:

Site #1:

abc.com/products/shoe

abc.com/products/shoe/blue

abc.com/products/shirt/neon

Site #2:

xyz.com/products/shoe

xyz.com/products/shoe/blue

xyz.com/products/shirt/neon

-- Where would I create this modrewrite in the .htaccess file? on the bottom or do I have to edit anything else? also would it affect anything else?


texts: TWIG for loop returning first value only

texts:
I have an array of 5 objects. I would like to loop throught the 5 objects and display fields from within.

I have a for loop in place that is returning the appropriate fields, but it is displaying the same object 5 times.

{% for key, object in featured_resource_nodes %}

  {% if node.field_featured_resources[0].entity.field_resource_type.value == 'whitepaper' %}

  {% elseif node.field_featured_resources[0].entity.field_resource_type.value == 'Datasheet' %}

  {% elseif node.field_featured_resources[0].entity.field_resource_type.value == 'blog' %}

  {% elseif node.field_featured_resources[0].entity.field_resource_type.value == 'video' %}

  {% elseif node.field_featured_resources[0].entity.field_resource_type.value == 'analystreport' %}

  {% endif %}

  {% if node.field_featured_resources[0].entity.field_resource_type.value == 'video' %}

{{ node.field_featured_resources.entity.title.value }}

  {% else %}

{{ node.field_featured_resources.entity.title.value }}

  {% endif %}

{% endfor %}

But this is what is being returned

How do I loop through the objects and have it display the 5 individual results?


texts: The following module is missing from the file system: (Theme name)

texts:
In D7, I'm getting many of these warnings:

User warning: The following module is missing from the file system: bootstrap_barrio.
For information about how to fix this, see the documentation page.
   in _drupal_trigger_error_with_delayed_logging()
      (line 1143 of /home/xxxxx/www/www/includes/bootstrap.inc).

User warning: The following module is missing from the file system: XXXXX.
For information about how to fix this, see the documentation page.
   in _drupal_trigger_error_with_delayed_logging()
      (line 1143 of /home/xxxxx/www/www/includes/bootstrap.inc).

The problem is that those 'modules':

Are actually themes in the site.
They are being used and the files are there (under /sites/all/themes/)

I've installed the Missing Module module and it didn't detect those themes as missing.

Why is Drupal confusing modules with themes and how can I remove those messages?


texts: Unable to override Superfish styles in Zen theme

texts:
I am using a zen subtheme and a superfish menu. I am trying to override the background colours of the menu but am not having luck in IE8. I've tried clearing the cache but still no luck.

Do you have any idea why? Why isn't IE8 recognising the pages.css style sheet?

This style sheet is being picked up by IE8.

superfish/style/default.css

.sf-menu.sf-style-default li,
.sf-menu.sf-style-default.sf-navbar {
  background: red;
}

.sf-menu.sf-style-default li li {
  background: pink;
}

.sf-menu.sf-style-default li:hover,
.sf-menu.sf-style-default li.sfHover,
.sf-menu.sf-style-default a:focus,
.sf-menu.sf-style-default a:hover,
.sf-menu.sf-style-default a:active {
  background: green;
  outline: 0;
}

While this style sheet is being picked up by FireFox (this is what I want).

mytheme/css/pages.css

.sf-menu.sf-style-default li,
.sf-menu.sf-style-default.sf-navbar {
  background: orange;
}

.sf-menu.sf-style-default li li {
  background: yellow;
}

.sf-menu.sf-style-default li:hover,
.sf-menu.sf-style-default li.sfHover,
.sf-menu.sf-style-default a:focus,
.sf-menu.sf-style-default a:hover,
.sf-menu.sf-style-default a:active {
  background: grey;
  outline: 0;
}


texts: How to fix my Rules Actions to copy data from geofield to geofield?

texts:
I want to copy a geofield to another geofield in the same content type.

I created a Rule where I "Set Data Value" and with that I copy the data of one geofield into the other. Actually I created two actions one for longitude and latitude.
This action is triggered when "After updating existing content".
I used VBO to parse through my nodes therefore the trigger to be fired and geofield data to be copied.

Nothing happens. I get two errors in error log saying:

Unable to evaluate action data_set.
Unable to modify data "node:field-business-location...

I tried to expose the fields to rules by "Entity has field" condition but doesn't work either.
What am I doing wrong.
PS: There is also an option of "Create Geofield values from Lat/Lon but I don't see how I can copy data from one Geofield to another Geofield like this.
My Rule Export

{ "rules_copy_geolocation_data" : {
"LABEL" : "Copy geolocation data - Destinations",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_update--destination" : { "bundle" : "destination" } },
"IF" : [
  { "entity_is_of_bundle" : {
      "entity" : [ "node" ],
      "type" : "node",
      "bundle" : { "value" : { "destination" : "destination" } }
    }
  },
  { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_destination_location" } },
  { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_business_location" } }
],
"DO" : [
  { "data_set" : {
      "data" : [ "node:field-business-location:lat" ],
      "value" : [ "node:field-destination-location:lat" ]
    }
  },
  { "data_set" : {
      "data" : [ "node:field-business-location:lon" ],
      "value" : [ "node:field-destination-location:lon" ]
    }
  }
]   } }


texts:
How to set sort alphabetically in this view

I badly I asked the question above. I did not write that I want to sort alphabetically by the "slownik". The first in the table. This field is a term taxonomy.


texts: simplenews sent newsletter to all user not subscribing categroies with taxonomy

texts:
I used a simplenews module to send user news, in user registeration I add field in user registeration refer to a A vocab ( list of some favorites)(as a name field_favourites) and user can select his favorite(s) from favorites category in registeration,

In Also in admin/structure/types/manage/simplenews/fields add that field again (field_favourites field that refer to favorites Vocab) .

The problem is when I create simplenews , and select one or some categories ,module email for all user not user that subscribe only for selected category(s),Where is the problem?

anybody know how can I achieve this job ? sending news only and only for user that subscribed for that category in user registeration ?


texts:
We have had an issue with an expanding menu on a drupal 8 website that stops working when the command

drush cache-rebuild

is used.

MORE INFO ON ERROR:

When triggered, the error causes menus set to expand some sub-menu portion when active to stop expanding. That is to say the menu stops expanding at all, just stays in the inactive state.

The menus where this occurred were generated with the core menu module.

Logging into the site and using the clear all found in admin->config->performance->"clear all caches" fixes the issue.

Can anyone suggest an alternative drush/command line command we can use or how we can fix this problem?

drush clear-cache

does not seem to fix the issue.

I also tried executing as apache:

sudo -u www-data drush cache-rebuild

this also broke my menus.

What exactly is the difference between the UI cache clear and the drush one?

MORE INFO

Ok after some digging - and please correct me if I am wrong here - it seems that when Drush rebuilds all caches it invokes:

drupal_rebuild(ClassLoader $class_loader, Request $request)

which is found in utility.inc, see drush github repo, while the admin command in Drupal calls:

drupal_flush_all_caches()

found in common.inc, see drupal docs.

I have always been under the impression drush either called the same cache function as the internal performance button or at least they had the same behaviour, but they seem not to - at least in regards to my issue with the menu.

Can anyone suggest a way to have drush - or some other tool - invoke drupal_flush_all_caches()?

A further question, is the behaviour I am observing intended or should drush cache-rebuild work the same as drupal_flush_all_caches()?

MORE INFO AGAIN

Further experiments lead me to believe that it is specifically the clearing of the views cache that is causing some expanding menus to break.

drush cache-clear views

Will also trigger the behaviour. Again, clearing with the drupal_flush_all_caches() via the performance admin page fixes the issue.


texts: Geofield From another field showing only after saving from form

texts:
I am programmatically creating nodes with a Field Collection that contain a geocoded field, the field where i take the data from for the geocoding is a computed field (i have already applied this patch: https://www.drupal.org/node/1679926 ). The problem is that the map from the field appears only after i open the node and save it from the interface, the nodes i have created through node_save() in my code won't show the map until i save them again from drupal interface.
I have tried the geocoder patch in the first comment of this discussion How to programmatically iterate over nodes, load into form, and save the form? but it didn't work (the geofield patch doesn't work because it's for 7.x-1.x version), i have also tried saving them all with bulk operations but it doesn't work

Is there any way to solve this? I was thinking about saving nodes as it was done through form submission in my code but i don't know if it's possible, also i don't want to go as far as having to use selenium or something similar to do a bulk form submission


texts: Better Exposed Filters and a Node Relationship

texts:
I'm using Better Exposed Filters to enable datepickers for exposed date fields on my View. It's great, except that my view displays nodes via a taxonomy relationship. If I try to filter by node creation date, I don't get any Better Exposed Filters options. However, if I choose a date field that doesn't use a relationship (even if it doesn't exist on the term and therefore doesn't work), I get all the Better Exposed Filters options.

How can I best go about putting a popup datepicker on my exposed filter that uses a relationship?


texts: field_info_field() deprecated, what's the equivalent?

texts:
In Drupal 8 field_info_field() has been deprecated. The docs say to use this instead:

Field::fieldInfo()->getField($field_name)

I've tried various iterations of it, such as:

$foo = \Drupal\field\Field::fieldInfo()->getField('field_address');
$foo = \Field::fieldInfo()->getField('field_address');

But I keep getting an error similar to the following:

Fatal error: Class 'Drupal\field\Field' not found in /var/www/drupal/modules/custom/foo/src/Controller/FooController.php on line ##

What am I missing?

UPDATE

Thanks to Clive's answer, and especially for pointing me towards change records (which I've now subscribed to via RSS), I was able to generate various commands to get data about entity types, bundles and field "info/instances" in Drupal 8.

The data that was once available via field_info_fields() and field_info_instances(), is now available throughout the EntityManager, FieldConfig, and FieldStorageConfig:

$entity_type = 'node';
$bundle = 'course';
$field_name = 'field_address';
$foo = \Drupal::entityManager()->getFieldMap();
$foo = \Drupal::entityManager()->getAllBundleInfo();
$foo = \Drupal::entityManager()->getBundleInfo($entity_type);
$foo = \Drupal\field\Entity\FieldConfig::loadByName($entity_type, $bundle, $field_name);
$foo = \Drupal::entityManager()->getFieldDefinitions($entity_type, $bundle);
$foo = \Drupal::entityManager()->getFieldStorageDefinitions($entity_type);
$foo = \Drupal::entityManager()->getStorage('field_storage_config')->loadMultiple();
// This one doesn't seem to work for me, see my comment to Clive for a workaround.
$foo = \Drupal\field\Entity\FieldStorageConfig::loadByName($entity_type, $field_name);

Here are some other calls that may be useful:

$foo = \Drupal::entityManager()->getAllViewModes();
$foo = \Drupal::entityManager()->getViewModes($entity_type);
$foo = \Drupal::entityManager()->getAllFormModes();


texts:
I have a task. Will try to describe.
For example, there is Order discount = 25%.
I go to checkout step.
I'm able also to add coupon here.
Coupons provides 30% (for example).
The task is:
If coupons discount is greater then order discount, we should apply only coupon's discount and remove order discount.
If order discount is greater then coupon's discount, we should keep order discount and don't apply coupon.
So, the goal is to apply the biggest discount only.
How can achive it?

I have tried to do it using Rules module - no luck.

Any help appreciated


texts: Can I recreate content types via db tables only?

texts:
My D7 (7.18) got corrupted, but just about functioned. However, I couldn't update modules, core or anything, so I took as many backups as I could and did a clean install of 7.24.

I'd like to recreate the custom content types and content I had in the old system (there's a lot). Can I import specific tables into the new MySQL db (from a MySQL export) and expect Drupal to pick it up ok?  If so anyone know which tables I should bring in/merge.

Otherwise anyone got any suggestions for how to recreate content without a few weeks worth of cut+paste?

Thanks
Sparks


texts:
I have a Prezi file and the embedded code is like this:

I have installed Colorbox and activated Colorbox load and Colorbox inline in the module settings.

How can I open this file with Colorbox?

I've created a link and tried like this:

open in Colorbox (iframe)

The colorbox is opening, but it shows "This content failed to load".


texts: User registration without email address OR registration with pseudo-email address

texts:
I am programmatically creating users for the roles Parent (Adult) & Child (minor). During registration, minors (Children) typically will not have email addresses but Drupal user registration requires email address.

During registration of minor, unfortunately, the adults email address cannot be reused based on Drupal’s one email rule.

My queries are as follows:

Is it possible that we can create users without email address?
If not 1. can we use some pseudo-email address that we can created for each minor. However, emails for any minor should be sent to the adults address instead.


texts: Adding a field to a content type for Apache Solr search and Facets

texts:
I've got a content type of Journal, and another content type of Article. All of the data associated with the Journal itself is stored on that content type, and not duplicated in the Article; the Article just has an entity reference to the Journal. So, for instance, Journal has a Year field, but Article has no Year field. (Conceptually, a Journal is a collection of Articles.)

For the most part, this entity reference relationship works great (and avoids duplicate information.) However, when doing things like searching, it can have some side effects. For example, if someone searches for a keyword, gets back a list of Articles with that keyword, they're then not able to filter that down by Year using facets, since that content type doesn't technically have a year associated with it, just a reference to a different content type that does. I'm hoping to find a way around that, but I'm not sure how to get it working.

I'm still pretty confused on the relationship between the Solr server we have and the Drupal site. It was my idea that once all was indexed, the Solr server takes the search string, and just ships back nodes/entities/etc. that match. If that's wrong or right, I'm still not sure if my problem has to do with Solr or FacetAPI.

What I've done so far is below, but it seems to have no effect on the search results. (In other words, if I search for a year, the articles aren't being returned as results; I'm not even worrying about Facets yet, even though those are the ultimate goal.)

function issue_archive_apachesolr_index_document_build_node(ApacheSolrDocument $document, $node, $env_id){
  if($node->type == "article") {
    // Load the journal this article is associated with, and get it's year
    // The is_ prefix is to denote a single (instead of multi-value) integer
    $journal = node_load($node->field_journal['und'][0]['target_id']);
    $document->setField('is_article_year', intval($journal->field_year['und'][0]['value']));
  }
}

function issue_archive_apachesolr_query_prepare(DrupalSolrQueryInterface $query) {
  // Make the indexed fields available for search results
  $query->addParam('fl', 'is_article_year');
  // Filter where 'index_field_name' = 'indexed_value'
  $query->addFilter('is_article_year', 'indexed_value');
}


texts: How to use custom Javascript inside Drupal8 CKEditor

texts:
I have a Javascript for tooltips and other things which work fine in front end but I want the same Javascript to run inside CKEditor too so that the user can see what he/she will get in the front end.
I have successfully linked my custom CSS with CKEditor using function hook_ckeditor_css_alter
which completes my half target but I didn't find any hooks for attaching custom Javascript.

Please share a tip or point me to any resource which may help in this regard. Thanks


texts: Why does Drupal store each custom field in a separated table?

texts:
I understand that, in order to add functionality to nodes and node types, extra fields must be created in the database.

Now, I don't see why a one-field-one-table schema is used instead of favouring the schema of just a single table for a content type, and then, in that additional table, all the extra fields. What are the adventages of that approach?

I have a site with 1,000+ tables and is being a mess to administer.


texts: Caching issue with domain access and media image

texts:
If I clear the cache and access the node with media image from a user with no domain access to image, am I going to get empty field from the cache if I access it from super admin?

I am currently using memcached.


texts: Relationships between content types and views

texts:
I am new to drupal, but have decent knowledge of WordPress & PHP. I am currently building a drupal site where I need to link two content types together and display them on the front end accordingly.

I have one content type called Vehicle Range, which contains a list of Vehicle ranged (e.g. BMW 1 Series, BMW 3 Series)

I have another content type called Vehicle Models, which lists the vehicle models (e.g. 1 Series 118i, 1 Series 118d, 3 Series 335d).

What I want to achieve is a menu that lists all of the Vehicle Ranges with the relevant models as dropdowns.

Example:

1 Series           3 Series

   118i                335d

   118d

I have created a reference between the two content types using the Entity Reference Module. The reference field is attached to the Range content type so that you tick all of the relevant models that belong to that range.

I am trying to create a view using this relationship, but my lack of experience with Drupal and views is causing me to fail. Whilst creating a view, the closest I can get is either a list of all of the models, displaying all of their fields, but they are not 'categorised' under the relevant range, or a list of the ranges with the model labels, which is close, but I need the full content / all of the fields attached to each model rather than just the label.

How can I make a view that will give me the output I need as shown in the example above using the two content types and reference field? Any help would be massively appreciated as I'm brand new to Drupal!


texts: How to load node with AJAX on a Calendar click?

texts: I want functionality like this: when user clicks a node link in a calendar view, the details of the node should be loaded tu another region with AJAX. How to achieve this?


texts: Views 3: Getting related content from node ref field

texts:
Okay, i have the following node types:

Band
Story

Every story content links to a band via the node reference module for Drupal 7, now i'd like to pull related story content thats linked to the band when i view the current node that links to band X.

To give you an beter example:

When the story, "helloween reveals new album" links to helloween, i'd like to display all the related story's about helloween in that view...


texts:
I made cache_form table work (see How to keep cache_form small). But cache_form, though expired cache is now cleared, is enormous anyway (nearly 2 Gb, and we have only 1000 unique users in a day).  How can I change expire time? Is this caching really needed?

BTW, can you recommend any module for caching handling in Drupal? Seems there are lot of them but mostly obsolete.


texts: Hiding a drupal block on particular page

texts:
I am trying to hide a Drupal block on a View page.

The View url is http://localhost/alphabetical

And name of the block is family tree. So I went to Structure ->Block ->Configure(for Family tree)
and added /alphabetical to Show block on specific pages(with Radio button All pages except those listed)
But it didn't work.
Then I cleared all the caches.Still it didn't work.


texts: Missing DB table blocking uninstall of custom module

texts:
Simple problem PITA to fix.

I created a module with a custom entity and some other stuff. But there was an error during installation and the DB table did not get created.

Attempting to uninstall gives an error because it can't find the table to delete it.

 [ERROR] SQLSTATE[42S02]: Base table or view not found: 1146
 Table 'xxxxx.zzzzz' doesn't exist:
 SELECT base_table.id AS id, base_table.id AS base_table_id
 FROM {zzzzz} base_table LIMIT 1 OFFSET 0; Array()

So I'm stuck - I've fixed the problem but can't uninstall the module to reinstall it.

How can I persuade the uninstall to work?

I have considered faking the table it's asking for, but is it going to expect the field tables to be there as well?

What I really need is for it to be less picky about the tables being missing.


texts: Is there any module for importing news from a WordPress site?

texts:
When we install Drupal, the first thing we do is importing content from other engines that we used.

Is there any kind of similar converters from other engines, for posts, user accounts, and comments?


texts:
Is there a way to render HTML5 captions in Drupal 8? I've tried with embedding images and embedding media in the WYSIWYG, and I've also tried with media migrated from D7 to D8, but nothing works.

An image with a source like this in the WYSIWYG:

renders on the page like this:

  actual photo of a mermaid

and a media entity with a source like this on the WYSIWYG:

<drupal-entity data-caption="this is the caption" data-embed-button="media" data-entity-embed-display="view_mode:media.large_480x480" data-entity-type="media" data-entity-uuid="7012b662-1430-4610-8fa3-65eede89f7ba"></drupal-entity>

renders on the page like this:

this is the caption

with random
 tags that hold nothing and the caption pulled entirely out of the relevant tag so its parent is actually the body field. Neither of these use HTML5 with a wrapping
 tag or even a
 or
 tag.

I found a suggested hack that uses the image's title tag as a caption, and the sandboxed Image Caption module uses jQuery to produce similar results, but my site is migrating hundreds of articles where the content team has used captions for image credits and we're legally required to display those, so we can't pretend the image title is the caption. Also, the way captions are currently being rendered doesn't allow us to style the them in a way that ties them to the image or separates them from the surrounding paragraphs, so they just blend in with the rest of the text.

I tried to dump the image's variables to the page, but there is no caption:

array:8 [
  "#theme" => "image_style"
  "#style_name" => "large"
  "#attributes" => []
  "#title" =>null
  "#uri" => "public://field/image/groundhog_480x480.jpg"
  "#width" => "480"
  "#height" => "480"
  "#alt" => "Photo of a groundhog"
]

so somewhere in the rendering process the caption is being removed from the image and rendered separately.


texts: How to load a view with ajax so that additional js/css files needed by the view are also loaded?

texts:
Currently I'm using jQuery to load a view, like this:

$.ajax({
    type: 'POST',
    url: Drupal.settings.basePath + 'views/ajax',
    dataType: 'json',
    data: 'view_name=' + viewName + '&view_display_id=default&view_args=' + viewArgument, // Pass a key/value pair.
    success: function(data) {
      var viewHtml = data[1].data;
      target.children().fadeOut(300, function() {
        target.html(viewHtml);

        var newHeightOfTarget = target.children().height();

        target.children().hide();

        target.animate({
          height: newHeightOfTarget
        }, 150);

        target.children().delay(150).fadeIn(300);

        Drupal.attachBehaviors(target);
      });
    },
    error: function(data) {
      target.html('An error occured!');
    }
  });

My problem is, that for example if the view uses the 'Field Slideshow' module, the js/css files needed for it to work properly are not loaded. What could be a nice (= kittens unharmed) solution to this?


texts: limit access to some configuration pages (manage display and manage fields)

texts:
I have editor and administrator role in my website, the editor role must have "Administer vocabularies and terms" permission (in admin/people/permissions page),

How can I restrict editors from "manage display" and "manage fields" without uncheck "Administer vocabularies and terms" , so they can't access to this page : admin/structure/taxonomy/VOCABULARY_NAME/display/?


texts: How to implement 'phonetic typing' for performing a language conversion of a field (using CKEditor)?

texts:
I am using CKEditor in a Drupal website. I am looking for a technique to convert (not translate) words from English to some other language (say Telugu), while typing those words.
Below are 2 examples to illustrate Phonetic typing (during the creation of a node):

If I start with typing "What" in a text-area (long text), then it should suggest something like so:

If I then continue typing "oka" in a text-area (long text), then it should suggest something like so:
 ... 2

How can I achieve (implement) this while using CKEditor?


texts: Flag lists visible for one authenticated user but not for others

texts: The site in question displays a table-formatted View of relevant content, with a checkbox column for flagging. [relevant modules installed: Flag, Flag Lists, Flag Actions] The Flag List Operations widget allows creation of custom-named lists, which are viewed in a separate node. Each list name launches a full display of the flagged content. At one point this was working perfectly for authenticated users as well as for Admin. Mysteriously, now it is working for one authenticated user but not for any other authenticated user. Specifically, these other users' List names will be shown in a table view, but when clicked, the list is empty. I tried deleting the non-working users (all experimental at this point) and creating new ones. There is no obvious difference in the config of the new ones as compared to the one that works. Any suggestions about how this inconsistency could happen?


texts: How can I theme the Captcha/ReCaptcha error message?

texts:
I'd like to change how the error message is when a user fails the recpatcha.

Currently it is just plain text on top of my form but I would rather have it be a modal or at least be in red.

I looked into the templates folder in both the Captcha module and ReCaptcha but did not see anything for the error message.

Is there a way to theme the error message?


texts: How to expand the fieldsets in node-add form?

texts:
When I am adding new node by admin/content/node-type/story, there are a lot of settings ordered by groups:  Submission form settings, workflow setting, comment settings. But all these fieldsets are all by default collapsed.

My question is: how to make them all default to expanded?


texts: I have D7 with profile2 how can I display the user last active date (last login date) on the users profile so other users know that they are an active user. It doesn't have to the actual date it can say something like "Active within the last week"


texts: How to edit an order to add the shipping line item to prevent AJAX error

texts:
Using Drupal 7.61 and Drupal Commerce 7.x-1.14 (+ Commerce Shipping 7.x-2.3 and Flat Rate 7.x-1.0-beta2)

My client has (probably) deleted the shipping line item for an order and he has tried to edit this order to add a new shipping line item (4 shipping services set by Flat rate).

We get the same AJAX error each time we try :

DatabaseTransactionOutOfOrderException: in DatabaseConnection->rollback()(line 1094 of /home/my_website/public_html/includes/database/database.inc).

Where should I look to fix this issue?

First there was also a Rules issue and I managed to fix it with a specific condition but we still can not edit the order to add a shipping line item.

EDIT : after a couple of new tries, it seems like the Rules Collect rate : flat rates fired and failed somewhere... some values are missing when adding a shipping line item through Order edit form, compared to Checkout where everything goes well

EDIT/ANSWER : Thanks to Clive's comments, I found a solution. Actually, multiple savepoints were involved in my process (one to save the new shipping line item in Drupal database and an another one to send it in an external database through a specific Rule). That makes sense when you read documentation on rollback(). So I have changed my Rule with a special condition related to shipping and now it works.


texts: how to change max upload size of media file

texts: I am using media module to add files to server and have given same access to others. Now I want to keep the upload size limit to 1 MB. Please let me know if any option to change this.


texts: I have added a date field to the article content type. I am writing a view to display this date. When I add the field I get a formatter drop-down which allows me to select three different date formats "Date & Time", "ago" or "plain".  However if I add the article post date I get more options including a "custom" format option. It seems that the handler associated with my date field is 'views_handler_field_field' whereas the handler associated with the 'system added' date field is 'views_handler_field_date'. What is going on here? Why are the two fields treated differently? What do I need to do to get the extra options?


texts: Forcing together line items of the same unit type in Rooms and Commerce

texts:
I am using Rooms and Commerce together as a booking system. One thing that bothers me is that it's possible for a customer to book let's say 50 pairs of roller skates, but Commerce will render each pair of roller skates as its own line item, which becomes insane as you have a long list of roller skate bookings when it could just print 50 x Roller Skates instead. Is there a way to force Rooms to recognize that items of the same unit type should be counted as several instances of one booking instead of several separate bookings?

Alternatively, does someone have a better idea of creating an equipment booking system that has checkout and payment integration? I also need the possibility to give discounts for multi-day bookings.


texts: Is there a way to schedule Automatic Source Code and Database Backups?

texts:
A colleague told me about a plugin that he used to run on Word Press that would save his Source Code and DB automatically. He asked me to look into any plugins like this for Drupal 6.x and 7.x.

Does anyone have any experience with this that they can share?

Thanks,


texts: Why does the Google Analytics module restrict uid?

texts:
When I try to insert the [current-user:uid] token for a custom dimension in the Google Analytics module, it gives me an error that this is a forbidden item.

However, reading through the GA Terms of Service, I can only find a vague statement saying only "non-personally identifiable information" is allowed.

The GA module is the only documentation I have found that explicitly states the uid is forbidden.

Wouldn't an id be allowed because Google has no way of retrieving the Drupal user's information?

Does anyone have a reference to where in the GA policy they disallow uid?


texts: How to import CSV feed into nodes with multiple taxonomy terms?

texts:
My question title says it all.

I have feeds for importing and tamper for editing the data before being put into my nodes.

I have my values delimited by commas and explode is making them into individual values.  I've made sure of this by also assigning them to individual text fields.

The exploded values are not getting assigned to already created taxonomy terms.  I've noticed that there are spaces in front of all terms except the first and after all terms except the last.  I've tried to add additional options like trim or exact. Neither have had any affect.

To simplify things, I've removed all but one taxonomy terms and removed all spaces before and after commas from the .csv file. Still nothing shows up into my term field when I explore.

Additional I've tried to use the search term by name add-on for feeds, but it gives me a query error.

Since I'm obviously missing a step, I'm curious how to set up each step of the puzzle.

Content type field set up, mapping to the term reference field, and finally the tamper set up. Since mapping is fairly straight forward I'm only concerned with getting multiple taxonomy terms attached to the nodes I am trying to import.

I'm hoping to avoid trial and error of every combination of settings here as such, any and all help provided is appreciated.


texts: Altering the view mode of rendered entities in a View Context via Ctools Plugin

texts:
I don't even know if what I want to do is possible, so bear with me. My set-up:

I have a View Context that accepts an author UID argument from the Panel context, and then displays content created by that author UID. This View Context has been added to the user/%user system Panel in Page Manager. This allows me to create a custom CTools Plugin that takes that View Context, gives it an additional parameter (content type) to filter by, and spit out the final view programmatically.

The purpose of this is to create many small reusable lists of content in different content types that a specific user has authored, with custom more links and other mark-up around those lists. (I.e., we might show 3 of each content type on a profile page, and if they have created more than three, we link to a different user/%user/this-content-type page that has the full list of that type and a proper pager.) The custom header/footer/more links, the ability to insert additional custom copy or code between lists of nodes, and manual ordering of content types are the main reasons why I'm not simply using Views' default grouping function.

The relevant View rendering code in the CTools Plugin is something like this:

function custom_list_render($subtype, &$conf, $args, $context = NULL) {
  $block = new stdClass();

  if ($conf['type']) {
    $view = views_content_context_get_view($context[0]);
    $view_output = views_content_context_get_output($context[0]);
    $plugin = $view->style_plugin;
    $rows = array();

    foreach ($view_output['view']->result as $row_index => $row) {
      if (custom_content_type_match_function($row, $conf)) {
        $rows[] = $view_output['rows'][$row_index];
      }
    }

    $output = theme($plugin->theme_functions(),
      array(
        'view' => $view,
        'options' => $plugin->options,
        'rows' => $rows,
      )
    );

  $block->content = $output;
  return $block;
}

This code works. There's some additional admin form work going on that selects and saves the $conf['type'] for each iteration of this plugin that you add to a panel.

Right now, the view output is spit out as rendered entities in a custom view mode. I'm wondering if it's possible to alter the View Context at the plugin level so that when you add this plugin to a panel, you can also select which custom view mode you want the rendered entities to render as. (Think Teaser vs Full vs Block.) If so, at what point do I need to disrupt the view (I imagine before views_content_context_get_view?) in order to pass it the new view mode, and how?

Alternatively, could I somehow pass an additional custom argument to the view (e.g. "ctools_view_mode" or something) and then use hooks_view_pre_render to change the view_mode?

Thanks in advance!

Running: Most recent iterations of D7, Panels, Views.


texts: How to theme the emails send through SMTP module?

texts:
Drupal7 website send email  using the SMTP module.

I have to theme the email template with my website default theme logo,header and  footer links.

How could I achieve this one?

Referred this Using HTML Mail together with SMTP Authentication Support
 and configured modules HTML Mail and Mail System

Added template htmlmail--smtp.tpl.php with content from this link
in my custom theme folder.

While sending htmlmail test mail the template contents are rendered.

Also SMTP test mail  renders the template contents but other mails sent via SMTP module don't take this template.

Other mails include the registration mail,reset password, all other system mails and all mails defined from custom modules


texts: Factors regarding menu visibility (menu is missing on access denied)

texts: I've built a theme based on Zen starterkit, and recently noticed that my main menu is not rendering on any access denied pages (non-admin role obviously), however, the remaining content is rendered as expected. What are the likely causes & recommended solutions? Is this a Zen thing?


texts: Any advantage of using drush remote site aliases compared with Ansible

texts:
I like to use Ansible, when I'm automating work on a remote server. Its agentless nature allows me to run Drush commands on those server very easily. When there are multiple sites, I can set up local aliases on a remote server and use them when running commands.

So my question is: Is there any reason, why I should run ansible playbook locally and run drush commands using remote site aliases?


texts:
The current state of the site, is configured such that authenticated members, can post specific content types and comment on everything.

What was asked of me, was the restriction of users having tagged (taxonomy) themselves as "private" (their profiles aren't accessible), not being able to perform the above operations.

Apart from assigning a new role, on user update and having one more role to manage, is there another way to do that?

Ideally I'd like to assign to a "private" user the same rights as an anonymous user but without actually making him one, since I am already filtering for authenticated users in views and such.