texts: How to link migrated image file to the user profile picture field?

texts:
I used the following migration file to migrate user pictures from a Drupal 7 site installation to Drupal 8:

  migrate_plus.migration.drupal7_image.yml

id: drupal7_image
label: Images
migration_group: dhm_migrate_taxonomy
migration_tags:
  - Drupal 7
source:
  plugin: d7_file
  constants:
    source_base_path: '/var/www/html/migrate_training_7/web/'
process:
  fid: fid
  filename: filename
  source_full_path:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/source_base_path
        - filepath
    -
      plugin: urlencode
  uri:
    plugin: file_copy
    source:
      - '@source_full_path'
      - uri
  filemime: filemime
  status: status
  created: timestamp
  changed: timestamp
  uid: uid
destination:
  plugin: entity:file
migration_dependencies: {}

And I am using this next snippet to link the migrated image files to the user picture field (This is used in my user migration file):

  migrate_plus.migration.custom_user.yml

  user_picture: # Image field name in Drupal 8 site
    plugin: iterator
    source: user_picture # Image field name in Drupal 7 site
    process:
      target_id: fid
      alt: alt
      title: title
      width: width
      height: height

migration_dependencies:
  required:
    - drupal7_image

I can see that the files are being migrated and downloaded to my Drupal 8 installation but when I check the users I don't see any user pictures (fields are blank).

I really don't know what I am missing, I searched for examples on the Internet but I didn't find much.

Any help would be much appreciated. Thanks in advance. ;)


texts: redirect to a url with fragment from a form in an overlay

texts:
I'm trying to redirect from a form submit function (form is in an overlay) using either

drupal_goto('url',array('fragment'=>'foo'))

or

$form['redirect'] = array('url',array('fragment'=>'foo'));

Both redirect to the url but dont add the frag. Overlay specific issue? Any way around it?


texts: How to post three nodes of same content type in three different blocks in the front page?

texts: I have already set the block regions in both my page--front.tpl.php and site.info files, created the custom content type and created the content that should be displayed on each of them....now how am I supposed to post this in the front page? I was told I should use Views for this with no much further explanation and I'm following some nodeone's screencasts on views... but I'm not really sure what I'm looking for here. Any hints?


texts: Move all files and folders from a directory to another directory

texts:
I am unzipping some files and folders from an upload but the zip contains the files and folders one directory too deep. So currently they are located

path-to-folder/anotherdirectory/

When I need them to be located at

path-to-folder/

I have tried using the PHP rename function but get an error stating http 'wrapper does not support renaming in...'

Does anyone know the Drupal way to do this please


texts:
We have a view that returns a Media_entity (Drupal\media_entity\Entity\Media) using the following in a hook_preprocess_view_views hook. When we try to access the field_media_type variable, I get a NULL. field_media_type is a custom field (taxonomy field) on all the Media bundles.

How do we get the fields from a Media_entity?

use Drupal\media_entity\Entity\Media;

function mymodule_preprocess_views_view(&$variables) {
  $results = $variables['content']['#view']->result;
  foreach($results as $row){
    $media_entity = $row->_entity;
    ksm($media_entity->get('field_media_type'); // returns null.
  }
}

I also tried the following:

use Drupal\media_entity\Entity\Media;

function mymodule_preprocess_views_view(&$variables) {
  $results = $variables['content']['#view']->result;
  foreach($results as $row){
    $mid = $row->mid;
    $media_entity = Media::load($mid);
    ksm($media_entity); // null
  }
}

content array

iterator contents


texts: Field available only when a value from a Hierarchical Select is chosen

texts:
I am using the Hierarchical Select module to allow users to first select a continent and then a country. I wish to enable a field only when a user selects North America (first selection) and USA (second selection).
I hope someone could explain how I achieve this.


texts: I want to enable a disabled input format

texts:
I considered 'restricted HTML' as unnecessary and set it ‘disable’.
Because I thought it possible to re-enable.
However, I have not found a disabled format on UI.

Since there is no choice, I decided to newly register.
The same registration as the default machine name 'restricted_html' conflicts.
Imagine the data is left somewhere.
I could not find it even if I looked for a database.
Is it possible to restore by setting file or something?

I am using Drupal 8.4.2.


texts: Including Google Maps in my custom module

texts:
So, to set the stage, I'm working on a small database project that will handle a company's order handling.
So far, I have a fully working client part where users can get a full list of all the clients and can edit/delete/add clients at will.

The next think that I'm trying to implement, is that each client will also have it's own details page, where more details of the client will be displayed. It should display all the data in the database regarding the specific client, but it should also incorporate a Google Map based on the client's address.

I've looked around and found a dozen of Google Maps modules, but they only seem to work with article types that have fields that contain an address.

My current line of thinking was just to render the detail page with a render array after getting all the client's info from my database.

1) Is this the correct way of doing it? If not, how should I approach this?

2) If yes, how can I then implement a google map?

EDIT:

The thing is, I'm not exactly working with a content type at the moment. I'm using hook_menu for all my pages, and an example callback function for displaying a full list of all the clients is

function expoline_clients_overview() {
    // Table settings.
  $attributes['datatable_options'] = array(
    'bFilter'   => TRUE,
    'bInfo'     => TRUE,
  );
  // Define table columns
  $header = array(
    array(
      'data' => t('Column 1'),
      'datatable_options' => array(
        'bSortable' => TRUE,
        'bSearchable' => TRUE,
      ),
    ),
    array(
      'data' => t('Column 2'),
      'datatable_options' => array(
        'bSortable' => TRUE,
        'bSearchable' => TRUE,
      ),
    ),
    array(
      'data' => t('Column 2'),
      'datatable_options' => array(
        'bSortable' => TRUE,
        'bSearchable' => FALSE,
      ),
    ),
    array(
      'data' => t('Column 2'),
      'datatable_options' => array(
        'bSortable' => TRUE,
        'bSearchable' => TRUE,
      ),
    ),
    array(
      'data' => t('Column 2'),
      'datatable_options' => array(
        'bSortable' => TRUE,
        'bSearchable' => TRUE,
      ),
    ),
    array(
      'data' => t('Column 2'),
      'datatable_options' => array(
        'bSortable' => TRUE,
        'bSearchable' => TRUE,
      ),
    ),
    array(
      'data' => t('Column 2'),
      'datatable_options' => array(
        'bSortable' => TRUE,
        'bSearchable' => TRUE,
      ),
    ),
  );

  /*
   * Fetch all clients from the database and insert them into the array of rows
   * that will be rendered in the table
  */
  $query = db_query("SELECT * FROM {expoline_clients}");
  foreach ($query as $currentclient) {
    unset($client);
    $client[] = $currentclient->name;
    $client[] = $currentclient->street;
    $client[] = $currentclient->street_number;
    $client[] = $currentclient->postal_code;
    $client[] = $currentclient->city;
    $client[] = 'cid . '/edit"><button type="button">Edit</button>';
    $client[] = 'cid . '/delete"><button type="button">Delete</button>';
    $clients[] = $client;
  }
  $rows = $clients;

  // Render the Datatable
  $variables = array(
    'attributes' => $attributes,
    'header' => $header,
    'rows' => $rows,
  );
  $output = theme('datatable', $variables);

  return $output . '<button type="button">' . t('Klant toevoegen') . '</button>';
}

Thanks a bunch!


texts: ckeditor loads all the page html while editing not only the body field

texts:
I have strange issue with ckeditor that it loads all page source including (header, menu, body, footer ...) not the node body field itself.

the problem may have relation with default search module as it disappears when I re-index the site till the index built again.

I tried many links and that question but nothing works for me.

I tried jquery_update but didn't make any change BTW I see the body field content before the ckeditor loads after that the field content becomes all page source

CKEditor: 7.x-1.16, CKEditor Media: 7.x-1.x-dev, jQuery_update module loading jquery 1.8

I checked ajax requests and found that /ckeditor/xss returns the whole page content.

Please help me fix that issue

Answer:

The solution in my case was based on zhilevan answer solution 2

just added checking for the $view_mode like:

function my_module_node_view($node, $view_mode, $langcode){
 if ($node->type=="webform" && $view_mode != 'search_index'){
 //Do some stuff here
}

solved the issue without the need to disable the search module

Also solution 1 :Switch of "Plugin for inserting Drupal teaser and page breaks" didn't make sense and I think it have no impact here


texts: How to Prevent Truncation of RSS Feed Items in Drupal 7?

texts:
I'm using Drupal 7 and the Feeds module to import one RSS feed. When viewing imported feed items under "View Items" tab all feed items having more than one paragraph are being truncated after the first paragraph[...]. I've set Feed Items content type custom display setting to "Show full content" and it made no difference...content is still truncated after first paragraph.

I would like to configure the View page of feed items to show a list of teasers with "read more" links pointing to each feed item's full content on a separate page/node.

Not sure how to configure to accomplish this.

Thanks in advance for any tips or suggestions.


texts:
We are a a job site where we allow visitors to post Jobs / Events through various forms. However it looks like that spammers are using this process to put spam in tag fields. This has resulted into tag cloud being spammers paradise.

How can I restrict that?


texts: My PECL uploadprogress bar appears, but why doesn't it show any progress?

texts:
I installed the PECL uploadprogress bar in php and this is working fine but when I start uploading a file it ends up getting stuck and dissapearing when the file is uploaded.

This is what i see when i start the  upload:

The file is big enough so it doesnt open/close really fast.

But it just ends up being stuck at Starting upload... and not moving the blue bar to the right when its uploading. After a while it just dissapears and says done and i can submit the form fine.

This is how i want it to look like while uploading:


texts: How to use Drupal Code Sniffer in windows?

texts: How do you configure and use Drupal Code Sniffer in Windows?


texts:
Possible Duplicate:
  How do I create a multisite, sharing users and nodes?
  How to share user and user profile in a multisite environment?

My question was about the whole process to get the shared user in a multisite environment.
I didn't know how to start.

I found my answer here

http://drupal.org/node/547862

As the title says I would like to share user and profile table between multisites.

I have got the main domain like example.com and then I have two subdomain site2.example.com and site3.example.com with separate db.

My 'sites' directory is:

all

modules

themes

libraries

default

files

setting.php

site2.example.com

modules

themes

libraries

files

setting.php

site3.example.com

modules

themes

libraries

files

setting.php

I know how to create multisites with separate db, modules, themes and files, now I would like to know the whole process to create a multisite with shared user and user profile.
What I need to do?

Thanks in advances.


texts: Drupal Commerce: discount for line items based on user's values?

texts:
I need to have different discount rates for every customer.

I added a textfield in the user profile, where I store a Json object with all the discounts (there is a little GUI to manipulate it), so, for example, I can have this situation:

{
    'product_B': 20,
    'product_A': 15,
    'product_C': 0
}

This means that this customer will have a fixed discount for all commerce_products of type A, 15 on type B and 0 on type C.

I got stuck in the Rules configuration: I created a rule for the Subtract an amount from the unit price event; In the condition, i just check that the user and the line item match few pre-requisites, and it works, but I cant get the line_item details in the action:

// My action
global $user;
$ul = user_load($user->uid);
if(isset($ul->field_discounts))
{
  $user_discounts = field_get_items('user', $ul, 'field_discounts');
  /*
   * Here i have to get few info of the current commerce_product/commerce_line_item
   * in order to calculate the correct $item_discount
   * */
  $discount = ((int)$item_discount * $value) / 100;
  return $discount;
}
return 0;

So the question is: inside that PHP block, how to get the current line item?


texts: Voting Api + Vote Up / Down = Vote Power

texts: I have installed VotingApi with Vote Up/Down, also have my own module which implements user exp and levels. I want the voted to be more powerful if the user has greater level. I search through Vote Up/Down files but didnt find a file inserting the vote to databse, so I could change it depending on my needs.


texts: How can I add several products to a Drupal Commerce cart by

texts:
I wish to use Drupal Commerce to take bookings on my hotel booking site, all of the hotel detail is provided by Laterooms via XML (using Feeds). Obviously hotel availability changes all the time so I can't (and wouldn't want to) bulk download and process all availability data, so this needs to happen when the site user requests it.

So far, so good, that's working fine, and I can book individual nights accommodation easily enough.

I would like to combine several nights stay into a single product (or group of products) so when a customer requests a two, three or more nights at a particular hotel they can do that with one click and have the cart show the nights bundled into one order line.

Thanks,

Chris


texts: How do I add an additional submit handler in commerce checkout form?

texts:
How do I add an additional submit handler? I have tried this but it did not work.

function c_coupon_form_alter(&$form, $form_state, $form_id) {
  drupal_set_message($form_id);
  switch($form_id) {
     case 'commerce_checkout_form_review':
      drupal_set_message($form_id . '_form submit');
      $form['#submit'][] = 'c_coupon_review_submit';
  }
}

function c_coupon_review_submit($form, &$form_state) {
  drupal_set_message('submitted');
}


texts: How to retrieve value of start date with format end date?

texts:
I D8 installed the module Optional End Date in order to add an optional end date within a date field.

When I had a single date field value I could get the value by using:

 $datum_deelname = $node->get('field_normaldate')->value;

If I change this in the new field name:

 $datum_deelname = $node->get('field_optional_enddate')->value;

I get back NULL.

How should I get this value?


texts: How do I get the path alias without the language code?

texts:
Suppose I have an alias like http://www.example.com/en/the-new-webpage.html.

I want to get the the-new-webpage.html part in hook_preprocess_html(). The language code might change into 'ja' or some other code due to the language availability. So I can't get the URL and pass it to str_replace() to replace the language part. Is there a function or a way to get the alias part without the language code?


texts:
I can see that using styles on inline images have been left out for some reason. But when I need to make the site behave a little more responsive.

I have been looking after CKeditor plugins that could select a style for the image being include. But I haven't found any.

I have been looking after at comment on the Drupal 7 Picture module that should be what is the base for the implementation of Responsive Images in Drupal 8. But there is nothing about inline images to find - just old Drupal 7 demos on how it should work.

Any idea how to get responsive images or just a basic image style for images include in inline editor on Drupal 8?


texts: Entity Reference field fails when choosing from more than 1000 items

texts:
I've set up my Drupal system to allow users to select from a list of locations, which are registered as nodes.

However, after importing my ~6000 locations the field lookup no longer works with the following error:

  PDOException: SELECT revision.vid AS vid, base.uid AS uid, revision.title AS title, revision.log AS log,
  revision.status AS status, revision.comment AS comment, revision.promote AS promote, revision.sticky AS sticky,
  base.nid AS nid, base.type AS type, base.language AS language, base.created AS created, base.changed AS changed,
  base.tnid AS tnid, base.translate AS translate, revision.timestamp AS revision_timestamp,
  revision.uid AS revision_uid
  FROM {node} base INNER JOIN {node_revision} revision ON revision.vid = base.vid
  WHERE (base.nid IN (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2, ... (trimmed) ...
   :db_condition_placeholder_5915, :db_condition_placeholder_5916))
  ...

  SQLSTATE[HY000]: General error: 1795 OCIStmtExecute: ORA-01795: maximum number of expressions in a list is 1000 (ext\pdo_oci\oci_statement.c:148)

I am using an Oracle backend, so it's possible this error is a quirk of Oracle. But in general, is the Entity Reference module intended to allow lookups on large lists of nodes? Or should I move to another module such as the References module?


texts: Uploading images into separate directories for every new content

texts:
My page, created using Drupal 7, will contain multiple galleries. I created new "Content Type" - "gallery" with an unlimited numer of "Image" fields. For each content of this type I want all of its images to be placed under different directory, eg. sites/default/files/gallery_01, sites/default/files/gallery_02, etc.

There is a "File directory" setting but I don't know how to make it content-dependent (when I create new content I want all uploaded images to be placed in a different directory).

Is there any way I can accomplish this ?


texts: Creating facets for custom contents added by CCK in apache Solr module

texts:
I was unable to create Facet for a CCK field, in the sense that for a specific CCK content type i was unable to group.

This could be summarised as my problem statement

Ex. CCK Field - Article Author

Actual Result :
No Group (No of Search Records)
Expected:

Author 1 (2)
Author 2 (5)

etc....

This is my primary concern, I need to create facet for the custom content types.

Please let me know if any of you have previous experiences with implementing Apache Solr for Drupal. Also let me know your kind suggestions and feedback.

My drupal version is 6.22.

Note: Based on my googling experiment i set the CCK field type in question as text and not string but still didn't help me much.


texts: Why is my form_token missing when i'm not logged as admin?

texts:
I'm in charge of multiple Drupal 8 website and with some of them, the hidden field form_token is non-existent when I'm using the website anonymously.

Everything works fine when I'm logged in.

I'm sure everything was working before the quarantine but I didn't check before updating to 8.8.6

I tried deleting the custom twig templates of the webform and I checked my theme.theme

webform version is 8.x-5.13 for some and 8.x-5.16 for others.


texts:
Say I have node/111/edit, and that node's path is my-node. I want the edit page to be at
my-node/edit, instead of node/nid/edit.

Is there an existing solution for cleaning up the node edit URL, e.g. a custom module or the Pathauto module? All I see for the Pathauto module is a place for page patterns, but that would only handle page views, not edits.


texts: How to Pass a Variable to Commerce Order Twig Template

texts:
I have located commerce-order-receipt.html.twig in commerce/order/templates/ and I have copied it to my theme directory, properly overriding it. My basic changes all work.

Now I am trying to figure out how to pass my own variable to it. I can't figured out which hook_preprocess function I need to use in order to do this. I have figured out how the suggestion and original variables were made in commerce_order.module but this has not helped me hook into it and add more variables.

Can someone point me in the right direction?


texts: Taxomony menu - show all, vocabulary link are disabled

texts:
I have a custom vocabulary which looks something like this:

Shops (vocabulary name)

Sporting Goods
Auto Parts
Computers
Etc. (15 items in total, 1 level)

My goal is to create a menu link to Shops and a drop-down sub menu that lists different types of shops (example - Auto Parts). Shops link must be in the main menu.

I have PathAuto installed and all term have their aliases. My problem is that the exact two options from Taxonomy Menu module while editing my vocabulary are disabled:

Add item for vocabulary (disabled)

Shows the vocabulary name as the top level menu item of the taxonomy menu.

Use 'all' at the end of URL (disabled)

This changes tid+tid+tid to "All" in term when Display descendants has been selected.
Only used if Menu path type is "Default path".
Works with default taxonomy page.

Menu path type is set to Default.

Why are they disabled ? Is this the appropriate module for this kind of menu ? Should this be constructed with Views module (haven't got round to it)

Since I am just beginning to learn drupal, I'd like to use as few modules as necessary, since there is probably a module for everything, but they would only probably bloat the site and I wouldn't learn anything.

Bonus question: are there any simple, widely used D7 themes with built in drop-down menus (currently using Bartik)?


texts:
I'm trying to create a module which adds a page, the controller works but I cannot render a twig template for it.

The page layout is displayed without the page I created and this warning is reported in the logs:

"Theme hook eu_calendar not found."

but I do have the hook defined

This is the controller:

class EuCalendarController extends ControllerBase {

    public function index() {
        return [
            '#title' => 'my title',
            '#theme' => 'eu_calendar',
            '#description' => 'description test',
        ];
    }
}

Module file:

function eu_calendar_theme($existing, $type, $theme, $path) {
    return [
        'eu_calendar' => [
            'template' => 'index',
        ],
    ];
}

I also tried adding variables like

function eu_calendar_theme($existing, $type, $theme, $path) {
    return [
        'eu_calendar' => [
            'variables' => [
                'test_var' => NULL,
            ],
            'template' => 'index',
        ],
    ];
}

What am I missing here?

And do I need to configure anything with the regions, I want my module to be displayed in the content region by default...

Any documentation or tutorial is also welcome, I read a bunch of them none of them is explaining the options and details.


texts: How to implement decoupled user registration with React / jsonapi?

texts:
I have built a React app that uses JSON:API to pull in data, but now I want to implement user registration.
JSON:API doesn't do user registration because it isn't a CRUD operation.
However, the links above explain that core provides a REST endpoint for handling user registration.
The documentation gives this example:
curl \
  --header "Content-type: application/json" \
  --request POST http://drupal.d8/user/register

But this example seems incomplete-- for example, where is the username?
My website is configured with the Email Registration module and only an email address is required to register, but where do I submit the email address?
EDIT: If you're answering this question, I will accept an answer that uses core's username/email address combo for registration; it doesn't have to be specific to the Email Registration module.  The problem is that I can't find an example of how to register users with JSON:API, and there is no documentation.
Here's the code I tried in React:
UserRegistrationForm.tsx
import * as React from 'react';
import { useForm } from 'react-hook-form';
import { IonButton } from '@ionic/react';
import { baseUrl, basicHeaders } from '../utils/globals';
import handleErrors from '../utils/fetchHandleErrors';

interface InterfaceRegistrationFormInput {
  email: string;
}

const UserRegistrationForm: React.VFC = () => {
  const { register, handleSubmit, errors } = useForm<InterfaceRegistrationFormInput>();

  const onSubmit = (formData: InterfaceRegistrationFormInput) => {
    fetch(`${baseUrl}/user/register`, {
      method: 'POST',
      headers: basicHeaders,
      body: formData,
    })
      .then(handleErrors)
      .catch((error) => Promise.reject(new Error(error)));
  };

  return (
    <>
      <form onSubmit={handleSubmit(onSubmit)}>
        <label htmlFor="email">
          Email address
          <br />
          <input
            name="email"
            type="email"
            ref={register({ required: true })}
          />
        </label>
        <IonButton type="submit">Register</IonButton>
      </form>
    </>
  );
};


texts:
How can i use settings form http://api.drupal.org/api/drupal/modules%21system%21system.module/function/system_settings_form/7 to make a file saved and retrieved using variable_get() ?

I am using Drupal 7.


texts: Add rules to the email recipients in webforms

texts:
I am currently working on a Drupal 7 site in which the contact form must email a particular representative based on whether the user belongs to a certain company or is in a certain location. The first check would be based on the company of the user so that if that company has a rep then they would get the email. If not then a country rep would be sent the email. Currently I am using webforms for the contact form.

I was thinking that if it was possible to add rules or conditions to the recipient emails of the webform based on fields in the form, that would be a good place to start. However after looking around and talking to a few people I'm not sure if this option exists at the moment. I would also be open to any suggestions on a different way to achieve this. Thanks to anyone who may have any advice.


texts: Apache Solr Search proper syntax in url?

texts:
Can anyone provide some info on how to properly execute a filtered apache sold search through the url?  So far I've figured out that

?fq[]=bundle:type

will return a results filtered by that bundle type.  I've also noticed that

?f[0]=machine_name:value

will return results if that particular facet has been configured.  What I want to figure out, though, is how to use the url to send any filter request.  For example, if I want to write a url that would return results based on a particular taxonomy term, how would I enter that?  Furthermore, can any field be used to filter a search?


texts: Where can I find the code for the user menu block?

texts: I'm trying to code a custom user menu, but I would like to see the original code of the built-in user menu block. Where can I find it?


texts: "Twig_Error_Loader: Template "file.html.twig" is not defined" for new twig template file

texts:
After creating a new paragraph type and its template file in the correct folder location, I am receiving the following error every time I view the page with that houses the new paragraph type.

Twig_Error_Loader: Template "file.html.twig" is not defined (Drupal\Core\Template\Loader\ThemeRegistryLoader: Unable to find template "file.html.twig" in the Drupal theme registry.)

I have followed the steps here to disable the cache. However I don't believe it worked because I still have to clear my cache through config>performance for changes to twig files to appear.

Similarly, I tried to enable twig debugging (and turn off caching) here and can not confirm that it has been enabled either.

I found an article: blog.wturrell.co.uk/troubleshooting-drupalcoretemplateloaderthemeregistryloader-unable-to-find-template/ discussing potentially clearing the theme-registry, but I do not have access to drush to run any commands.

I have already tried clearing all the cache from within drupal itself.


texts:
I'm trying to invoke hook_user_delete and for some reason it isn't getting called. I have essentially the same function in hook_user_cancel and that gets called correctly. Basically, I go into the user edit form, then down to the bottom to "Cancel Account". From the next page, if I click "Disable the account and keep its content.", the hook_user_cancel function gets called, but if I pick "Delete the account and its content.", neither the hook_user_cancel or the hook_user_delete functions get called. I checked this by placing a dpm at the beginning of each function. My code looks like the following:

function carrier_pigeon_user_delete($account){
$num_deleted = 0;

if(is_numeric($account->uid)) {
  $num_deleted = db_delete('carrier_pigeon_subscription')
      ->condition('uid',account->uid)
      ->execute();
}
dpm($num_deleted);
}

function carrier_pigeon_user_cancel($edit, $account, $method) {
$num_deleted = 0;

if(is_numeric($account->uid)) {
    $num_deleted = db_delete('carrier_pigeon_subscription')
            ->condition('uid', $account->uid)
            ->execute();
}
dpm($num_deleted);
}

Sorry about the formatting. Is there something I'm doing wrong here? My impression is that I need both of these to cover my bases, but I can't seem to get the first one to get called.


texts: Don't calculate shipping for specific item

texts:
I have to types of a same product (used a select list field):

1|Physical
2|Digital
(key|label)

Physical items needs shipping calculated. Digital doesn't.

Problem appears when you add physical and digital item to cart, rules calculate the flat rate shipping to both items. Which is wrong, it should calculate rate to physical and ignore digital product.

I'm thinking it has something to do with data comparison? Am I on the right path? I tried various options/sorting.

Update

My exported rule looks like this now (as per the recommendation in the 1st answer to also use the Conditional Rules module):

{ "rules__1_extra" : {
    "LABEL" : "+1$ extra",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [
      "rules",
      "commerce_line_item",
      "rules_conditional",
      "commerce_shipping"
    ],
    "ON" : { "commerce_shipping_calculate_rate" : [] },
    "DO" : [
      { "LOOP" : {
          "USING" : { "list" : [ "commerce-line-item:order:commerce-line-items" ] },
          "ITEM" : { "list_item" : "Current list item" },
          "DO" : [
            { "data_calc" : {
                "USING" : { "input_1" : [ "list-item:quantity" ], "op" : "*", "input_2" : "100" },
                "PROVIDE" : { "result" : { "result" : "Calculation result" } }
              }
            },
            { "commerce_line_item_unit_price_add" : {
                "commerce_line_item" : [ "commerce_line_item" ],
                "amount" : [ "result" ],
                "component_name" : "flat_rate_flat_rate",
                "round_mode" : "0"
              }
            }
          ]
        }
      },
      { "commerce_line_item_unit_price_subtract" : {
          "commerce_line_item" : [ "commerce_line_item" ],
          "amount" : "100",
          "component_name" : "flat_rate_flat_rate",
          "round_mode" : "0"
        }
      },
      { "CONDITIONAL" : [] }
    ]
  }
}


texts: Adding items to another Modules Admin form

texts:
I have a module that I need to add a few items to, I was told that using hook_form_alter was
the best way to do this, but have been completely unable to get anything to work. Maybe some
one could help me out on it a bit....

The PURPOSE of this enhancement is to add text and links to a login modal, but that's unimportant
at the minute.

The code that I have in my module atm is just to show the form I'm trying to alter

<?php
/**
 * Implements hook_menu_alter().
 */

function [modulename]_enhancements_menu_alter(&$items) {
  $form['modal_window'] = array(
    '#type' => 'fieldset',
    '#title' => t('Modal text and links'),
    '#collapsible' => TRUE,
    '#collapsed' => 0,
    '#weight' => -399,
  );

    $form['modal_window']['login'] = array(
      '#type' => 'text_format',
      '#format' => 'plain_text',
      '#title' => t('Login text'),
      '#default_value' => variable_get('[modulename]_login_text', '[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis a arcu et sem pharetra consectetur. Proin eget lectus neque, quis suscipit lectus. Nullam dictum, massa at sodales porttitor, mi nisi fermentum magna, eu suscipit dui. ]'),
    );

    $form['modal_window']['registration'] = array(
      '#type' => 'text_format',
      '#format' => 'plain_text',
      '#title' => t('Registration text'),
      '#default_value' => variable_get('[modulename]_registration_text', '[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis a arcu et sem pharetra consectetur. Proin eget lectus neque, quis suscipit lectus. Nullam dictum, massa at sodales porttitor, mi nisi fermentum magna, eu suscipit dui.]'),
    );
}
?>

The module has something like this going on with it
<?php
/**
 * Implements hook_menu().
 */
function [modulename]_menu() {
  $items['admin/config/services/[modulename]'] = array(
    'type' => MENU_NORMAL_ITEM,
    'title' => '[modulename] Settings',
    'access arguments' => array('administer [modulename]'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('[modulename]_admin_form'),
    'description' => '[modulename] Configuration.',
    'file' => '[modulename].admin.inc',
  );
?>

and here's the [modulename].admin.inc
<?php
/**
 * Form builder for the [modulename] administration form.
 */
function [modulename]_admin_form($form, &$form_state) {
  global $user, $base_path;
  include_once DRUPAL_ROOT . '/' . 'modules/user/user.pages.inc';
  module_load_include('inc', '[modulename]');
  $capabilities = [modulename]_get_capabilities();
  $form = array();

   $form['[modulename]_debug'] = array(
    '#type' => 'checkbox',
    '#title' => t('[modulename] debuging'),
    '#description' => t('Write errors to watchdog'),
    '#default_value'=> variable_get('[modulename]_debug', 0),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#weight' => -401,
  );
?>


texts: Programmatically hide comment and view tabs

texts:
Can you please help me to hide the tabs from the Find/Add/Edit content page?

Is there a way to programmatically hide them?


texts: Content sorted by machine name not title

texts:
I've drupal 8 configured on my server then I created content types. Now When I click Add Content on content page all the content types are sorted by machine name and not by their title.

For e.g I've following content types

Alert

Article

Basic Page

Category Landing Page

TimeLine

Events

Visual Navigation

Here all the items have same machine name except for Category Landing Page as it have machine name of "visual_navigation_landing" therefore when I click add content button on content page their I see the list as following

Alert

Article

Basic Page

TimeLine

Events

Category Landing Page

Visual Navigation

Here you can see "Category Landing Page" is at the bottom with visual navigation, can anyone help with this. I just want to sort this list by title and not machine name

Regards.


texts: Render content from page.tpl.php in ajax callback, without the html.tpl.php

texts:
I am attempting to render an entire page through an ajax callback using either custom javascript or drupals ajax_deliver.  The issue is that it is trying to render the entire page and I simply want it to render what is in a custom page.tpl.php file created.  I have found a solution around this using a $_GET in the html.tpl.php but it seems hacky to me.

Basically I am rendering only the $page variable if a $_GET is set, if not render it as normal.  Is there any functions or way to simply render all the regions in a page, minus what is in the html.tpl.php


texts: Restore drupal commerce cart if paypal payment gets failed

texts:
I want my user to see what he added to his cart after redirecting from paypal, if his/her paypal payment gets failed or user by himself abort/cancel transaction(may be intentionally or by mistake). I want to preserve the state of cart for user.

Right now drupal commerce clears user's cart if payment gets failed.
Please help.


texts:
I want Drupal send me watchdog logs by emails.
I found Logging and alerts 7.x.
But it sends every alert/warning etc. log in a seperate email.
But i want it to gather that entries and send emails.
For example 50-60 entry in an email.

Is it possible by using these settings in that module:
 - Maximum number of allowed consecutive similar email alerts
 - Email alerts should be considered "consecutive" if sent within

Or should i use something else?
Thank you


texts: How to fill select options based on previous select?

texts:
I'm trying to get the hang of Forms'N'Ajax in Drupal 8.

I have a classic problem with my selects in D8:

$form['manufactureYear'] = array(
  '#type' => 'select',
  '#title' => $this->t('Manufacture year'),
  '#options' => $manufactureYears,
  '#required' => TRUE,
  '#ajax' => [
    'callback' => array($this, 'populateDurationYears'),
    'wrapper' => 'edit-loanDurationYears'
  ],
);

Then I have a second select:

$form['loanDurationYears'] = array(
  '#type' => 'select',
  '#title' => $this->t('Loan duration years'),
);

The function populateDurationYears is the one that are killing me. I've tried with the ReplaceCommand in a AjaxResponse, but when I submit the form the loanDurationYears select is empty.

Can somebody help me here?

EDIT:
 - If I change ReplaceCommand with AppendCommand it's almost correct. The code now looks like this:

<select id="edit-loandurationyears" class="form-select" name="loanDurationYears" data-drupal-selector="edit-loandurationyears">
  <div>
    <option value="3">3 years</option>
    <option value="4">4 years</option>
    <option value="5">5 years</option>
    <option value="6">6 years</option>
    <option value="7">7 years</option>
    <option value="8">8 years</option>
    <option value="9">9 years</option>
  </div>
</select>

What's up with that <div>? It messes up the select :-(

EDIT 2:

The populateDurationYears method looks like this:

$response = new AjaxResponse();
if($maxDurationYears != 0) {
  for($i = $minLoanDurationYears-1; $i < $maxDurationYears; $i++) {
    $option .= "<option value='" . (string)($i+1) . "'>" . (string)($i+1) . " år</option>";
  }
  $response->addCommand(new AppendCommand('#edit-loandurationyears', $option));
}
return $response;


texts:
I need to embed the 2nd level menu that show up in my 2nd level page /maintenance

in the next level page /maintenance/add-task

Drupal does not have this kind of setting, I'm looking a lot in the core files to try to figure out the proper API code to embed, one of my attempts:

$block = \Drupal\block\Entity\Block::load('block_modules_menu_second_level');
$variables['menu_second_level'] = \Drupal::entityTypeManager()
  ->getViewBuilder('block')
  ->view($block);

That code is for a simple block, or a custom block.
How to evoke the drupal core menu level 2?

What am I missing?


texts:
I want my custom module pages to be rendered using the admin theme, at the moment they only render using the admin theme for User 1 (see below).

I have a module called mymodule that defines many administrative views. It's setup in the following structure:

function mymodule_menu() {
    return [
        'admin/content/foo'     => ['page callback' => 'handle_foo', /*other opts*/],
        'admin/content/foo/bar' => ['page callback' => 'handle_foobar', /*other opts*/],
        /* list goes on*/
    ];
 }

 function handle_foo() {
    return ['#theme' => 'handle_foo'];
 }

 function theme_handle_foo() {
    /*database logic here, then return compiled html to be rendered. */
    return '<div> I am a foo!</div>';
 }

Say I have 2 users:

User 1: All permissions available(including administration)
User 2: 1 custom permission defined in the module

When logged in as User 1, all pages that follow admin/* are rendered with the drupal admin_theme including mymodule paths.

When logged in as User 2 all of mymodule pages are rendered using the frontend theme.

I've tried using hook_admin_paths but this doesn't work:

function mymodule_admin_paths() {
  return [
    'admin/content/foo'   => TRUE,
    'admin/content/foo/*' => TRUE,
    '/admin/content/foo'  => TRUE,
  ];
}

I have also read on here that any path that follows the admin/* convention should use the admin_theme by default which appears to be true for user 1 but not user 2.

My take on this is that I need to give user 2 some kind of permission, however I don't want them to be able to do anything other than login and access the paths set out in mymodule

(I don't want to use 3rd party modules)


texts: How can i maintain the database for CMS in Bitbucket for a Drupal used website

texts: I am using Drupal 7 for my website development and my question is  How can i maintain a database for a version control system (Bitbucket). is there any best tools/ modules available to do?


texts:
So I have a custom content type where I use an entity reference to store a node and then display it a a teaser on a page.

I now want to achieve a similar thing with a block. I've create a basic block module where it outputs HTML, but now want to allow a user to configure it in admin.

I want to create a select list in the configuration where a user can choose a node of content type 'X' and it will save this preference. Then in the block module view I want to retrieve this value.

How would I go about this?


texts: How can I have a new dropdown for each entity reference added?

texts:
I have a content type with an entity reference to another content type that has over a hundred items. I want to use a dropdown menu to select the entity, since the user won't always know the titles of those entities. However, with so many entities, scrolling through and selecting multiple entities using the Select List widget is not the desired user experience.
Is there a way to make a new field appear per reference, like the autocomplete widget, but with dropdowns?


texts: How to fire Drupal Rule when more than single term (from multi value vocab) is selected

texts:
In this Drupal tutorial - https://www.drupal.org/node/2815377 - the author demonstrates how you can get a rule to fire if you have a field with a vocabulary with terms termA, termB, termC, and termD and you want an Action to fire when termC is selected.
My question is: How do you get the Rule to fire when either termC AND/OR termD is selected?
I have tried an OR conditional group, but it doesn't work.


texts: How to input internal CSS to content items with CKeditor

texts:
Sometimes I don't have time to input css in the stylesheet, so I would like to simply add it directly to the article.

Since content items don't seem to have any  tags when viewing source, the tags get stripped.

How can I get this done, for example:

This is a heading

I have tried to add it inline, and it shows up when editing before saving, but not showing up on front end, only in back end.


texts: Save patch changes after module upgrading

texts:
Am I need to apply patch after every module upgrading? I had a patch, I changed manually handler of views module but yesterday after upgrading Views module I lost all my changes.

Is it possible to apply patch only once?


texts:
I can quite easily add ajax autocomplete properties to a regular textfield using the code below, but it doesn't work when I change the field to type webform_email. Is it possible to do?

function flower_order_form_alter(&$form, &$form_state, $form_id) {
    if ($form_id == 'webform_client_form_68911') {
        //Add autocomplete fields for manager username
        $form['submitted']['name_of_authorising_manager']['#autocomplete_path'] = 'user/autocomplete';
    }
}

Here's the dpr output for the relevant field in the form:

Array
(
    [#type] =&gt; webform_email
    [#title] =&gt; Name of authorising manager:
    [#title_display] =&gt; inline
    [#default_value] =&gt;
    [#required] =&gt; 1
    [#weight] =&gt; 4
    [#description] =&gt;
    [#attributes] =&gt; Array
        (
            [class] =&gt; Array
                (
                    [0] =&gt; email
                )

        )

    [#element_validate] =&gt; Array
        (
            [0] =&gt; _webform_validate_email
        )

    [#theme_wrappers] =&gt; Array
        (
            [0] =&gt; webform_element
        )

    [#translatable] =&gt; Array
        (
            [0] =&gt; title
            [1] =&gt; description
        )

    [#webform_component] =&gt; Array
        (
            [nid] =&gt; 68911
            [cid] =&gt; 18
            [pid] =&gt; 0
            [form_key] =&gt; name_of_authorising_manager
            [name] =&gt; Name of authorising manager:
            [type] =&gt; email
            [value] =&gt;
            [extra] =&gt; Array
                (
                    [title_display] =&gt; inline
                    [private] =&gt; 0
                    [disabled] =&gt; 0
                    [unique] =&gt; 0
                    [width] =&gt;
                    [description] =&gt;
                    [attributes] =&gt; Array
                        (
                        )

                    [conditional_component] =&gt;
                    [conditional_operator] =&gt; =
                    [conditional_values] =&gt;
                )

            [mandatory] =&gt; 1
            [weight] =&gt; 4
            [page_num] =&gt; 1
        )

    [#webform_private] =&gt; 0
    [#validated] =&gt; 1
    [#webform_validated] =&gt;
)


texts: How to normalize / resolve membership ID to all account UID per group_content

texts:
I'm trying to add the owner's membership to every GroupContent. By default ownership is only identified by the Account ID.

It seems a Normalizer and/or custom resolver is necessary. Beyond my struggles to get the correct dependency injection to add my serialization service to my controller, I'm not even sure if this is possible since it seems the $context variable never includes anything related to the URL or parent entity (Group).

So far, I'm basically parsing the group's ID from $_SERVER['REQUEST_URI'] and then SELECT id as memberid from group_content_field_data where type = 'groups-group_membership' AND entity_id = :uid AND gid = :gid.

Could some caching making $_SERVER['REQUEST_URI'] unreliable from within a Normalizer?
How can I add normalize GroupContent to include both the owner's account ID and membership id?


texts: How to embed HTML and CSS in a custom form element?

texts:
This worked in Drupal 7 but isn't in Drupal 8.

$form['covid-19'] = array(
    '#markup' => '
Due to the COVID-19 situation, we will only be purchasing e-books and e-audiobooks at this time. You are welcome to enter your information for print books, DVDs, or CDs, and they will be purchased when the libraries re-open.  Inter-library Loans [loans from outside Yavapai County] are suspended for now.
',
);

I want the div with style info to stay intact so I can just comment it out when the crisis is over. Then I want to leave it there as a placeholder ready for the next crisis.

In this example, the strong tag makes it through but the div does not.

I also tried setting the div info as a #prefix and #suffix but that didn't work either.

Is there a way to do this?

Thank you!


texts: Adding an address to a node's address field programmatically

texts:
I am presenting a form to receive an address.  I want to take the data and add it to a node that has an address field (from the address field module).

Can someone point me in the right direction on how to do that?


texts: Drupal 7 Bartik Menu tabs changed to vertical list - how to reset back to tabs?

texts: I have been working on a Drupal 7 install with the Bartik theme.  Today, the main menu tabs changed to a vertical list on the left side of the page.  I do not know how to reset this.  I checked the theme folder and none of the css files have been changed, so I suspect it is either a module I installed today or something I did when I was working on editing some pages.  Any suggestions would be aprpeciated.


texts:
When adding a hidden secure field to a webform it does not show up in markup. Both for default value and tokens.

  Secure value (allows use of all tokens)

If I choose a hidden element it is present in DOM.

  Hidden element (less secure, changeable via JavaScript)

I have cleared cache several times, rearranged elements with both text fields and normal hidden fields. Those show up, but not the hidden secure ones.

What am I not doing right?

Here's what I'm referring to:


texts:
i want to create new view but every time i make selection like user, content etc. i got this error

  An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging
  information follows. Path: /dru/system/ajax StatusText: Internal
  Server Error ResponseText:  registrar_frameset({ a_id: 48873,       //
  edit this to pass your portfolio ID, drid:
  'as-drid-2416478692338427'});     // edit this to pass your Domain
  Registrant ID


texts: Accessing all taxonomy terms from one specific vocabulary through url

texts:
I want do display all my terms from one vocabulary over drupals pathauto url scheme.
So f.e. I have example.com/taxonomy/term/314 or after pathauto: example.com/screwdriver/slot or example.com/screwdriver/torx. This works good.

But if I visit example.com/screwdriver, this page doesn't exist.

Actually I'm kind of puzzled, that this is not working out of the box. Do I really have to implement a custom module for this?


texts: Manipulate a render array in hook_node_view

texts:
I'm wanting to modify the contents of some fields at display time so looked at hook_node_view(), however, the $build array is not what I'm expecting, if I dump it with var_dump it is thousands of lines long and not in the format I'm expecting a render array to be, it includes all sorts of exciting things like SQL connection objects which are of no use to me but there is no obvious set of elements that I'd be expecting to see given the Drupal documentation. If I drill down the array, I can find the data I need, however, I can't see how to get this sorted in the correct display order.

If I add a simple tweak like

$build['title'] = ['#markup' => "Hello World"];

the node title is rendered correctly as the new value so I know I'm roughly in the right place.

Question, how can I get at the fields collection after extraction from the database and sorting into display order but before it hits the template as I need to be able to make changes at this point as future development will require potential output via differing templates.


texts: Single Image field importing as Multiple Values

texts:
I've created a CSV feed via Views Export that exports out data for a content type. I'm then using Feeds to import that onto another Drupal site.
Everything except the images are working, when I run import it's stating

Failed importing 2 RSS Item items.
The content failed to validate with the following errors:
Image (field_image): Image: this field cannot hold more than 1 values.
Please check your mappings.

The field in question on Site A has a single limited value of 1, and checking the CSV export it's only showing one value, the absolute url of the image on Site A.
I've attempted to use Feeds Tamper and use all the plugins I can think of to fix this, but due to my freshness to Feeds and Feeds Tamper I'm not sure if this is a bug or misconfig on my part. Everything else is importing as expected onto Site B.
How can I get the import running successfully?


texts: Products containing a hyphen or numbers not shown or wrong relevance

texts:
I have an external Apache Solr Server, with Search API and Search API Views.

When we search for ordinary products, they are shown correctly, with the correct descending relevance order.

When we search for a product with the exact name: "Productx-123W"
it is showing in this order (with highlighted terms by search function):

Productx-123D
Productx-123S
Productx-123
Productx-123W

So the exact product name is only shown on the 4th place, while all other products with no hyphens or - in them have the correct displayed order in the results.

It is like the hyphen splits the word in two.

Secondly, I have a product: Product20001w
When I look for this search term: "2000" nothing is shown. It's like the numbers on the end confuse the server.
When I look for "2001w", it shows the right products which have partially this "2001w" in their name.

Anyone knows how to fix this?


texts: How to use metatag:image_src to share images on Facebook using the Service links module?

texts:
Image shared on Facebook via the Service links module is not showing up correctly when shared. I'm using Views with custom template to view this specific content.

Based on the Views configuration I can specify the image to be [metatag:image_src] in the metatag section. I have no idea where this syntax is going to get the image from, because I don't define this anywhere else, in the Views nor the Content type itself.

Another workaround I am looking at is to add a metatag tag in the head section via the hook_html_head_alter(). But I need more guidance on how and where to add this specifically, in detail.

The question about "How to change facebook og:image to post image link?" is not enough information for me.
The issue about Support for facebook "title" and "image_src" meta tags discusses the above.
I don't know how to patch using Allow Views meta tags to "Use replacement tokens from the first row".

I'm still digging through Drupal and no experience in module creation.

Anyone can point me to a more detailed solution regarding this issue?

I also created support request Image not showing on facebook share in the Service links module issue queue.


texts:
How do I add a field to all webforms?
I have a website where I'm using webform for surveys and I want that on each survey there will be a field that is the same in all of the nodes/webforms.
Thank you.


texts: Pulling Breadcrumb items from the Menu Link text instead of Title field (D7)

texts:
Some of my pages are pulling text for the last breadcrumb item from the menu link text. The rest of my pages are pulling text for the last breadcrumb item from the Title field. What I want is for all of the breadcrumbs to pull from the menu link text.

I'm using the Menu Breadcrumb module (applied to all of the pages in question) which allows the menu link text of a page to be added to the breadcrumbs, but I do not have this option enabled. My theme (a derivative of Omega) must be what's pulling the text into the breadcrumbs (I hear this is not done by default) because when I do enable the Menu Breadcrumb option I get either the menu link text twice or the menu link text and the Title text (depending on which page I look at).

Those pages pulling the breadcrumb item from the menu link text are of a specific content type which has a panel applied to it. The rest aren't using panels -- this is the main difference I can see which might explain this behavior.

I suppose I could alter the theme to not put the text item in, then enable the feature in Menu Breadcrumb (which behaves correctly), but obviously it is possible to do it the way I want without modifying the theme since it's happening with the panel'd type pages.

Any ideas?

Install Stats:

D7
Derivative of the Omega theme
Context
Panels
Menu Breadcrumb (used on all pages; modified - see post by pschnapp)
Custom Breadcrumb (used only on two types, not the affected types)


texts:
I've successfully used the LDAP Integration module to use LDAP authentication with Drupal. Now I'm trying to create an address book with information from LDAP.

I've tried the following solution:

Changed the ldapdata.module, the part that states which fields can be mapped between LDAP and Drupal (e.g. mail => mail). This fails when I try to add more mappings. I believe this maps to the users table in Drupal, but when I try to add a field to that table and map a LDAP attribute to it, nothing goes into the database. My plan was to then use Table Wizard with Views to create the address book. Using Table Wizard and Views I was able to extract everything I wanted from the users table, but the problem of entering data into the table is still not solved.

If you have any ideas, any at all, I'd really appreciate it.


texts: Adding option to one product in Commerce but not to others of the same product type

texts:
Ok so my situation is I am developing a website for a takeaway / restaurant and there are a number of products that fall under a product type, lets call this starters product type.

One of these products has the option for couscous or rice.

I would rather not have to list this as 2 listings on the menu and instead have it as one with some kind of option either before or after the person has clicked add to cart.

Are there any modules out there which are close to achieving something like this? Most I have found seem to be directed at product types as a whole.


texts:
Here's the issue:

I have a custom content type for the contact page. Twig template: page--node--9.html.twig. When I add blocks to this template, e.g. {{ page.contact-first }}, it breaks. How can I display blocks on it?


texts: Core Search Module in Drupal 7.14 and Hidden Fields

texts: In one of my content types I have a text field for extra zip codes served by clients that I have set to "hidden". My core search module does not seem to be indexing hidden fields. What's the deal?


texts: Added a new field to user profile, how do I set a value for existing users?

texts: I have added a new field to the user profile on my site (i.e. in /admin/config/people/accounts/fields), a boolean value that can be either 0 or 1. Existing users have no value. How can I easily set a value for all existing users?


texts: Gather arbitrary data in feeds xpathparser without mapping it to a field?

texts:
I gather data with the feeds module and xpathparser.

Sample data 1:

<xml>
  <id>1234</id>
</xml>

Sample data 2:

<xml>
  <id>1235</id>
  <ref-id>1234</ref-id>
  <action>delete</action>
</xml>

In the incoming XML data, there are two fields, used to signify an old entry should be deleted. In my feeds Parser->parse(), I have

$this->config['sources']['refid'] = 'XML/ref-id';
$this->config['sources']['action'] = 'XML/action';

which makes the parser get these two data values even if I don't map them to a field. But I can find no way of making this information available to the Processor. I would like to find some way of sticking this data on to the $node, so that in entitySave() I can ignore saving id 1235 and instead delete 1234.


texts:
I need to set up some views that will pull some data from a custom table I created.  Some views will need to pull content the regular way and from my custom table (where I may query for a particular nid, etc.).

How do I do this, or where is a good place to research?


texts: I have used flexslider. How do I change the image size? I have tried changing size of using image style that flexslider creates. It just reduces resolution.


texts: How to programmatically assign/add new groups to the OG in Drupal Commons 6.25

texts:
How to programmatically add new groups to Organic Groups in Drupal Commons 6.25?  I have to do that for approximately 3000 groups. A preliminary test cycle that generates 50 will be the first step.

Which methods are preferable?

http://drupal.org/project/og_massadd
http://drupal.org/node/54979
http://drupal.org/node/1433036
http://drupal.org/project/devel

By the way, the images are stored in sites/default/files/imagecache/group_images_medium/group_images.

Questions that arise

Are the images, and the corresponding paths referenced in the database somewhere?
How can I do the mass-upload of the image and besides that, the mass-creation of groups?
Which tables of the tables of OG are necessary?
Is it enough to take the "og" table itself?

PS: An ongoing attempt with comments for Drupal 6 can be seen here: http://drupal.org/node/79874.


texts: Change icon class in "Add to cart" button

texts:
I am using Drupal 7, Ubercart, and Bootstrap. The default Add to cart button looks like this:

<button id="edit-submit-270" class="node-add-to-cart btn btn-success form-submit" value="Add to cart" name="op" type="submit">

  Add to cart
</button>

How can I change the  class  from glyphicon-plus to glyphicon-shopping-cart?


texts: Domain Access not found page error (with Drupal 8.9.1 and Acquia Dev Desktop)

texts:
I created a fresh Drupal site and I downloaded and installed the Domain Access module.
I created a first subdomain which has the same hostname as the default Drupal host. In my case: multisitedomain.dd:8083. This subdomain works fine.
I created a second subdomain with the following host: sub.multisitedomain.dd:8083. This subdomain does not work and launches a 404 Not Found error when accessing it.
I tried also tried enabling the extension in the cookie domain located in /sites/default/services.yml and to add the extension to etc/hosts and to vhosts.conf as suggested here.
Nothing of this works and the Not Found error still shows up.
What can it be?


texts:
I'm using Views Galleriffic (6.x-1.x-dev) and Node Gallery module and there is an error.

In the Firebug console, my error is shown as:

$("a[rel='history']").live is not a function in line 93 $("a[rel='history']").live('click', function(e) in file view_galleriffic.js

I uploaded jquery.history.js in module view_galleriffic/js/...
my website link :http://demo.dolphin-sch.ir/nagara/fa/galleriffic/95
help me


texts: Why is the "My account" link shown even if it is disabled?

texts:
In "Administration > Structure > Menu," I disabled the "My account" link, but the theme is still showing it.

I took the screenshot after disabling the link, closing the overlay, and clicking the "reload" button of the browser; still the link is show, even if it is disabled.
Why is it happening?

If I disable the "Log out" link that doesn't appear anymore.

Why is the "My account" link so special? More importantly, how can I disable it?


texts: Error using module_invoke_all('requirements', 'runtime') in my custom module

texts:
Why do I get

Additional uncaught exception thrown while handling exception.
Original
Exception: theme() may not be called until all modules are loaded. in theme() (line 920 of C:\wamp\www\test\includes\theme.inc).
Additional
Exception: theme() may not be called until all modules are loaded. in theme() (line 920 of C:\wamp\www\test\includes\theme.inc).

when try to call
    module_invoke_all('requirements', 'runtime')

from my custom module?


texts:
I am looking to sort nodes in a view, but only after the user has selected the sorting value.

So the nodes are currently listed in posting order, but I would like to provide the user to sort by price, but only once selected the price sorting?

Creating a standard sort by price, sets this from the initial page load and does not give the use a chance to see recently posted items.

How could this be achieved?


texts: How to add query parameters in twig using path()?

texts:
I am following the code snippet provided here

{# Link to frontpage view. #} {{ 'View all content'|t }}

{# Link to user entity/profile page. #} {{ 'View user profile'|t }}

{# Link to node page. #} {{ 'View node page'|t }}

https://www.drupal.org/docs/8/theming/twig/functions-in-twig-templates#path

As the function says path($name, $parameters, $options), I want to add a link which has query parameters as shown in below

blue?destination=blue-search&cookie[blue_referrer]=3622&cookie[blue_type]=node

I tried implementing it as follows

Find a Distributor

but it gives an error

  The website encountered an unexpected error. Please try again
  later.Twig_Error_Syntax: An
  array element must be followed by a comma. Unexpected token
  "punctuation" of value ":"
  ("punctuation" expected with value ","). in Twig_TokenStream->expect() (line 124 of /templates/node/node--product.html.twig).
  Twig_ExpressionParser->parseArrayExpression()
  (Line: 205)


texts: Drupal 7 - How do I cache / gzip a webform page?

texts: I have my frontpage as a webform and want to know how I can provide compression to this page as drupal does not cache/gzip a webform page due to the forms. What are some possible solutions to this?


texts:
I have a text field on my site which is becoming a problem.  Users tend to input more text than I had expected.  I need to convert this text field into a long text field.  This is problematic because there is already content.  I'm looking for a way to do the conversion as painlessly as possible.  Here is my current plan:

Create the new long text field
Use a module (probably feeds) to duplicate the data (export, then re-import)
Delete the old text field.

Is this a good idea or is there a better faster one out there?


texts: Role expiration as PHP condition in Panel pane

texts:
I use Ubercart 3 for selling site access through roles. Two weeks before the role expires i want to show a button in a panel pane to enable role renewal by the customer.
There is no visibility condition in Panels to get this done, so i want to use some PHP statement. But i have no idea what this statement should look like. Any clues?


texts: Bartik theme: How to extend text/content below blocks in sidebar 1 and 2

texts:
Am using the Bartik theme on my site. I noticed that whenever i place a block in the sidebar 1 and sidebar 2, all the space below the block becomes 'redundant' (i.e. content is limited to the middle of the page.) All the text on the page becomes restricted to the middle of the page.

Please, is there a way to make the content/text extend below the blocks in side bar 1 or 2?


texts: What are the issues with overriding nodes with views?

texts: I am thinking that I have a couple of content types that views would be better at displaying my content. e.g. If an image field is blank, show this default image (this is only a basic example where a view would be preferred over Drupal's default node. i.e. I want to create a view with the node id as an argument and set the views page path to node/%. Are there any drawbacks to this?


texts: Phone international error in submit form

texts:
I installed the module (international phone) on drupal 8.6 and I display it on my form.
when sending data it gives me an error message and blocks sending data.
The website encountered an unexpected error. Please try again later.
Error: Class 'libphonenumber\PhoneNumberUtil' not found in Drupal\phone_international\Helpers\ValidatingService->isValidNumber() (line 24 of modules/phone_international/src/Helpers/ValidatingService.php).
Drupal\phone_international\Helpers\ValidatingService->isValidNumber('+212670998765') (Line: 74)
Drupal\phone_international\Plugin\Field\FieldWidget\PhoneInternationalDefaultWidget->phoneValidate(Array, Object, Array)
call_user_func_array(Array, Array) (Line: 282)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 238)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 238)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 238)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 238)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'node_candidat_edit_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('node_candidat_edit_form', Array, Object) (Line: 575)
Drupal\Core\Form\FormBuilder->processForm('node_candidat_edit_form', Array, Object) (Line: 318)
Drupal\Core\Form\FormBuilder->buildForm('node_candidat_edit_form', Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)


texts: How can I PUT a new file to a node using services 3 without overwriting the existing file?

texts:
Using Services 3 I have it working fine to add a file using

endpoint/file
{"uid":"1","filesize":"99999","filename":"whatever.bin","file":"BASE64_ENCODED_DATA"}

and also to add a node with that file using

endpoint/node
{"title":"testrest1","type":"dl","field_dl_file":{"und":[{"fid":582}]},"uid":"1","language":"und"}

But how can I add a new file to the node? When doing PUT

endpoint/node/999
{"field_dl_file":{"und":[{"fid":999}]},"uid":1,"language":"und"}

It just overwrites the existing file. Trying to POST gives a whole bunch of errors.


texts: How to configure Workbench to allow author to publish own content without moderation?

texts:
I have author role for creating content. This content is moderated by moderators. Now I would like to add second role super author. Super author can published his own content without moderation. How should I configure Workbench for this?

EDIT

There is a WB Access permission for this:

  Bypass moderation restrictions


texts: Custom VBO Action only works when enqueued (Adding User Role and Organic Group)

texts:
I wrote a custom module to add a VBO action that allows an Admin of a group to search the sites users, add them to their list (adds a role to the select users to get them on the list) and then allows the Admin to optionally add the user to an organic group they also may admin. The role is added just fine, but the organic group won't 'stick' unless I enqueue the operation. When I don't enqueue the operation, I dpm'ed the call to og_group and it's returning a membership object and claims it was successful, but it clearly didn't save. I don't have any errors or notices in the logs either.
Here's my setup for saving the group/user relationship:

$values = array(
        'entity_type' => 'user',
        'entity' => $user,
        );

og_group('node', $group->nid, $values);

$user is a fully loaded user account and $group is the group node. I tried adding name_field and the group audience to the values array, but this made no difference.

Here's the hook for the VBO:

function vbo_users_to_groups_action_info() {
 return array(
   'vbo_users_to_groups_my_custom_action' => array(
   'type' => 'user',
   'label' => t('Add users to Pro List and optional Group'),
   'behavior' => array('changes_property'),
   'configurable' => TRUE,
   'vbo_configurable' => FALSE,
   'triggers' => array('any'),
   ),
  );
}

Is there anything else you need to see that may be causing this?


texts:
i am new to Drupal and i want to implement training / seminar program in my Drupal site. I want to know how to implement the following features:

The administrator will be creating a seminar / training session program from a form in admin panel, with details like name, date and description. How to add a form in admin panel and save its details in a new table in database ? Do i need to create a module here?
The training sessions and seminars created by admin can be viewed by the users in the front end with a scrollbar div block. How to show this information in front end ?
When they click on the name of a program in the block, it will lead to a separate screen, where the user can view the program details (name, date and description) and a button to register... how to create a new screen in drupal?
When the user clicks on register button, he will be enrolled in the program (saved in database with inactive status). Now the admin must be able to view the programs he created, in admin panel, and when he clicks on a program name, the registered users in that program will appear. Then he can click on a user's name and a small screen to 'Accept' him in the program and save his status to 1 in the database. How to implement this ?

Basically i want to know how to create forms in Drupal and how can i show them in the front end. Any help is appreciated.


texts: What is the correct procedure to copy (transfer) a whole Drupal web with database to a web-hosting service? What are the problems that could occur? I'd like to change only the website name from localhost to domainname. It seems that everything else will be the same. I'm using Ubuntu and Drupal 7.0, Apache, Mysql. Should I consider the operating system of web-hosting and their server, database and similar things?


texts: creating "live search" from database text field in Profile Content field Drupal 6

texts:
I'm new to Drupal development. I have inherited a Drupal 6 site. I would like to add to the content-profile fields a "live search" text field that will give the user options from a database based on the letters typed. I already have the following:

Database
Profile field with onkeyup function in the .js file.
Function that gets the correct values from the database
any number of tutorials that explain how to use ajax for connecting the onkeyup function and the database query.

What I don't understand is how to put the search results into the "allowed values" of the text field? All the examples define an additional < div > to put the results in. Here it's part of the text field. What code should be in the allowed values so that it will show the correct values? Where to put the retrieved values?

Any help would be appreciated!


texts:
I am following this guide to build a custom node type in Drupal 7:

http://www.sitepoint.com/creating-a-new-drupal-node-type/

Unfortunately, my code is not working and drupal is not outputting any error either. The module is there, is enabled, but the new custom type is not showing up. I have double checked the code several times and I'm sure I wrote it right, the same way of the guide.

How can I debug this kind of issue? I have installed the debug module, I am looking at the documentation here:

http://ratatosk.net/drupal/tutorials/debugging-drupal.html

but I'm a bit lost on where exactly should I up the debugging code to find the issue. I was hoping drupal has some kind of error log (like wordpress does) where I can see anything that goes wrong.

EDIT: I made the custom type work, now I can make a new custom type, but the code about the custom fields is ignored, like it's not there. Here the source of productcustomtype.install:

<?php
/**
 * Implements hook_install().
 */
function productcustomtype_install() {
    node_types_rebuild();
    $types = node_type_get_types();
    node_add_body_field($types['product']);
    productcustomtype_add_custom_fields();
}
/**
 * Implements hook_uninstall().
 */
function productcustomtype_uninstall() {
    $ournewtype = 'product';
    $sql = 'SELECT nid FROM {node} n WHERE n.type = :type';
    $result = db_query($sql, array(':type' => $ournewtype));
    $nodeids = array();
    foreach ($result as $row) {
        $nodeids[] = $row->nid;
    }
    node_delete_multiple($nodeids);
    productcustomtype_delete_custom_fields();
    node_type_delete($ournewtype);
    field_purge_batch(500);
}

function productcustomtype_delete_custom_fields() {
    foreach (array_keys(_productcustomtype_installed_fields()) as $field) {
        field_delete_field($field);
    }
    $instances = field_info_instances('node', 'product');
    foreach ($instances as $instance_name => $fieldinstance) {
        field_delete_instance($fieldinstance);
    }
}

function _productcustomtype_installed_fields() {
    $t = get_t();
    return array(
        'productcustomtype_price' => array(
            'field_name' => 'productcustomtype_price',
            'label' => $t('Price of the product'),
            'type' => 'text'
        ),
        'productcustomtype_quantity' => array(
            'field_name' => 'productcustomtype_quantity',
            'label' => $t('Quantity of the product'),
            'type' => 'text'
        )
    );
}

function _productcustomtype_installed_instances() {
    $t = get_t();
    return array(
        'productcustomtype_price' => array(
            'field_name' => 'productcustomtype_price',
            'type' => 'text',
            'label' => $t('Price of the product'),
            'widget' => array(
                'type' => 'text_textfield'
            ),
            'display' => array(
                'example_node_list' => array(
                    'label' => $t('Price of the product'),
                    'type' => 'text'
                )
            )
        ),
        'productcustomtype_quantity' => array(
            'field_name' => 'productcustomtype_quantity',
            'type' => 'text',
            'label' => $t('Quantity of the product'),
            'widget' => array(
                'type' => 'text_textfield'
            ),
            'display' => array(
                'example_node_list' => array(
                    'label' => $t('Quantity of the product'),
                    'type' => 'text'
                )
            )
        )
    );
}
function productcustomtype_add_custom_fields() {
    foreach (_productcustomtype_installed_fields() as $field) {
        field_create_field($field);
    }
    foreach (_productcustomtype_installed_instances() as $fieldinstance) {
        $fieldinstance['entity_type'] = 'node';
        $fieldinstance['bundle'] = 'product';
        print_r($fieldinstance);
        field_create_instance($fieldinstance);
    }
}


texts:
I know to right now Drupal 7 is stable since almost a year but the truth is Drupal needs third party modules for satisfy the requirements of almost any site

Yesterday i tried jump to drupal 7 but the first thing to i see is to many of modules are betas, releases candidates and a lot  haven't a version for D7.

and many of this modules are essentials, modules like Ctools, panels,  references,  context, all of these modules are pretty useful and none of them have a stable version for drupal 7

So my question is,  Drupal 7 is  ready for a bigger site than a blog?  how many of you use drupal 7 with unstable modules for a client's sites?

How risky is use non stable modules in drupal 7?


texts: Views PHP - Filter by field on node authored by current user

texts:
On my D7 site, when a user creates an account, a single node of a particular type (TYPE A PROFILE) is created for them, and they then edit it and complete a 'Minimum acceptable value' field.  There are also TYPE B PROFILE nodes, which have a 'Value' field.

I've created a view of all the TYPE B PROFILE nodes, and need to display only the nodes where the 'Value' is greater than or equal to the 'Minimum acceptable value' of the TYPE A PROFILE node authored by the currently logged in user (that's a mouthful!).

I'm trying to accomplish this with a Views PHP filter with the following code, and would really appreciate some guidance!

FILTER CODE:

global $user;
$uid = $user->uid;
// Get all nodes from user that are of type_a_profile and are published
$query = new EntityFieldQuery();
$query
  ->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'type_a_profile')
  ->propertyCondition('status', 1)
  ->propertyCondition('uid', $uid)
  ->fieldCondition('field_min_value', 'value', 'NULL', '!='); //'Minimum acceptable value' is not null

$result = $query->execute();
$nids = array_keys($result['node']);

$nodes = node_load_multiple($nids);
foreach ($nodes as $node) {
  $nid = $node->nid;
  $min_value = $node->field_min_value;
}
if ($min_value >= $data->field_value) {
  return true;
}

Couple questions: 1) How can I load just one node (as there will only be one).  2) Am I calling the field properly ($min_value = $node->field_min_value;).

Finally, the main question, should this work?  Or is there a better way to do this?

Thanks in advance for any help!


texts: Is there a way to pass multiple arguments to menu_name while creating menu links programmatically?

texts:
Am using Drupal 7.
Below is my code where am trying to create menu links programmatically:

$links[] = array(
'menu_name' => 'management',
'link_path' => 'myheader/config',
'link_title' => 'Header Settings',
'options' => array(),
'weight' => 2,
'parent' => 'custom/header-settings',
);
$links[] = array(
'menu_name' => 'mycustommenu',
'link_path' => 'myheader/config',
'link_title' => 'Header Settings',
'options' => array(),
'weight' => 2,
'parent' => 'custom/header-settings',
);

In the above code, only menu_name is different. Rest of them are same. Is there a way to pass multiple arguments to menu_name?


texts:
I have a unique need to log all attempts, with timestamps, by all users to access nodes of a given content type in Drupal 8/9.
We wish to use our existing Drupal site to collect submissions of proposals from potential vendors, and there is a restriction that no one internally is able to view those submissions until after the close date of our invitation.  If there is a way to handle that construct, that is acceptable, but it sounds complicated.
The alternative (and the subject of this message) is that we find a way to audit access to specific nodes, so that if someone is reviewing our purchasing or evaluation processes, we can run a report that shows when each user accessed the node and verify that no one has accessed the node since its creation.
Note that these nodes will only be viewed by one small and specific user group and this is the only content type that would need to be tracked in such a way; there would only be a handful of users and a handful of nodes involved.


texts: Where Can I find the output of the debug() function displayed?

texts: I have written debug() in a php file in my local Drupal project. I am trying to see the output. How do I do that?


texts: How can I keep the current language prefix for internal link?

texts:
If the links are menu items the destinations of the links are always with the language inherited from the previous pages. But how can I do the same thing for the internal links using ordinal  tags?  I have some internal links in some blocks but those links can't keep the language prefix the use is currently viewing of.
For example:

 takes the user to my-site.com/about-us though the user is currently viewing the page with the language prefix "jp" which is Japanese. But I would like to make the destination of the link to my-site.com/jp/about-us.

I've been searching for the solution for days but no luck so far. I have tried pathfilter and pathologic but they don't seem to work for this purpose.


texts:
Quite simply the ckeditor table dialogue defaults to a table width of 500, yes the client should be told to delete that value, but I would like to alter the default table width value programmatically to 100%.

I have found other posts like this but in Drupal 8 land where do I do this?


texts: Getting the pretty url for a node if it's a term

texts:
I'm using 'pretty urls' with autopath for my nodes so example.com/node-name but I'm having trouble getting that in the context of a term page.

So on the node template itself I'm doing:

 if ( arg(1) == 'term') {
      //do stuff
 }

To get the link to the nodes page:

<a href="<?php echo $base_url . '/node/' . $node->nid; ?>" class="btn btn-primary" role="button">View details &raquo;

But this takes me to the node number url so example.com/node/23 or something like that. I would like the nice url. When I var_dump $node all I can get to build a url is the id, any ideas? Preferably something in the code, I like controlling stuff in the templates if I can.


texts:
We use Drupal Commerce. Products in our catalogue have various colors and we have a filter for that. I don't want to see one product in ALL colors on the product list page, but only in one; say black.

When I apply the filter to 'white', I want to see all the products in white. Ideally, without the page reload.

Our catalogue is made with the Views module.

How can I achieve this?


texts: When Using Views Group By - Programmatically move a grouping to the end

texts:
I've got a Apache Solr Views display where I'm using "Group By" to group the results by a particular taxonomy term.  I'm then sorting the results so the taxonomy terms appear in ascending (alphabetical) order.

It works fine with one exception:  If the row doesn't have anything assigned for the particular vocabulary I'm grouping by, those items appear first, they are sorted "Before A" in my alphabetical sort.  So, if sorting the terms alphabetically, the 'no term' results are first in the View (because apparently NULL is alphabetically before 'A').

What I want is the terms sorted alphabetically with the 'no term' items LAST.

I mention it's a Solr View because I thought about using the weight of the terms instead of alphabetically (for more control), however relationships don't work in Solr views at all, so that's not an option because I can't get the term weight data.

I think I need to alter the View result programmatically to change the sort order of the 'no term' items and move them to the end of any results, but I can't figure out an effective place to hook in and do it.

Therefore my question is:  To manually move some items from a 'group by' view to the end of the list, Which views hook should I use?  In that hook, how do I pull out any 'no term' items and put them as the LAST visible results in the view?


texts: OK to have multiple media queries for each content type's CSS?

texts:
Im making a responsive site and im using SASS. Im using the zen theme but any theme that outputted a body class based on the content type (of the page you are on) would be in the same situation.

I started creating media queries and trying to put my css code for all the different content type pages within each one. For this demo code there are 2 content types, but in reality sites are more complicated.

As a result my code soon become difficult to read and I lost the ability to put a break point exactly where I wanted it, eg content-type-A might need one a 700px, but content-type-B might need one at 750px.

@media all and (min-width: 960px) {
    body.content-type-a {
     // styles here
    }
    body.content-type-b {
        // Styles here
    }
}
@media all and (min-width: 500px) and (max-width: 959px) {
    body.content-type-a {
        // styles here
    }
    body.content-type-b {
        // Styles here
    }
}
@media all and (max-width: 499px) {
    body.content-type-a {
         // styles here
    }
    body.content-type-b {
        // Styles here
    }
}

So im thinking that this is a better way to organise media queries. Ive organised the css file by content type, and then put the media queries for that content type's page only. This means that for each page I know where to look for the code being used. It also makes it easy for me put breakpoints exactly where I want them.

// Content type A
@media all and (min-width: 960px) {
    body.content-type-a {
        // styles here
        }
}
@media all and (min-width: 500px) and (max-width: 959px) {
   body.content-type-a {
        // styles here
    }
}
@media all and (max-width: 499px) {
        body.content-type-a {
        // styles here
        }
}

// Content type B
@media all and (min-width: 960px) {
        body.content-type-b {
        // styles here
        }
}
@media all and (min-width: 650px) and (max-width: 959px) {
    body.content-type-b {
             // styles here
        }
}
@media all and (max-width: 649px) {
    body.content-type-b {
             // styles here
        }
}

This does mean that I will probably have multiple but separate media queries with the same breakpoint, is there any issue in this? This seems to me like a really logical way to work but no tutorial or screencast ive seen does things in this way. Are there issues I havnt considered? Does anyone work in this way?


texts:
Creating real estate website, i have a lot of exposed filters.
For year when the object is built i have number field which in views is as exposed filter.
When user makes input he puts year 1961 for example.

User searching in exposed filter writes 1961 and filter is set up like "equal or higher" so he gets all objects made 1961 and higher. Works fine.

But i have a problem with floors.
For floors i have vocabulary:
ground floor
1
2
3
4
etc..
attic

I cant use number field because of ground floor and attic so i had to use taxonomy.
But now i cant use equal or higer as exposed filter so if user picks number 3 he only gets appartments with 3 floors.


texts: Specify ids for a migration yml file from nested json array

texts:
Given following jsons file

{
  "data": {
    "uuid": {
      "value": "ed64784-cjjhd6",
      "patient": false
    },
    "name": {
      "value": "Name",
      "patient": false
    },

how to select the uuid value and set it as ids in the migratin definition yml file?

here is my migration yml file:
I really don't know how to select the value of the uuid as ids

id: migrate_json_file
label: Migrate content from local json file
source:
  plugin: source_url
  data_fetcher_plugin: file
  data_parser_plugin: json
  urls: data/data.json

  ids:
    value:
      selector: uuid/value
      type: string
  item_selector: /data
  fields:
  - name: uuid
    label: 'uuid'
    selector: uuid

  - name: title
    label: 'title'
    selector: name

destination:
  plugin: entity:node

  process:
    type:
      plugin: default_value
      bundle: produkt

    title: name
    field_uuid: uuid

  sticky:
    plugin: default_value
    default_value: 0
    uid:
      plugin: default_value
      default_value: 0

    migration_dependencies:
      required: {}
      optional: {}

    dependencies:
      enforced:
        module:
        - migration_json_file

Thank you in advance

Sincerely

Hermann


texts: Block caching when access-restricted modules are enabled

texts:
We have a module that creates a custom navigation block. It runs a metric ton of queries, and it's really affecting performance. (Note that I inherited this site; I did not write this code!)

We want to cache the block, but the built-in block caching (admin/settings/performance) is greyed-out, with a message below that says block caching is inactive when modules defining content access restrictions are enabled. We do have several modules that have access restrictions, and cannot disable those.

Is there any other way to cache the navigation block? I know about the BLOCK_CACHE_* constants, but am assuming that the built-in block caching needs to be turned on, and that those constants modify the default behavior. If we can't turn on the built-in caching, what (if anything) can we do?


texts: How to change the user-profile.tpl.php file to a customized outline like Linkedin for Drupal 7?

texts:
I'm using Drupal 7.9 for an internal website. I'm trying to customize the "user-profile.tpl.php" file so it shows the fields that I've customized in the "admin/config/people/accounts/fields" to be shown below:

<<>>image block on the left<<>>

"Full Name
Job Title/Position

Your Organization Name Here, INC
1234 Your Address Here
Long City Name, ST 12345

(P) 555-123-1234
(E) emailaddress@somecompany.com"

But I'm having an issue writing the PHP in the "user-profile.tpl.php" file (I didn't touch the user-profile-category.tpl.php or the user-profile-item.tpl.php files)

This is what I've coded, which obviously is printing everything out wrong.

    <?php if ($user_picture): ?>

        <?php print $user_picture; ?>

    <?php endif; ?>

<?php print render($user_profile['field_profile_full_name']) ?>

<?php print render($user_profile['field_profile_job_title']) ?>

<?php print render($user_profile['field_profile_organization']) ?>

<?php print render($user_profile['field_profile_address']) ?>

<?php print render($user_profile['field_profile_city']) ?>, <?php print render($user_profile['field_profile_state']) ?> <?php print render($user_profile['field_profile_zip_code']) ?>

(P)<?php print render($user_profile['field_profile_business_phone']) ?>

(E)<?php print render($user_profile['field_profile_e_mail_address']) ?>

When it prints on the page, everything still has a bunch of page breaks and space in between the info. And the address line isn't included in one block, it puts it on a new line each item.

How do I write the code so I can get the format outlined above?


texts: Searching way to **not** send mail after user registration

texts:
I want user from a certain domain to be able to register without approval, while others need te be approved by a user manager.

I defined a rule that after a new user registers, through text comparison on the user's mail address, checking if it is from the "safe" domain, unblocks the user. This works very well, but Drupal will send both the mails:
 - welcome, pending approval and
 - your account has been approved.

Is there a way to achieve that the welcome, pending approval mail is not sent?

Is there a way using rules where you can rule out Drupal actions, like saying: "When this happens, do not take that action?"


texts: Commerce Product generate Preview on Add Product page

texts:
I want to add a Preview button in Commerce Product Add form. Before adding product, user can see Preview of Product same as Product Display/Detail page.

I am using Rules to create Product Display after saving Product.

I have added below code in form_alter hook but  :

//Add Preview

function mymodule_form_alter(&$form, &$form_state, $form_id) {
 if ($form_id == 'commerce_product_ui_product_form') {
       $form['actions']['preview'] = array(
          '#type' => 'submit',
          '#value' => t('Preview'),
          '#weight' => 10,
          '#submit' => array('product_preview'),
        );

        // Some special stuff when previewing a node.
        if (isset($form_state['node_preview'])) {
          $form['#prefix'] = $form_state['node_preview'];
          $node->in_preview = TRUE;
        }
        else {
          unset($node->in_preview);
        }
  }
}

function product_preview($form, &$form_state, $node) {
  module_load_include('inc', 'node', 'node.pages');
  $node = new stdClass();
  $node->field_product['und'][0]['product_id'] = $productId;
  $node->title = 'test';
  $node->uid = 2;
  $node->type = 'commerceproduct';
  $node->in_preview = TRUE;
  $form_state['node'] = $node;

  node_form_build_preview($form, $form_state);
}

Above code displays preview for edit but problem is in node object i am getting $node->field_product['und'][0]['product_id'] value not whole Product object. So any updated value of product form fields won't be reflected in preview.

I am not sure how to build whole product object within node object.

Can anyone tell me what is missing here ?


texts:
While opening a block link in the backend, I get the following error:

  Fatal error: Cannot redeclare l2464256() (previously declared in C:\wamp\www\xxx\modules\block\block.tpl.php:1) in C:\wamp\www\xxx\modules\block\block.tpl.php on line 1

Why does this happen? How can I fix it?


texts:
I'm using the Feeds Module to import Twitter Tweets as Nodes. As long as I start the import manually via www.yourdrupal.com/import everything works fine. But I want the Feed importer to start automatically every hour. Cron is activated, but nothing gets imported. I get an error on the statuspage "Token and secret MUST be string values."

My Feed import settings:

Protokoll Log:

Feeds Log:

Debugging Info: "No channels ready to be executed, skipping cron."


texts:
I have created rules component with some custom fields fc_home_city,fc_pin, fc_loan. When I am trying to execute then asking to fill text box value of fc_home, fc_pin and fc_loan manually I have attached screen shot below. I want to pass all the variables value from my database and calculate user points according to what he had fill in my custom registration form . How I will do it with custom code? Is any idea?

Ex:

In screen attached below after rules execution asking HOME CITY value but I want to pass Home city value from our end with custom code.

Thanks

Thanks