texts: Jquery.on method returns undefined is not a function

texts:
My goal was to create a simple button which once clicked would hide/show a navigational menu, and change the footer's padding alternatively, I'd have used toggle if not for the latter condition. Before I inserted .on() I just had the .click() method with a if/else, which only worked for the first click, so I added .on to solve the problem. Unfortunately it doesn't work, each time the console prints 'Uncaught TypeError: undefined is not a function'. Any help, suggestions, or alternatives, will be much appreciated.

(function ($, Drupal){
Drupal.behaviors.footerCollapse = {
    attach : function() {
        function collapseOrCondense(event){
            if($('#block-panels-mini-footer-nice-menu:visible')){
            $('#footer').css({'padding-bottom':'2.5%'});
            $('#block-panels-mini-footer-nice-menu').hide();
         }
          else{
            $('#footer').css({'padding-bottom':'5.5%'});
            $('#block-panels-mini-footer-nice-menu').show();
          }
        };
        $('#footer').append('<button type=button class=cbutton>*</button>');
        $('#footer .cbutton').css({'position':'absolute', 'left':'1%', 'top':'1%', 'width':'2%','height':'1.5%'});
PROBLEM: $('#footer .cbutton').on('click',collapseOrCondense);
  }
 }
})(jQuery, Drupal);


texts: How should I validate field values against an external service?

texts:
I am looking at how to update a module that validates field values against an external service. Currently, it uses hook_form_alter().

I assumed I should:

Write a service that handles external communications and returns a Boolean value
Write a Constraint and a ConstraintValidator class that uses the service
Attach the ConstraintValidator object in hook_form_alter()

I assumed I would find a similar implementations in the code of the ReCaptcha or ReCaptcha V3 module. Neither of them uses that approach. I found the Field Validator module that is using constraints.

Is using a constraint validator the correct way, or are there other approaches?


texts: "Error: Undefined class constant 'Symfony\Component\DependencyInjection\ContainerInterface::SCOPE_CONTAINER'"

texts:
I am using drush 8.1.2 and drupal 8.1.

I ran composer update in /core as well as in the project root.  From what I can see it updates /core/vendor as well as /vendor (in project root).

Obviously this means that many of the libraries are duplicated; I am not sure if this is the idea.

Anyhow, when execute any drush command from /sites/default I get the following error:

  Error: Undefined class constant 'Symfony\Component\DependencyInjection\ContainerInterface::SCOPE_CONTAINER' in
  /myproject/core/lib/Drupal/Core/DependencyInjection/Container.php, line 16

If I open core/lib/Drupal/Core/DependencyInjection/Container.php in my IDE (PHPStorm), the IDE tells me there are multiple definitions for Symfony\Component\DependencyInjection\ContainerInterface, which is fair enough because there is one in core/vendor as well as vendor (in the project root).

Either way, the versions of Symfony\Component\DependencyInjection\ContainerInterface is exactly the same (version 2.8.6)

According to this post, it is important that they are the same, which they are, and the class constant is defined in both files.

I get the impression, the file is not being 'auto-loaded', but I do not know enough about Drupal 8 to figure out if it is or not.

For the record, when I open the project in my browser (hit the web site), it is working fine.

So the drush / drupal boot-strap process is not working.

Any ideas where to start looking please.


texts: RESTws POST List (text) field type Error

texts:
I'm using RESTws and POSTing a JSON object to "/node". Everything works fine until I include a List text field (checkbox type). The field in question is:

...
"field_days_closed_v": ["Monday", "Tuesday"],
...

When I post I get this error:

  Recoverable fatal error: Argument 2 passed to RestWSBaseFormat::getResourceReferenceValue()
      must be of the type array, string given, called in .../restws/restws.formats.inc on line 278 and defined in RestWSBaseFormat->getResourceReferenceValue() line 311

My JSON is:

{
  "body": {
    "format": "filtered_html",
    "summary": "",
    "value": "test"
  },
  "field_opening_times_t": {
    "format": "filtered_html",
    "value": "Daily"
  },
  "field_price_category": "",
  "field_price_text_t": {
    "format": "filtered_html",
    "value": "
Free entry
"
  },
  "title": "Mark test test test",
  "type": "primary_article"
}

The field is a List(text) and the widget type is Check boxes/radio buttons. Values are:

Monday|Monday
Tuesday|Tuesday
Wednesday|Wednesday
Thursday|Thursday
Friday|Friday
Saturday|Saturday
Sunday|Sunday

Am I right in thinking it is just an array that should be POSTed?

Any ideas?


texts:
I've just copied my drupal website from local to server, everything is fine except the url of the site is http://www.mydrupalsite.com/mydrupalsite.com/index.php (although there is no folder named mydrupalsite.com)

The server directories and files are like this:

root

.htaccess
mydrupalsite.com

index.php
other drupal files...
.htaccess (drupal one)

myothersite.com

...

I don't think the root htaccess file has something to do with it, because myothersite.com has no problems with it. Is it possible that the .htaccess file of the drupal is causing it? If so, how to prevent it?

I made some changes and tried this in root .htaccess, but it still doesn't work:

RewriteEngine on
RewriteOptions MaxRedirects=2
RewriteCond %{HTTP_HOST} ^([a-zA-Z0-9]+).([a-zA-Z0-9-]+).([a-zA-Z]+)$
RewriteCond %{QUERY_STRING} !^(.*)redirect=1(.*)$ [NC]
RewriteRule ^(.*)$ /%2.%3/$1?redirect=1&%{QUERY_STRING}

To sum it up, I found out that this structure has been created by previous admin and should not be changed (as there are two domains). I guess the problem could be solved by removing the /mydrupalsite.com/ when present in url with .htaccess somehow, but finally I've been said it does not matter, so I left it as it is.


texts: How to write big updation code using Batch API?

texts:
I am writing a script to update all website registered user's Username & Email address. I have more then 5000+ users in my website which causes PHP execution time out error.

So I tried to implement Batch API but I am unable to implement it. I passed whole user list to Batch API and perform operations on it. But Batch API also shows the same PHP time out error.

Can someone help me to implement Batch API?

Here is my code:

function anonymize_data_menu() {
  $items = array();
  $items['admin/config/content/anonymize-user-data'] = array(
    'title' => 'Anonymize User Data',
    'description' => 'Click this link to anonymize user data',
    'type' => MENU_LOCAL_ACTION,
    'page callback' => '_anonymize_users_data',
    'access arguments' => array('administer user anonymize'),
    'file' => 'anonymize_data.user.inc',
  );
  return $items;
}

function _anonymize_users_data() {
  $users = entity_load('user');
  $chunks = array_chunk($users, 20);
  $count_user = count($chunks);

  foreach ($chunks as $chunk) {
     $operations[] =  array('user_anonymize_op', array($chunk));
      //user_anonymize_op($chunk);
     //krumo($chunk);
  }
  $batch = array(
    'operations' => $operations,
    'title' => t('Import batch'),
    'init_message' => t('Initializing'),
    'error_message' => t('An error occurred'),
    'finished' => 'user_anonymize_op_finished'
  );
  batch_set($batch);
  batch_process('admin/people');
}

function user_anonymize_op($users, &$context) {
  foreach ($users as $user) {
    # code...
    //krumo($user);
   $context['message'] = t('processing user @user', array('@user' => $user->name));
    //
      if($user->uid != 0 && $user->uid != 1) {
      $user->name = $i . '-' . $user->name;
      $user->pass = user_hash_password('blah');
      user_save($user);
    }
  }
}

function user_anonymize_op_finished($success, $results, $operations) {
  if ($success) {
    $message = count($results) . ' processed.';
  }
  drupal_set_message(t($message));
}

I am very confused about that how to process chunk of users.

Can someone help me it will be great.


texts:
Assume we have two entity types with a 1:n relationship, e.g. an Event type that has a number of Participants that belong to that type. I have implemented this such that Participant has an entity_reference field that specifies the Event.

Now I would like to change the dependent (Participant) entity's add_form route, so that I can easily add Participants to an Event:

@ContentEntityType(
    id = "participant",
// ...
  links = {
    "add-form" = "/admin/structure/event/{event}/participants/add",
// ...
  },

I've managed to make this work on the AddForm. But now I get lots of routing errors like this in other places (such as when deleting a participant entity):

  Symfony\Component\Routing\Exception\MissingMandatoryParametersException:
  Some mandatory parameters are missing ("event") to generate a URL for
  route "entity.participant.add_form".

The add_form route comes from DefaultHtmlRouteProvider. I've tried overriding it with a static route that includes a default value:

entity.participant.add_form:
  path: '/admin/structure/event/{event}/participant/add'
  defaults:
    _title: 'Add participant'
    _entity_form: participant.add
    event: NULL

but this doesn't work – page not found.

What would be the best way to supply a default value, or is there a better way to handle this kind of entity relationship?


texts: Change Field Order of Content Type in the database

texts:
I'm using drupal 7.  The drag drop interface to re-order fields for a content type seems to be buggy.  When I ADD a new Content, i noticed that Translation Settings is always appearing in the middle of my custom defined fields.   I go to Structure>Content Type>MyContent to re-arrange my fields, but no matter how I sort the fields, when I go back to Add My Content, Translation Settings always appears between the 27th and 28th custom defined field.

So I'm thinking of making this change in the database somewhere.  Does anyone know which tables I should be looking at?


texts: Is there a way to exclude the addthis module's output in the $content variable?

texts: The $content variable in my node.tpl.php file outputs some CCK field content, the content body, five star content, and the add this content. I don't want it to show add this content. Is there a way to override the $content variable to make it not show add this content? I can't do this by editing the addthis module's settings, because I invoked the add this in another place.


texts: How can I recover from a backup but include many changes from a dynamic site?

texts:
After the Drupageddon disaster, I've discovered that my backup plan is not sufficient. I have daily, weekly, monthly and yearly DB and file backups thanks to backup_migrate and backup_migrate_prune, but my site is a dynamic one with many users making posts daily. So I was able to easily find a DB backup from pre-Oct 15th to restore to, but I had no easy way to incorporate the thousands of legitimate changes that had occurred on the site since then.

I recognize that it's probably too late for this time, but I'm thinking about how to make sure I'm not screwed in the future. Is there any good method to accomplish this sort of thing? A module that logs all database transactions so they can be individually inspected and reapplied if they're deemed legitimate? Or anything at all better than either loosing weeks of user data or doing a manual diff of the current and known-good databases and praying that I didn't miss something?


texts:
I'm unable to delete a custom entity. I'm getting the following error

$storage_handler = \Drupal::entityTypeManager()->getStorage("notification_storage");
$notification_entities = $storage_handler->loadMultiple($notifications['notification']);
$storage_handler->delete($notification_entities);

  Symfony\Component\Routing\Exception\RouteNotFoundException : Route "entity.notification_storage.canonical" does not exist. dans Drupal\Core\Routing\RouteProvider->getRouteByName() (ligne 202 de /var/www/html/docroot/core/lib/Drupal/Core/Routing/RouteProvider.php).

/**
 * Define NotificationStorage entity.
 *
 * @package Drupal\notification\Entity
 *
 * @ContentEntityType(
 *   id = "notification_storage",
 *   label = @Translation("Notification Storage"),
 *   handlers = {
 *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
 *     "list_builder" = "Drupal\notification\Controller\NotificationStorageListBuilder",
 *     "views_data" = "Drupal\notification\NotificationViewsData"
 *   },
 *   base_table = "notification_storage",
 *   entity_keys = {
 *    "id" = "id",
 *    "uuid" = "uuid",
 *    "langcode" = "langcode"
 *   },
 *   fieldable = TRUE,
 *   links = {
 *     "canonical" = "/admin/notification_storage/list"
 *   },
 *   field_ui_base_route = "notification_storage.settings"
 * )
 */


texts:
I have a block view that I am placing in every page containing the content type "class". There are several "lesson" content types referencing it through entity reference "field_class".

I want the view to display all lessons referencing the class.

I set my view up like so:

When I pass the args through it, it displays correctly, as in the first image.

When I go to the same page whose node id I passed through the view preview to get a correct output, I find that the page is displaying something different:

The result showing is the "no results" default summary.

Can anyone tell me what I'm doing wrong, or suggest advice to clear up the problem?

I'm using drupal 7. To place the block in the page I'm using panelizer.
I'm not using any internationalization modules

Any help would be greatly appreciated.

EDIT:

Here is the screenshot of my contextual filter:


texts:
I would like to ask about finding a particular module on Drupal. I need to add "Zoom", "Print", and "Save" functionalities.

I am sure there must be a module to handle this. Is there any solution about which module I should use? For your information, I am using Drupal 7 and need to add the functionality to Views page.


texts: how to `absolute` position an image over another image?

texts: I want to position an image over to appear over another image at a fix position, even if that other image changes its location due to resizing of the browser window. My URL: http://spabc.com/drupal/ and I want to have the orange arrow over the "Offers & Packages" tile on fix position, on the top left corner. How can I achieve this?


texts: Call drupal_add_js and drupal_add_library in ctools modal callback

texts:
I am trying to load yandex.maps on ctools modal, and i need to pass map settings to js and load yandex.api js libraries inside modal. But somehow drupal_add_js and drupal_add_library doesn't work inside ctools modal callback. How can make them work inside my callback? Here is my testing code:

function carroza_user_page_show_map($carroza_user, $js = NULL) {
  if (!$js) {
    drupal_access_denied();
  }

  ctools_include('modal');
  ctools_include('ajax');

  $carroza_user = carroza_user_load($carroza_user->carroza_uid);

  $id = 'ymap-carroza-user';
  $coords = $carroza_user->field_yamap['und'][0]['coords'];
  $type = $carroza_user->field_yamap['und'][0]['type'];
  $placemarks = $carroza_user->field_yamap['und'][0]['placemarks'];
  $lines = $carroza_user->field_yamap['und'][0]['lines'];
  $polygons = $carroza_user->field_yamap['und'][0]['polygons'];
  $routes = $carroza_user->field_yamap['und'][0]['routes'];

  $coords = drupal_json_decode($coords);

  $map = array(
    'init' => array(
      'center' => $coords['center'],
      'zoom' => $coords['zoom'],
      'type' => $type,
      'behaviors' => array('scrollZoom', 'dblClickZoom', 'drag'),
    ),
    'controls' => TRUE,
    'traffic' => TRUE,
    'placemarks' => drupal_json_decode($placemarks),
    'lines' => drupal_json_decode($lines),
    'polygons' => drupal_json_decode($polygons),
    'routes' => drupal_json_decode($routes),
    'edit' => FALSE,
  );

  //These lines are not being called
  drupal_add_js(array('yamaps' => array($id => $map)), 'setting');
  drupal_add_library('yamaps', 'yamaps.full');

  $output = '
&nbsp;
';
  $commands[] = ctools_modal_command_display(t('Карта проезда'), $output);
  print ajax_render($commands);
  drupal_exit();
}


texts: How can I check whether cck field's content is changed in node_update hook?

texts:
I want to check whether cck field's content is changed in node_update

I tried the same with following conditions but it gave me incorrect result.

if($node->field_event_type['und'][0]['value'] == $node->original->field_event_type['und'][0]['value']){
   echo "same";
}else{
   echo "changed"
}

Thanks.


texts:
I have a custom module that, among other things, shows the user of a certain role. I want some of the users in this tableselect, do already be checked and I have and arry with these uids.

Now, how do I chedk default values in my list? See code below:

$companies = 'mail1@test.org,test2@test.org';
$uids = array();
$comp_mail = explode(',', $companies);
foreach ($comp_mail as $mail) {
    $uids[] = db_query("SELECT uid FROM {users} WHERE mail = '$mail'")->fetchField();
}

$form['msg']['accounts'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options,
    '#default_value' => in_array($uids),
    '#empty' => 'no companies',
);


texts: Should I be using node_load() rather than building my own queries with db_select()?

texts:
I'm fairly comfortable with using Drupal 7 functions like db_select(). While node_load() is obviously very easy to use, I often find that it returns fields I don't need and doesn't provide fields that I do need (field that would require some joins to obtain).

Therefore, will building my own queries provide better performance than using node_load() in conjunction with other queries? Or is there some kind of performance boost that results from using node_load(), perhaps from cacheing, etc.?

I'm far from an expert on MySQL performance issues, but it seems to me that constructing a single, specific query is better than using multiple queries that individually only retrieve part of what I ultimately need (and a lot of what I don't).


texts: How can I get my module to see the current language my user is using?

texts:
When I use Node::load(10)->toArray() I see that my module thinks that the current language is English. I have the language key (fr) in the url and when I place \Drupal::languageManager()->getCurrentLanguage()->getId() in my code it says (fr). How can I get Node::load(10) to see the current language the user is using?

When I translate the content type into another language, all translations of the same page seem to have the same id to place into the load function.


texts: Is there a way to cancel a node deletion using rules?

texts:
I have a node type that represents a phone call.  The user can schedule a call, then record notes about the call.  I want to give the user the ability to deleted these call nodes, but only if the call has not happened yet.  Is there a way to review a call node (using rules) the cancel the delete operation if specific criteria fail?

This could also be used to make an "Are you sure?" option for node deletes.


texts: How to create an Ecommerce Loyalty scheme for customers?

texts:
How can I create a 'loyalty scheme' where customers are awarded with 5 pence for every £ spent, to be used on furture purchases. The rewards will be saved up until the user decides to redeem them against an order.

I have looked for a few solutions but cannot seem to find a way to make this work.

Any suggestions?


texts: Order nodes based on entity reference filter

texts:
In my Drupal 7 website I have an A content type with an entity reference 'parent' field which I use to link to nodes of a B content type.

I have to implement a way to sort A nodes basing on their B parent.

Modules such as Nodeorder and Nodequeue (smartnodequeue) can achieve this with term references. Is there any way to sort them based on entity references without creating vocabularies and term reference fields? I would prefer a draggable solution.


texts:
I have what I thought would be an obvious question but after searching for an answer I can't find anything even close.

I would like a way in Drupal to let authenticated users "tag" existing site content by selecting from one of 12 available categories. (They won't need to add any of their own categories.)

The tags they associate with individual nodes should be stored in a separate table with their uid, the nid and the tid they selected. Later this can be used to show tag distributions for nodes, but that's not immediately needed.

What's the best way to do this? The users will of course not have edit permissions on the nodes, they just need to be able to tag them.


texts:
The JavaScript files for my theme aren't loading. What am I missing?

My theme.info.yml:

name: theme
type: theme
description: Custom theme.
core: 8.x
base theme: classy
version: 8.x-1.0
libraries:
  - theme/global-styling
#stylesheets-remove:
#  - '@classy/css/components/tabs.css'
#  - core/assets/vendor/normalize-css/normalize.css
regions:
  logo: 'Logo'
  navigation: 'Navigation'
  slider: 'Slider'
  content: Content  # the content region is required
  contact: 'Contact (Content Top)'
  testimonials: 'Testimonials'
  call-to-action: 'Call To Action'
  footer_logo: 'Footer logo'
  footer_first: 'Footer first'
  footer_second: 'Footer second'
  footer_third: 'Footer third'
  footer_copyright: 'Footer Copyright'
regions_hidden:
  - sidebar_first

My theme.libraries.yml:

global-styling:
  version: 1.x
  css:
    theme:
      css/animate.css: {}
      css/bootstrap.css: {}
      css/et-line-icons.css: {}
      css/font-awesome.min.css: {}
      css/extralayers.css: {}
      css/settings.css: {}
      css/magnific-popup.css: {}
      css/owl.carousel.css: {}
      css/owl.transitions.css: {}
      css/full-slider.css: {}
      css/text-effect.css: {}
      css/menu-hamburger.css: {}
      css/style.css: {}
      css/responsive.css: {}
      css/custom.css: {}
      //vjs.zencdn.net/5.8.8/video-js.css: { type: external }
  js:
    //vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js: { type: external, minified: true }
    js/modernizr.js: {}
    js/bootstrap.js: {}
    js/bootstrap-hover-dropdown.js: {}
    js/jquery.easing.1.3.js: {}
    js/skrollr.min.js: {}
    js/smooth-scroll.js: {}
    js/jquery.appear.js: {}
    js/wow.min.js: {}
    js/page-scroll.js: {}
    js/jquery.easypiechart.js: {}
    js/jquery.parallax-1.1.3.js: {}
    js/jquery.isotope.min.js: {}
    js/owl.carousel.min.js: {}
    js/jquery.magnific-popup.min.js: {}
    js/popup-gallery.js: {}
    js/text-effect.js: {}
    js/jquery.tools.min.js: {}
    js/jquery.revolution.js: {}
    js/counter.js: {}
    js/jquery.countTo.js: {}
    js/jquery.fitvids.js: {}
    js/imagesloaded.pkgd.min.js: {}
    js/classie.js: {}
    js/hamburger-menu.js: {}
    js/main.js: {}
  dependencies:
    - core/jquery
    - core/drupal
    - core/drupalSettings


texts:
I have a form and a field model. In a hook alter, I add ajax callback to a function getMobileorFixed that does some taxonomy computation. Here is the hook_alter
function THEME_form_FORM_ID_alter(&$form, &$form_state) {
    $form['elements']['system_information']['model']['#ajax'] = [
        'callback' => 'getMobileorFixed',
        'event' => 'change',
        'progress' => [
          'type' => 'throbber',
          'message' => t('Loading...'),
        ]
      ];
}

it works. and when I wrote getMobileorFixed it also computes the value:
function getMobileorFixed(array &$form, FormStateInterface $formState){
  $equipment_id = $term_obj->get('field_equipment_type')->target_id;
  $equipment_taxonomy = Drupal::entityTypeManager()->getStorage('taxonomy_term')->load($equipment_id);
  $equipment_type = $equipment_taxonomy->get('name')->value;

    //these 2 lines temporarily add the value to `equipment_type` (#value / #default_value) attributes
  $form['elements']['system_information']['equipment_type']['#value'] = $equipment_type . " (" . $equipment_id . ")";
  $form['elements']['system_information']['equipment_type']['#default_value'] = $equipment_type . " (" . $equipment_id . ")";

  //calls a `myAjaxCallback` in my javascript file
  $response = new AjaxResponse();
  $response->addCommand(new InvokeCommand(NULL, 'myAjaxCallback', []));
  return $response;
}

However, later on submission the:
$form['elements']['system_information']['equipment_type']['#value']
$form['elements']['system_information']['equipment_type']['#default_value']

are empty. I am having trouble understanding how to permanently set values even inside callbacks. I thought perhaps passing in the reference variable array &form would change the values once the function returns, but that does not seem to be the case. Any help would be appreciated. thank you.


texts:
I'd like to be able to use tokens with entities, similar to how they work for node right out of the box with core.  However, for whatever reason, entity tokens are not available to me even though I have Entity API and Entity Token enabled.

Is there something that needs configuration?  I see no way to configure Entity Token.


texts: How to add 'add to cart' button to view based on a search index?

texts:
Just got started with search_db and the search_api and facets. I have a view set on an index of my commerce products, but I don't have the option to add the 'add to cart' form as a field. There isn't an option to pull one in from a related field that I can see either. Any help would be appreciated.

thnx


texts: using Ctools modal with form #ajax error NS_ERROR_XPC_BAD_CONVERT_JS

texts:
I'm using ctools modal for my form and now I need to create dependent selects on form.
On first page load all works fine, but when i chose anything in select #ajax callback called and chandes the value of dependent select as needed. But than my ctools modal window is not called on click with error  NS_ERROR_XPC_BAD_CONVERT_JS.
Here is my code part:

function metrics_company_ajax_callback($form, $form_state){
    $result = db_query('select SMTH FROM SMTH where
              id='.$form_state['input']['operator']);
    $company = array();
    foreach ($result as $comp) {
    $company[$comp->nid] = check_plain($comp->title);
    }
    $form['all']['company'] = array(
    '#type' => 'select',
    '#title' => t('Company'),
    '#options' => $company,
    '#prefix' => '
',
    '#suffix' => '
',
    );
    $html = drupal_render($form['all']['company']);
    $commands = array();
    $commands[] = ajax_command_html("#company",$html);
    return array('#type' => 'ajax', '#commands' => $commands);
    }

My form looks like this:

 $form['all']['operator'] = array(
         '#type' => 'select',
               '#title' => t('Operator'),
               '#options' => $opers,
         '#ajax' => array(
           'event' => 'change',
           'callback' => 'metrics_company_ajax_callback',
           'wrapper' => 'company',
         ),

    );
    $form['all']['company'] = array(
         '#type' => 'select',
               '#title' => t('Company'),
               '#options' => $company,
         '#prefix' => '
',
         '#suffix' => '
',
    );
    $form['all']['state'] = array(
         '#type' => 'select',
               '#title' => t('State'),
               '#options' => $state,
    );

On clicking ctools modal link it returns following:

[{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"corolla","theme_token":"mKh_azZMJjL-oFXON65Ul6xXgZwiBzPf19e6mh7xNEk"},"CToolsModal":{"loadingText":"Loading...","closeText":"Close Window","closeImage":"\u003Cimg src=\u0022http:\/\/localhost:8080\/sites\/all\/modules\/ctools\/images

So it goes to another page with ajax response, not opening modal window.
Exact JS error:

NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument arg 0 [nsIDOMDocumentFragment.appendChild]

It happens here in jquery.js:

d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i,

Help is highly appreciated. Thanks


texts: Personal Contact Form granular permissions

texts:
I want to be able to set specific permissions by role for the use of the Personal Contact Form.

Searching drupal.org shows a few modules to work with Contact forms, but none do what I am looking to do, so I'm wondering if I'm overlooking something simple.

What I would like to do:

Role A

Can have own Personal Contact form BUT it is only available to other Authenticated Users
Can access and use Personal Contact form for any other user (Role A or Role B)

Role B

Can have own Personal Contact form available to Anonymous AND Authenticated Users
Can access and use Personal Contact form for any other user (Role A or Role B)

Anonymous Users

Can only access Personal Contact Form for Role B Users, NOT Role A Users.

The idea is that Role B Users have the privilege of allowing the public / anonymous users to contact them via the Personal Contact Form, but all Authenticated Users should be able to contact each other using the form.

Should I do this with the Webform module?
Or is there some permission setting for the Personal Contact Form I am missing?

I don't want it to be binary (either you have a Personal Contact Form or you don't), but I want some types of users to be able to access some other users Personal Contact Form.


texts: How to modify account page adding possibility for a user to chose one of 2 roles

texts:
I have Drupal 7 installed on my WAMP localhost.
I need to add a widget to the account page to allow users to chose 1 of 2 roles (recruiter or applicant). Having chosen one role the user cannot switch back to the other again.
For particular reasons I do not consider possibility to chose role DURING registration.

I have read and searched a lot on this subject recently but have not yet found the solution.
I understand it can be done with the help of hook_form_alter() in a module? Then I need to update the users_roles table

Could you please guide me a bit through the code  or tell me where I can find some examples.

Thank you.

Meanwhile I moved on -  I have created the module with hook_form_alter().
The 2 radiobattons show up on non admin user's page (see attached screenshot).

The code is missing saving to the database and probably validation is also required - I dont know where to go yet.
Looking forward to your comments/corrections of the below code which is far from being professional.

<?php
/*
 * Implements hook_form_alter().
 */
global $user;
if($user->uid !== 1) {
function testpwd_form_alter(&$form, &$form_state, $form_id) {
#   krumo($form_id);

    switch ($form_id) {
        case 'user_profile_form' :

// Adding radiobuttons
            $form['account']['roles']['#type'] = 'radios';
            $form['account']['roles']['#title'] = 'Role';
            $form['account']['roles']['#weight'] = -20;
            $form['account']['roles']['#access'] = true;
            $form['account']['roles']['#default_value'] = '';
            $form['account']['#access'] = true; /*without this Roles do not show up on autheticated
            user's profile page. I think after setting it to TRUE access for the nested elements has also
            changed to TRUE. I need to check what changed and set access to False for some nested elements.  */

            $form['account']['current_pass']['#access'] = false; /*see comment 1 line above.
            Not needed on this page as for changing passwords users are directed to Master site
            (2 sites joined with Bakery sso module).*/

            $form['account']['roles']['#options'][115362423] = 'applicant';
            $form['account']['roles']['#options'][100482362] = 'recruiter';

//To hide Roles options appeared. Where hide() does not work I used unset()
            unset($form['account']['roles']['#options'][30037204]); // admin
            hide($form['account']['roles'][2]); //auth users
            unset($form['account']['roles']['#options'][139881272]);
            unset($form['account']['roles']['#options'][29617163]); //content admin

            krumo($form);

//nice print of arrays
            echo '<pre>', print_r($form, true), '</pre>';
        break;

    }
  }
}


texts:
I'm trying to do an insert query on a external PostgreSQL database with Drupal 8 :

$db->insert('site')
  ->fields([
    'civility' => 'mr',
    'firstname' => 'firstname',
    'lastname' => 'lastname',
  ])
  ->execute();

I got the error :

  SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "public.site"

My site table is in schema "test" not in "public".

For example, if I'm doing a select() on the same table it's working.

How can I tell to insert() to look in "test" schema ?


texts: Any advantage to using Profile2 module vs. custom user account fields?

texts: I'm trying to decide if I should bother messing with the Profile2 module. I need my users to have information like a real name stored and made available for other uses, but I'm not sure if there is an advantage to using the Profile2 module, or if I should just create custom user account fields for whatever I need.


texts: How to print the file description to my twig template?

texts:
I'm trying to figure how I can obtain or print the file description that is uploaded on my node and display on my twig template

So far I have tried {{ file.entity.label }} which only prints the name of the file. I even tried {{ file.entity.value }} or {{ file.entity.title }}.

Here is a sample of the code I have been working on

{% for file in object.entity.field_file %}

    <li>{{ file.entity.label }}  {{ file_url(file.entity.uri.value) }}</li>

{% endfor %}


texts: Can you export a list of registered users who've registered for an event via the registration module?

texts:
Sorry if this is a duplicate. I tried to make sure it wasn't before I posted this.

In Drupal 7, does anyone know if there is "out of the box" functionality (that comes with the Entity Registration module) to export a list of people who've registered for an event via the registration module? Ideally, without using views, etc. Something that an end user/site editor could do.

I had a client ask if that were possible. I couldn't find an answer anywhere else and I've never used it before.


texts: How can I survey anonymous users before they can read content?

texts:
I want to do a survey for all non-logged in users (a webform or something similar) before they can read a certain piece of content. I want authenticated users to not be bothered with it. These surveys will only be for selected pieces of content.

I have been looking around. I can't find a solution for Drupal 7. I'd like to use webform, but I am open to learning about different options.


texts: Advanced forum how to change the html without modifying the core

texts:
I want to change the html for the topics list in Advanced forum module. I use a custom style. I foond that the file which displays the html is

  sites\all\modules\advanced_forum\styles\mystyle\advanced-forum.naked.topic-list-view.tpl.php

If I edit this file the changes are displayed. But I don't want to modify core files in order to be able to upgrade. So I tried to copy this file to my custom style's folder. But the changes are not displayed. Is it possible to change the html without modifying the naked style and if yes how?

Thanks in advance


texts: Apache Solr redirecting updating to view JSON

texts:
as title am using Drupal 6, Views 3 (latest dev) and Apache Solr Views. Not having any error messages, but when I add a filter (or any other content) to the view, and click "add" down below, the page redirects to a page of JSON data - any ideas?

Poor research on my part I'm afraid, am not even sure what a useful set of search terms would be. The View is being updated, if I use the back button, and Save, it appears that the elements are updating... just an annoying UI issue...

EDIT : Looking at Firebug when I click the button, it produces an error

$(this).ajaxSubmit is not a function
[Break On This Error] dataType: 'json'


texts: "init "and "mail" fields in the users table

texts:
What is the difference between the "init" and "email" fields?

mail varchar(64)  User's e-mail address.
init varchar(64)  E-mail address used for initial account creation.


texts: How can I translate Views overridden title?

texts:
I have a dynamic view for different products and I use contextual filters to override the views title based on argument of the URL, Now if page translate that argument has same only language code is changed from the URL so that why page title not changed according to the current language, I want to translate the page title that I override with current language of the website
{{ arguments.type }}

I Override the title using argument type, any method to translate this let me know


texts: Help with Canada Post Shipping Quotes with Ubercart

texts:
Is there someone that can help me with Canada Post Shipping Quotes with Ubercart?  I can't find any documentation on how to set it up.  I've gotten my Canada Post account and I've put all the information into the module, but it's not showing any quotes.  I also have UPS and it's displaying quotes just fine.  I'm not seeing any errors or anything so I'm wondering if I've missed a set up somewhere?  I tried going into the Canada Online setup but quite frankly I don't understand what I'm supposed to do.  Do I have to set up every possible package size for it to work?  How would that reference back to the product?  We sell so many different products that could be a nightmare!!!  If anyone can at least point me in the right direction I would be so grateful!!
Thanks!


texts: Custom Entity field of type long_text not storing values

texts:
I created a entity.

$fields['supplemental'] = BaseFieldDefinition::create('text_long')
                ->setLabel(t('Supplemental'))
                ->setDescription(t('Answer description.'))
                ->setDisplayOptions('view', array(
                    'label' => 'hidden',
                    'type' => 'text_default',
                    'weight' => -3,
                ))
                ->setDisplayOptions('form', array(
                    'type' => 'text_textfield',
                    'weight' => -3,
                ))
                //->setRequired(TRUE)
                ->setDisplayConfigurable('form', TRUE)
                ->setDisplayConfigurable('view', TRUE);

And I'm saving data into this entity's field like

$mcq = Mcq::create(array(
           'supplemental__value' => $value->supplemental,
            'supplemental__format'=>'basic_html',
        ));
$mcq->save();

Issue is all fields gets populated except of type 'text_long'. Am I missing something or there is any other way of populating entity field values.


texts: Rendering nodes and other content compatible with all themes

texts:
With a group of several people we're creating a system for students.

Now, on that system we're going to have all kinds of modules that have output, e.g., content types with information about events, a page with a hierarchy of people and groups.

What is the Drupal way of rendering this output?

I know that rendering should be done by the themes. But the problem is that our users should be able to pick a theme they want. Creating separate output for each of those themes is just unfeasibly hard.


texts:
I installed CKFinder & CKEditor. They work well, and I uploaded the images. But I must give users the ability to upload pdf-s. When I try to do it through the image button uploading form, it says: "Invalid file extension.".

In /ckfinder/config.php I found this code:

$config['ResourceType'][] = Array(
        'name' => 'Files',              // Single quotes not allowed
        'url' => $baseUrl . 'files',
        'directory' => $baseDir . 'files',
        'maxSize' => 0,
        'allowedExtensions' => '7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip',
        'deniedExtensions' => '');

I created the files dir under $baseDir, but it still doesn't work. What to do?


texts: How do I target Ajax Loader Throbber in CSS?

texts:
I recently installed Ajax Loader and it working great. However, I need some custom styling so, I can display the loading throbber in the center of the screen.

I can write my own CSS, But can't find the target class of Ajax Loader.

Looking forward for any help on this issue. Thanks in advance


texts:
I have 10 different sites with different databases, each site is for a particular location/country like us.example.com.
And I have a main site (example.com) which will show content from all sites.
Content posted on main site will be visible on a site if address in content is filled with sub site country like USA.

For example I have a content type Projects which has a field for country, now if I add a project on main site example.com and select US as country then this content should now be visible on us.example.com.

So basically I need to share content between multiple sites only for a single content type with some conditions.
Is there any method/article/plugin available to get this done ?

I am trying to write a custom module but not sure from where to start.
I also tried it with feeds (xml files) generated daily but not sure if it is a good approach.


texts: Drupal 8 - url rewrite don't work on beta12 after installation

texts:
I don't have this problem on Drupal Beta 11, but with Beta 12, after installation, urls don't work, example :

The requested URL /Beta12/admin/structure was not found on this server.

Why I have this bug please ? It's a Drupal 12 problem ?
Thanks.


texts: Commerce Line Item Taxonomy Reference Filtered by Product Selection

texts:
Here's the scenario:

I'm selling furniture. I have a chair we'll call Mission Chair.
The Mission Chair comes in oak or maple, both are priced differently. I have a field in my product
I have a product display created which references these 2 products
Customers need to choose 1 of 5 stain colors, but each type of wood has 5 different choices (and they're not the same choices)
The stain choice is required, but does not affect the price.

In my Product Variation Type, I have a term reference field which is referencing a Wood Species vocabulary.

I assume I would create a term reference field on the line item type where they would make the stain color choice. What I need to figure out is how do I do some kind of contextual filter to only show the stains available for the chosen wood species? (which is a taxonomy term on the chosen product - not the display, the product variation)

Should the stains be child terms in the same vocabulary as the wood species, or should it be a separate vocabulary with an additional term field that references a specific wood species (taxonomy reference, the same vocabulary the product variation uses) for each stain color term, and then filter on that somehow?


texts:
i have a test user called "buyer".
he has a profil with the tabs: view - edit - orders - files
i set pathauto for user to: user/[user:name]
when i look at the tab links the as followed:

view: domain/user/buyer
edit: domain/user/82/edit

question: why is that?
if i call the link domain/user/buyer/edit by hand, i get
"You are not authorized to access this page."

any ideas?


texts:
I've been given a directory full of font files (woff2, svg, ttf file types). Is there a way to get these fonts to load when a page is rendered in Drupal? Is there a specific directory I have to put them in or a module that handles custom fonts?

I took a look at the contrib fontyourface module, but it seems to require using external providers instead of being able to upload your own font files.


texts: Load an AJAX submission enabled webform using another AJAX call

texts:
I am using Javascript/AJAX to call a path defined in a custom module which loads existing node content for display.  i.e. you are at:

/custom/path

and it makes an AJAX request to /custom/content with arguments to load the content for the page (placed in #main-content). Content may be a page, video or other custom Content Types.

Custom navigation elements on the page cause further AJAX requests to /custom/content with different arguments to replace the content.

This has worked well until the need to incorporate webform's into the mix.  Due to the non-refreshing nature of the page the webform needs to be loaded, displayed and submitted using AJAX.

I have setup hook_form_alter to add the necessary $form['actions']['submit']['#ajax'] to webforms and they work properly when called directly.  The form submits via AJAX.  However, when they are loaded via AJAX this does not work.  They submit as per normal and navigate away from my desired wrapper page.

I have ensured Drupal.attachBehaviours is being called post AJAX load.  I suspect my problem is in the loading/rendering of the webform in the module, but have not been able to successfully piece it together.  The module serving /custom/content basically does the following:

$node = node_load($node_id);
$output = drupal_render(node_view($task, 'full', NULL));
echo $output;

It displays the webform perfectly (like other content) - it just doesn't implement the #ajax submission part.  I've tried all manner of more specific form buulding for when $node-type = webform but no success.


texts: How to get row weights from a form before saving?

texts:
I have form with an image upload field which saves multiple images. User can reorder and crop images in that form. Reorder using default drag option.

My requirement is to create a PDF of images in current order when user clicks on submit button.
I am taking the image uri from field values by loading node. So the order will be the saved order. I am creating the PDF inside hook_insert.

How do I get the row weights before saving the node, so PDF can be created according to current order of images?


texts: How to create a table-structured content type?

texts:
I am creating a content type which needs to be in table format. The table structure looks like below:

Main title for the table 1:
........................................................
First row with text content     corresponding image here
Second row with text content    corresponding image here

                             Main title for the table 2:
........................................................
corresponding image here    First row with text content
corresponding image here    Second row with text content

Main title for the table 3:
........................................................
First row with text content     corresponding image here
Second row with text content    corresponding image here

When end user want to add new text and image, they should be able to add this content type and a new row should be added underneath. What is the nest way to do this? I am able to create content type and show them on my nodes. I just want to show the content type in table format. Need ideas to get this done! Thanks!


texts: How do I set values for a Boolean field?

texts: I have a content type, I'm trying to add a field that's a boolean. I want the options to be yes or no. This is something I thought would be relatively simple however, I keep getting an error message. I've attached 2 screenshots. 1 is the configuration for my boolean. The other is the error message my site gets. Can someone help me. What am I doing wrong?


texts:
I'm looking for a module to convert emails links to an image in the body field to prevent spam.

The closer I found is this one but it's for drupal 6 and I needed for D7: http://drupal.org/project/email2image

Since I'm using ckeditor maybe there is plugin for this?


texts: Simplest custom button: It shows in admin panel for text format, but not in the editor

texts:
I have followed this tutorial to make simple custom button for CKEditor.
I managed to get it visible in Drupal admin panel and I added my button to admin/config/content/formats/manage/full_html.

When I then edit any node with CKEditor with the appropriate text format (full HTML), I don't see my button.

What am I missing?

Here is the content of the plugin.js file, located in /libraries/blockbutton.

CKEDITOR.plugins.add( 'blockbutton',
{
    init: function( editor )
    {
        editor.addCommand( 'insertTimestamp',
            {
                exec : function( editor )
                {
                    var timestamp = new Date();
                    editor.insertHtml( 'The current date and time is: <em>' + timestamp.toString() + '</em>' );
                }
            });
        editor.ui.addButton( 'Timestamp',
        {
            label: 'Insert Timestamp',
            command: 'insertTimestamp',
            icon: this.path + 'icons/bgcolor.png'
        } );
    }
} );

This is a simple module based on the Color button module.

class BlockButton extends CKEditorPluginBase implements CKEditorPluginConfigurableInterface {

  public function getDependencies(Editor $editor) {
    return ['panelbutton'];
  }

  public function getFile() {
    return 'libraries/blockbutton/plugin.js';
  }

  public function getConfig(Editor $editor) {
    $settings = $editor->getSettings();
    $config = [];
    return $config;
  }

  public function getButtons() {
    return [
      'insertTimestamp' => array(
        'label' => $this->t('insertTimestamp'),
        'image' => 'libraries/blockbutton/icons/textcolor.png',
      )
    ];
  }

  public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
    $settings = $editor->getSettings();
    return $form;
  }

  public function validateInput(array $element, FormStateInterface $form_state) {}
}

Drupal log is clear.


texts:
Hello Drupal community,

I'm trying to develop a customized module that updates the database with some operations on some fields (geocoding an adress field) after an import using feeds. Any idea which hook I should use?

Thanks


texts: Display two Views blocks with equal height

texts:
I have created two Views Blocks "NEWS" and  "BLOG", which resides side by side on my front page.

Both the views have 20 contents (but can be any number) in it and a pager. How do I display contents in views block, so that the both views end up with equal height regardless of number of contents displayed.


texts: how to update quantity of products in the cart via javascript?

texts:
I have the module that changes the quantity of products inside the card via ajax but I need to change it also outside, as on the picture,

the code that changes the quantity after reload of the page are as follows

$variables = array(
        'order' => $order,
        'contents_view' => commerce_embed_view('commerce_cart_block', 'defaults', array($order->order_id), $_GET['q']),
      );
      $count = commerce_line_items_quantity($wrapper->commerce_line_items, commerce_product_line_item_types());

      $quantity = 0;

      foreach ($wrapper->commerce_line_items as $line_item) {
        if (!$line_item instanceof EntityMetadataWrapper) {
          $line_item = entity_metadata_wrapper('commerce_line_item', $line_item);
        }
        $types = array('product');

        if (empty($types) || in_array($line_item->type->value(), $types)) {
          $quantity = $quantity + $line_item->quantity->value();

        }
      }

      $prod_count = t($quantity);

      if ($prod_count > 0){

        $icon = '

'. $count . '';
        $content = '
' . theme('commerce_cart_block', $variables) . '

';
        $content = '
' . $icon . $content . '
';
      }elseif (variable_get('commerce_popup_cart_show_empty_cart', 0) == 1){
        $content = commerce_popup_cart_block_view_get_empty_cart($variables);
      }

The problem is that I don't know how to changes this numbers simultaneously inside and outside the card.

This is the code that changes quantity inside the card

  function _commerce_popup_cart_add_to_cart_ajax_callback($form, $form_state) {
  commerce_cart_add_to_cart_form_submit($form, $form_state); //Call the add to cart form to actually add the product
  $res = _commerce_popup_cart_ajax_cart_reload(); //Retrieve the new cart view

  $commands = array();
  $commands[] = ajax_command_replace("#block-commerce-popup-cart-commerce-popup-cart .cart-empty-block", "

");
  $commands[] = ajax_command_html('#block-commerce-popup-cart-commerce-popup-cart .cart-contents', $res);
  return array('#type' => 'ajax', '#commands' => $commands);
}

function _commerce_popup_cart_ajax_cart_reload() {
  global $user;
  $view_name = 'commerce_cart_block'; // The name of the view we are going to load commerce_cart_block
  $args = array(commerce_cart_order_id($user->uid));  // Array of arguments we set for the view. Only one argument in our example. your actual view may require additional

  //arguments which you may need to set
  $displayId = 'default'; // The display id of for the view.
  // Call the views_embed_view function to returned themed view output
  $res = views_embed_view($view_name, $displayId, $args);
  return $res;
}


texts: How do I programatically add fields to the Media module's field tables?

texts:
I use the Media (ver, 2) module to manage a library of media assets.  It allows reuse of the same media in several nodes and keeps track of media use.

When reusing media (e.g.) images, I want to be able to add different captions (and maybe other metadata) to each use of the same image. I.e.: When I use the same image attached to two different nodes, I want to set the caption for each instance.

There is a great tutorial “How to Add Captions to Images in Drupal” about adding captions – but its approach is to add the caption to the image entity itself. This means that the same caption must be repeated whenever the image is reused.  I want an unique caption for each use instance.

I’ve noticed that version 2 (7.x-2.0-alpha4) of the Media  module manage some metadata (e.g. field_media_description) about each media instance use in the two tables {field_data_field_media} and {field_revision_field_media}. I’ve tried to use the already existing field field_media_description for the caption. This works, and almost does what I want.

However, I want the caption field to be a textarea (not a textfield), and I prefer not to overload some existing field with new functionality (maybe breaking the initial intent for this existing field) - so I want to add another field (field_media_caption) to these tables.

I’ve been digging about the Media module for days, trying to figure out how to add my own fields to these tables, and have not been able to figure it out.

So:
How do I programatically add additional metadata fields to the Media module's field tables?

I will also accept an alternative solution that allows me to use a different module to manage a library of reusable images and add captions fields per use-instance.


texts: Ajax modal does not show for authenticated users

texts:
I'm testing a simple ajax modal link on a Drupal site and figured out that the modal

Search

does only show when logged in as admin. For authenticated users it does not load (it just shows the search page). This is independent of the underlying theme I am using (bartik or a bootstrap subtheme). No error messages or status-reports give any indication what's going on. I thought only for anonymous users ajax needs to be added for the theme dependencies ? What am I missing here ?


texts: What will happen to my existing panels if I reinstall the panels module?

texts: The need is to reinstall panels because of some issues with it. However what will happen to the already existing panels if you reinstall or even remove panels entirely?


texts: How to restrict access to edit image file while still giving permission to edit image title?

texts:
I want to restrict the possibility to edit or delete the image file, but still make it possible for users to edit the alt and title attribute.

What is best approach to do that?


texts: Change submit button to be ajax using jQuery on forget password does not work

texts:
I want to change submit button on forget password to be ajax to display the form as a pop up
I use this validation

jQuery('#user-pass').validate({
        rules:{
            "name":{
                required:true,
                email: true
                }
            },
            submitHandler: function(form){
                jQuery.ajax({
                      type: "POST",
                      url: jQuery("#basPath").val() +"ajax/check-login",
                      data:  jQuery("#user-pass").serialize(),
                      dataType:"html",
                      success: function(msg)
                      {
                        if(msg == "Invalid Email")
                        {
                            return false;
                        }

                        else
                        {
                            jQuery("#user-pass").submit(function() {
                              alert('Handler for .submit() called.');
                              return false;
                            });
                        }
                      }
                 });
            }
        });

but no email is sending
Is this right or I have to make something else (I am using Drupal 7.12)


texts: How do I check a custom field has a value?

texts:
I'm using the "Entity is of type" condition for the After updating content event, the rule only fire when the field has a value of that updated/created node. The field, which is part of a custom content type.

When I select Entity is of type and try to add Entity(Specifies the entity for which to evaluate the condition.) value like [node] and Type(The entity type specified by the condition.) of value like [node:field_alias_1:value]

I got the following error.

  TypeError: Argument 1 passed to Drupal\rules\Plugin\Condition\EntityHasField::doEvaluate() must implement interface Drupal\Core\Entity\FieldableEntityInterface

If the field has the value of that content type, how do I create a new redirect alias using that field name?


texts: How to export field collection with Drupal 7 views data export plugin?

texts:
The Views Data Export plugin appears to work perfectly with the data that I have, though I have a field called "Items Bought" consisting of fields ("Item Bought" and "Cost"). For each content type of type "ShoppingRecord" a user could have one or more "Items Bought" field collections (i.e. Bannana $2, Apple $5).

When I add the field to my "page". I noticed that when I create a view with the "Data Export" and use CSV as the option, I am getting blanks for all the rows in the "Items Bought" column. Is there some way to get the plugin to recognize field collections and maybe export them all into the same field in the CSV? All the other fields that are not field collections appear to export properly.


texts: Chosen Module working on one  but not other selects

texts:
I use drupal 8 and chosen module and I set "Minimum number of options for single select" and "Minimum number of options for multi select" and "Minimum number to show Search on Single Select" to "always apply" .
Now I create advanced searche with views and use 2 filter criteria whit entity refrenced exposed.
When I set one of them setting to dropdown and other to autocomplete , it worke correctly . But when I set all of them settings to dropdown chosen not work .


texts: Customise Drupal 7 Taxonomy View / Template (without module)

texts:
How would I go about changing a custom taxonomy view / template without using a module?

i.e. I have a taxonomy named 'tutorials' which has three posts.

How would I modify the HTML output for 'tutorials?

From what I've heard, you can create a file named 'taxonomy--name.tpl.php' to override the default taxonomy template?

Thanks!


texts: How to make exposed filters more readable in the URL?

texts:
I'm trying to make my URLs a bit more readable (and persistent) which includes query parameters of a view's page. Usually the URL would look like this when I define an exposed filter which is addressed by the parameter vocabulary-foo: https://www.example.com/view?vocabulary-foo[]=1234. As you might have noticed, this is a filter for taxonomy terms of a specific vocabulary. There are two problems with the usage of IDs in the URL, which I'd like to solve:

If I uninstall my custom module that creates the taxonomy terms, these are gone and will get another ID when I install the module again. So I can't assume a link to a specific filtered view page would then still be the same.

It's not readable (and memorizable). Using the term's value instead of the ID would probably already help me. On the other hand, if it is possible to define a query parameter preset=something which translates to vocabulary-foo[]=<The id of the term which has a specific value>, I'd rather do that as it enables me to combine multiple query parameters to one preset, which makes it shorter.

In my specific case, the view exposes a form which can be used to search for content. A preset as described would pre-select some form controls with only one clean URL parameter.
One idea that came to my mind was somehow using PHP's $_GET variable and conditionally changing its content before the view is created. Unfortunately, I don't know which hook would be suitable for that.
Has somebody faced a similar issue in the past? How could I solve these problems in Drupal 9? Thanks!


texts: In my site, I have various fields for user registration along with image captcha. Though I get fake registrations at least 3 per day. I found that "username" and "address" fields are identical by value in all those registrations. Is there any way to deny access to those registrations?.


texts: Module and functions goes missing intermittently

texts:
Looking for ideas as to why a custom module might "go missing" intermittently.

It has been put into production, serves thousands of page views and works well most of the time.  Every now and then it just "seems" to go missing.

Symptoms are:

Fieldable panels pane plugins (declared by the same module) can't
make callbacks to functions within the module, getting "undefined function" errors.
Template files which call functions from the module get the same errors above.
The module declares a hook_menu URL which starts returning 404s.
Form callbacks functions in the module get "not found or invalid
function name in drupal_retrieve_form()"

All of this is intermittent, runs fine for a week, or maybe a couple of hours, then it starts happening.  I clear the caches, sometimes once or twice and it comes back to normal.  There are no errors in the logs that I can see, nothing in watchdog that stands out.

How is it possible for a module and its functions to randomly go missing?


texts:
I would like to edit my html.html.twig template to assign a value to a metatag in <head> according to the value of a field of a page. Is that possible?

I was trying things like {{ page.myfield.value }}, but with no success and haven't found anything helpful online.


texts: How to get node Bundle in hook_form_alter on field config form?

texts:
Can you wonderful people help me out please? I am altering the field config form (content types > plan > manage fields > edit field) and cannot seem to get the proper bundle out. Every time I call the bundle() function it returns the string "field_config". However the bundle is supposed to be "plan". Perhaps it's different because I am on the field config form, and not a node form?

Below is my code, the things I've tried and the field object showing the proper bundle. Does anyone know of another solution for me to get "plan" out?

<?php

use Drupal\Core\Config\Entity\ThirdPartySettingsInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\ContentEntityForm;

/**
 * Implements hook_form_alter().
 */
function rent_plan_custom_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
// print $form_id;

  switch ($form_id) {

    case 'field_config_edit_form':

        print $form['#title'];

        $field = $form_state->getFormObject()->getEntity();
        $field_name = $field->getName();  //returns correct field_plan_purpose

        //first try
        print $field->bundle(); //<---THIS RETURNS "field_config"

        //second try
        $bundle = FALSE;
        if ($form_object = $form_state->getFormObject()) {
            if ($form_object instanceof Drupal\Core\Entity\ContentEntityForm) {
                $bundle = $form_object->getEntity()->bundle();
            } elseif ($form_object instanceof Drupal\field_ui\Form\FieldConfigEditForm) {
                $bundle = $form_object->getEntity()->bundle();
            }
            print $bundle; //<---THIS RETURNS "field_config"
        }

        //Field Object Results Below
        print '<pre>';
        print_r($field);
        print '</pre>';

    break;
  }
}

Results from print_r($field)

Drupal\field\Entity\FieldConfig Object
(
    [deleted:protected] =>
    [fieldStorage:protected] => Drupal\field\Entity\FieldStorageConfig Object
        (
            [id:protected] => node.field_plan_purpose
            [field_name:protected] => field_plan_purpose
            [entity_type:protected] => node
            [type:protected] => text_long
            [module:protected] => text
            [settings:protected] => Array

            ... lots of more stuff
        )

    [id:protected] => node.plan.field_plan_purpose
    [field_name:protected] => field_plan_purpose
    [field_type:protected] => text_long
    [entity_type:protected] => node
    [bundle:protected] => plan
    [label:protected] => Purpose
    [description:protected] =>
    [settings:protected] => Array
        (
        )

    ...lots more stuff
)


texts: Call to a member function getFileUri() on null in ImageItem::presave()

texts:
I have a node migration as part of a D6->D8 migration, and for the image field in the node, I've done a separate files migration, and then in my node migration, I just refer to the files migration to get the destination fid and write that to the image field.

field_image:
  plugin: iterator
  source: field_thumbnail
  process:
    target_id:
      plugin: migration
      migration: file
      source: fid

The problem I'm running into is the error listed in the title. This is the presave() function:

public function preSave() {
  parent::preSave();

  $width = $this->width;
  $height = $this->height;

  // Determine the dimensions if necessary.
  if (empty($width) || empty($height)) {
    $image = \Drupal::service('image.factory')->get($this->entity->getFileUri());
    if ($image->isValid()) {
      $this->width = $image->getWidth();
      $this->height = $image->getHeight();
    }
  }
}

It seems like it's dying because there is no image for that node, because it's dying at this line:

$image = \Drupal::service('image.factory')->get($this->entity->getFileUri());

It works just fine when there is an image for the node. Shouldn't this be skipped if there is no image found in the files migration? Is there a config option in the .yml file I can use to avoid this error?

Thanks.

UPDATE: I found this docs page on the skip_on_empty process plugin, and implemented as suggested on that page:

field_image:
  plugin: iterator
  source: field_thumbnail
    process:
    target_id:
    -
      plugin: migration
      migration: file
      source: fid
    -
      plugin: skip_on_empty
      method: row

but I still get the same error, more than likely because in the pipeline, it's already errored out before it gets to the skip_on_empty plugin. However, if I switch things around:

field_image:
  plugin: iterator
  source: field_thumbnail
    process:
    target_id:
    -
      plugin: skip_on_empty
      method: row
    -
      plugin: migration
      migration: file
      source: fid

Then the entire blog node is skipped if there is no image. How can I just skip trying to migrate the image if there is none?


texts: Smooth Toggle Menu on Bootstrap sub-theme

texts:
I'm using Bootstrap 8.x-3.0-beta2 on Drupal 8.0.1. Originally the menu allow you to expand one at a time. I added the following smooth toggle code for animation effects.

$(function(){
  $('li .dropdown-toggle').click(function() {
       $(this).siblings("ul").slideToggle('slow');
  });
});

The script run very well. It has the smooth animation, but it does not auto collapse when I click on the other menu. I would like to expand the menu one at a time. How can I fix this?

**** Updated on Jan 12th 2016 ******
I have created a development site on Pantheon, which is "http://dev-cocoskin.pantheon.io".


texts: Social Login using oauthconnector fails to display on login form

texts:
I've followed www.drupalcommerce.org/blog/4571/kickstart-tip-1-social-logins-made-simple
to a T, including changing permissions.

I must be missing something silly, as the login options are still not showing up on the login form.

What am I missing?


texts: Style different exposed filter options based on query results

texts:
I have an exposed filter that displays a list of checkboxes. When you select one, I'd like the options that are no longer represented in the query to have a sort of "disabled" look. I could make it work if I could simply apply a class to those options, but I can't find a way to do so.

I've used and edited the views_filters_selective module (a part of views_hacks) and found I can change which options display by overriding the class "views_handler_filter_in_operator" and the function "get_value_options," but I don't seem to have access to the way that Drupal renders the array, nor can I apply any html classes. I think it's due to a misunderstanding of themes (in which I'm inexperienced), but I have no clue where to start.

Should I edit the form which displays the options, or do I have to edit the way that drupal renders the array? If the second is the case: how can I send, from the handler, the information needed to determine which checkboxes should be "disabled?" Where would I start?

This is similar to this question: Exposed filters and how data can be styled which no one answered.


texts: Alias not working for a non default language

texts:
When I create a node in a non default language, I set an alias.  After the node is saved, however, all internal links (e.g. menus) do not use the alias; they all use the node/[nid] link type, and when I navigate to the alias it returns the "page not found" error.

Aliases work fine for the nodes using the default language, and for language neutral nodes.

I enabled the Locale and the Content translation modules.


texts: I'm using drupal 7 and I want to load the view title and header HTML of this view by Its URL. Is IT possible?


texts: How would I use the Field Validation module with Addressfield to make just city and province/state required?

texts:
I have set my addressfeild to be completely optional, however, I want to use the field validation module to ensure they at least fill out city and province/state.

Any thoughts?


texts:
I'm trying to figure out the best way of creating a content type that allows for creating nodes that can be assigned to a group and can be voted for in competition with the other nodes in that group. I started writing a module for it by using the Fields API, Node API and Voting API but I want to check to see if I can use an existing module to do this before I get too far into the project.

For example, I want to create a content type called "contestant" and give the content type 3 different brackets it can be assigned to. Then when I create the contestent content and select one of those brackets, the content becomes votable and is ranked against other pieces of content within that bracket.

Any references to existing modules or suggestions would be awesome.


texts: PAReview.sh error, Expected "switch (...) {\n"; found "switch(...) {\n"

texts:
In my theme's template.php file, I have a custom function as:

function _MYTHEME_content_grid($columns = 1) {

  $class = FALSE;
  switch($columns) {

    // No sidebars, just content.
    case 1:{
      $class = 'grid-100';
      break;
      }

// etc...

When I run the code through http://ventral.org/, I get this message in regard to the switch statement line: switch($columns) {

ERROR | Expected "switch (...) {\n"; found "switch(...) {\n"

I googled around but I can't really find anything on this error. My function works perfectly fine though. I'm guessing it's a syntax error but it would seem weird to insert a ; after the curly brace...


texts: I have a non-Drupal site that has a sign-up form. I'm using the Services module to submit user creation requests via ajax. This works very well. Now I need to add a secondary action that will send a custom email after the user is created. Is there any way to accomplish this? There doesn't seem to be a resource for sending mail.


texts: REST Server with my module service returns 404

texts:
I have set up my drupal REST using REST Server and services. Also I have created my own module which implements hook_services_resources().

I have configured REST with to use my resource and node.

This works:
http://local/rest/node/1

This does not work (returns 404):
http://local/rest/hotel_search

Here is my module:

function MY_MODULE_services_resources() {
    return array(
        'hotel_search' => array(
            'retrieve' => array(
                'help' => 'Search for Hotels',
                'callback' => 'MY_MODULE_hotel_search',
                'access callback' => 'MY_MODULE_access_callback',
                'args' => array(
                    array(
                        'name' => 'name',
                        'description' => 'hotel name',
                        'type' => 'int',
                        'source' => 'param',
                        'optional' => false,
                    ),
                ),
            ),
        ),
    );
}

function MY_MODULE_access_callback() {
    return true;
}

function MY_MODULE_hotel_search() {
    $json = array(
        'name' => 'response',
        'status' => 'ok'
    );
    return json_encode($json);
}


texts:
I am using:

Webform 7.x-3.21
HTML Mail 7.x-2.65

If i set the following option in the backoffice of a specific webform (send e-mail as HTML):

I get the a white page when submitting the form and no e-mail is send.
No white page appears if the option is not checked.

I didn't get any errors in the logging, so i started to dig in the code and saw the process stopped @file webform.module @line 2968 in the _webform_filter_values function. The moment we render the display_element.

$replacements['email'][$format]['%email[' . $form_key . ']'] = render($display_element);

The only thing i can think of is the memory limit being to low. ( can't test it now). Anyone else had this problem ? Thx!


texts: Views with both menu and jump menu taxonomy terms as contextual filters

texts:
I have a page view with a category taxonomy menu and a city jump menu.  I want them to work together so that if the view shows all content and a user clicks on a category in the menu, the view will be fitered by category and if the user chooses a city in the jump menu, the view will be filtered by city.  If a category has already been chosen and the user selects a city, the view should be filtered by both category and city and vice versa.

I know this should be possible but I don't know where to start or what the best way of doing it might be.  If the best solution requires coding, I am capable of doing it.


texts: How to update core and all modules and themes from CLI?

texts:
On a LAMP environment I have a Drupal 8.5.6 website which is nearly all-core with the Bartik theme and a few stable contrib modules. Nothing is customized and I have daily backups so I don't "fear" of updating anything in one go this time.

I tried drush up * but got:

  Command "up" is ambiguous.

I didn't find an update command in Drupal Console documentation.

How could I upgrade all in one go from the CLI?


texts: How do I Send a single mail with Rules and VBO?

texts:
I have a view of nodes that I edit with VBO. I filter this nodes by author. When I edit this nodes I send a mail to author with a rule but I have a problem when I edit more than one nodes with VBO. In fact Rule sends as many email as they are the nodes.

How I can do to send only a single email to the author that I have filtered in the views?

I use Drupal 7.

UPDATE: I've added the rule that I'm using but not works

{ "rules_send_mail_to_owner" : {
"LABEL" : "Send Mail to Owner",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "rules_i18n" ],
"ON" : { "node_update--prenotazione" : { "bundle" : "prenotazione" } },
"DO" : [
  { "variable_add" : {
      "USING" : { "type" : "list\u003Cuser\u003E" },
      "PROVIDE" : { "variable_added" : { "variable_added" : "Added variable" } }
    }
  },
  { "list_add" : {
      "list" : [ "variable-added" ],
      "item" : [ "node:field-proprietario" ],
      "unique" : "1"
    }
  },
  { "LOOP" : {
      "USING" : { "list" : [ "variable-added" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "mail" : {
            "to" : "giupenni78@gmail.com",
            "subject" : "Prova notifica LCS",
            "message" : "Questa \u00e8 una prova\r\n[node:field-proprietario]\t",
            "from" : "info@lowcostsicilia.it",
            "language" : [ "" ]
          }
        }
      ]
    }
  }
]
}
}


texts: Associate a Taxonomy term to user who creates it

texts:
I have field Company Name which is a term reference to a vocabulary with same name. when user types the field if name already exists, so auto complete showed that or else it will be added as taxonomy term. let us consider "BBB" is the company name he entered.

On next scenario when another user keying in this company name as "BBB" so its already their in the taxonomy so i have to send a mail to the user who created added the term "BBB" first.

I tried using rules module but i couldn't find way to get the user who created the term.Meanwhile i use Profile2 module so writing submit handler is best?


texts: How to load jQuery assets before blocks and regions

texts:
I need a jQuery script to load immediately before a certain block shows on my Drupal 8 front page. I'm trying to use the following but I get 'TypeError $ is not a function' in code inspector. Here's my script:

$(document).ready(function() {
  $("#slideshow").zAccordion({
        ...code...
  });
});

The problem is the first line. In Drupal 8 what is the preferred way to write this script to accomplish what I want?


texts: How to send multiple emails after creating a node

texts:
I'm using SMTP module to send e-mail messages after creating nodes. It takes about 3-4 seconds to send each such message using hook_node_insert. So if I want to send 10 messages, then I have to wait for 30-40 seconds for the iteration to complete and then only I get redirected to create new node. It's very slow.

I tried use event KernelEvents::TERMINATE per this article, but it did not speed up the whole process.

Is there a way just to complete creating a node without waiting and immediately proceed to creating a new node, while sending e-mail messages at the same time?

Note: I don't want to create queue and wait for the next cron run to send e-mails. Because e-mails need to be sent instantly after creating respective node


texts: Outlook/gmail Configuration not working in Swiftmailer's smtp?

texts:
I have been using Swift Mailer for sending mail. I have also installed the dependency module and library.

Now, I have been trying to configure the gmail/outlook configuration for Transport Type SMTP in swift mailer.

Gmail :

   Server: smtp.gmail.com
   Port: 465
   Encryption: Use SSL

Outlook :

  Server: smtp.office365.com
   Port: 587
   Encryption: Use TLS

Error is showing like,

  An attempt to send an e-mail message failed.

  Unable to send email. Contact the site administrator if the problem
  persists.

and showing message in green like

  An attempt has been made to send an e-mail to (Email ID of
  gmail/outlook).

Note: Enabled Allow Less Secure Apps Access in gmail settings and these configuration are all trying in my local instance.

How could I solve this ?


texts: hook_form_alter not running if cache enabled

texts:
I have enabled the cache in Administer->Development->Performance. I have changed user profile form using hook_form_alter. But the code inside hook_form_alter strops automatically after few days. I thinks, it may be cache issue.

Everything I did in hook_form_alter is not running. I changed the submit button value. I added a custom Save and Continue button.

My Sample Code is below :

if($form_id == "user_profile_form" && $user->uid == 1) {
    $userid = arg(1);
    if(is_numeric($userid)) {
      drupal_set_message("Current User Id on site: ".$userid);
    }
   }

Attached screenshot :


texts: Which is better approach "taxonomy_get_term" or using SQL to display term name on template file

texts:
I have a View page with term id in its URL as argument and I have found two ways to display term names on Views template file.

One is using taxonomy_get_term(); the other one is querying the database.

$explode_vocubulary=explode("/",$_GET['q']);
$vocubulery1=$explode_vocubulary[1];
$sqlvoc1="SELECT *  FROM `term_data` WHERE `tid` =".$vocubulery1;
$rowvoc1=db_query($sqlvoc1);
while($resultvoc1=db_fetch_object($rowvoc1)) {
  echo  $resultvoc1->name;
}

I'm not a coder and don't understand the difference very well but it seems that using Drupal API seems to be cleaner. What the difference between these two approaches or which is the better way?


texts: Difference Between render($content['body']) and print $body[0]['value']; in node.tpl.php

texts:
What is the difference between render($content['body']); and print $body[0]['value']; in node.tpl.php?

render($content['body']); seems to include all the fields while print $body[0]['value']; includes just the body field.


texts: How to use external JSON API to create/update node's fields?

texts:
I have a content type: siteinfo.

This content type has multiple fields: text, entity reference etc.

I want to use an external API to automatically fill some fields of the created node.

The API I want to use says that:

  API returns consistent and well-structured data in XML & JSON
  format. Returned data contains parsed fields that can easily be
  used by your application. This is a RESTful based API.

And this is the API's output:

{
    "status": 1,
    "api_query": "siteinfo",
    "whois_record": {
        "domain_name": "example.com",
        "query_time": "2016-05-05 14:01:12",
        "create_date": "1995-08-14",
        "update_date": "2015-08-14",
        "expiry_date": "2016-08-13",
        "domain_registrar": {
            "iana_id": 376,
            "registrar_name": "RESERVED-INTERNET ASSIGNED NUMBERS AUTHORITY",
            "whois_server": "whois.iana.org",
            "referral_url": "http://res-dom.iana.org"
        },
        "name_servers": [
            "a.iana-servers.net",
            "b.iana-servers.net"
        ],
    },
}

How can I use this external API?


texts: I'm working on a Drupal 6 project and we've added some fields to a user profile via CCK. What's the best way to update this information programmatically? When the user logs in I'm gathering some data from a 3rd party API that I need to update their user with. I've got the data, but the global $user object doesn't seem to have the extra fields.


texts:
Im using a custom query to display some content.
This query uses url arguments as MySQL variables.

Usually when I create a link with the variables the page does not exist and it returns a 404 error.

Is there a way of creating a page on certain urls to avoid getting an "page not found"?

EDIT:
To be more specific

The query is something like

SELECT * WHERE node.type = '.arg(0).' AND node_data_field_type.field_type = '.arg(1).'

The url intended would be: example.com/exhibition/speacial_feature or
example.com/program/speaker_series

The link exhibition/speacial_feature or program/speaker_series are not found.


texts:
I have in my contact form something like

[gmap markers=big red::40.26041912699509,-3.8385844230651855 |zoom=15 |center=40.26217119406393,-3.840494155883789 |width=300px |height=200px |control=Small |type=Map]

but it doesn´t parse when I put it into the body of a content type


texts:
I must have checked or unchecked a button somewhere, sometime, because ever since I remember starting to work on my site the titles of the pages are showing underneath the articles / texts on the pages, instead of on top of them, like they should. (example: see link to screenshot) I tried the 'manage display' option but I the title isn't part of that with the basic pages.

Does anyone have an idea of how I could fix this? :) For I have no clue...

Screenshot: http://img89.imageshack.us/img89/2140/headerunder.png

(the tags I wanted to use were not available for me so I hope I tagged this right..)


texts: Is there a way to find out how many activated, registered users there are?

texts: I am seeking to track some KPIs for my site, one of which is the number of activated, registered users there are on the site. Is there a way to get this number?


texts: How to dynamic select options each webforms seperately?

texts:
Currently I have a table of records webform (The node identifier of a webform) and a list of users, Associated with the webform table nid
The group has kept a list of users webform's (The node identifier of a webform).

The purpose is to be in accordance with a different view webform to fill a single page, you can automatically bring out the webfrom belong to fill a single page to view a list of users group, the following screen embedded in it, and you want to automate the dynamic select options each webforms seperately, That each webform node page has a list of  dynamic select options users group.

If the user fills again webform view to fill a single page, select a person of a certain list of users, and finally to be able to produce the data stored. To record the value webfrom submit sid and webform nid and selected personnel.

How do I make it?


texts: How to fix my problem when trying to create a Drupal sub-theme with Drush?

texts:
I get the following error when I try to run the "drush fst foundation-subtheme" command.

sh-3.2# drush fst foundation-subtheme
The drush command 'fst foundation-subtheme' could not be found.  Run `drush cache-clear drush`  [error]
to clear the commandfile cache if you have installed new extensions.
Drush was not able to start (bootstrap) the Drupal database.                                    [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a configured database. In this
case you can select another site with a working database setup by specifying the URI to use with
the --uri parameter on the command line. See `drush topic docs-aliases` for details.
 * connect the database through a socket. The socket file may be wrong or the php-cli may have
no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.

Drush was attempting to connect to:

  Drupal version         :  7.32
  Site URI               :  http://default

  Database driver        :  mysql
  Database hostname      :  localhost
  Database port          :  3306
  Database username      :  root
  Database name          :  drupal
  PHP executable         :  /usr/bin/php
  PHP configuration      :
  PHP OS                 :  Darwin
  Drush script           :
  /Users/Marianna/.composer/vendor/drush/drush/drush.php   Drush version
  :  8.1.3                                                    Drush temp
  directory   :  /tmp
  Drush configuration    :
  Drush alias files      :
  Drupal root            :  /Users/Marianna/Documents/Sites/Link-New
  Drupal Settings File   :  sites/default/settings.php
  Site path              :  sites/default

I get the following error when I try to install foundation with drush:

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

Drush was attempting to connect to:

  Drupal version         :  7.32
  Site URI               :  http://linkengineering
  Database driver        :  mysql
  Database hostname      :  localhost
  Database port          :  3306
  Database username      :  root
  Database name          :  drupal
  PHP executable         :  /usr/bin/php
  PHP configuration      :
  PHP OS                 :  Darwin
  Drush script           :
  /Users/Marianna/.composer/vendor/drush/drush/drush.php   Drush version
  :  8.1.3                                                    Drush temp
  directory   :  /tmp
  Drush configuration    :
  Drush alias files      :
  Drupal root            :  /Users/Marianna/Documents/Sites/Link-New
  Drupal Settings File   :  sites/default/settings.php
  Site path              :  sites/default


texts: Handle permission based on both person and role?

texts:
I am using workflow module for a publishing website.

There are many people who have the role reviewer....The comapny want to enable that when you change state from 'in moderation' to 'in-review', we can assign the content to a reviewer through an autocomplete field. NOT ALL reviewers.

Workflow content permissions does a great job, for making it role based. So the author is no longer allowed to edit the article when it is 'in-review' state. Now I don't want to allow all reviewers to edit it 'in-review', only the one that has been selected.

Is there a module for this? If not, how should I be going about this.

P.S. -: I am barely a few weeks into Drupal, so go easy :-)


texts: Drupal config or routes stays inactive until I disable/re-enable related modules

texts:
I know this might be a broad question but maybe someone had the same issue before.

Here is the issue:

I have installed some contributed module, (e.g Rules);
I have configured some rules;
Exported config via drush cex;
Pushed code and tried to import it on another machine or staging
server;
Import via drush cim went successfully, no errors;
I see Rules module enabled from admin UI.
But: no admin menu items related to Rules module show up.
When I try to access Rules related routes I get 404s.
I disable Rules module and re-enable it and now menu items show up and routes start to work.
I run druch cim again to re-import my specific Rules and everything is fine.

So this happens not only for Rules but for every other module, does not matter if it is my custom modules or contributed modules, I have to disable/re-enable/re-config-import in order to make it work on other machines or even on my machine if I just pulled down new changes which I did not have before.


texts: share users or nodes across multiple sites without sharing database

texts:
I have one master drupal site that offers basic functionality for users.(it's a shop); and we have some other sites, for example one news site, one marketplace, one job finding service etc. I want every "spin off" site be a separate site, but users sign up once, then login on each subsite without needing to sign up again. and I want to show nodes of subsites at master site in the user profile. which is the best way of sharing users and contents, since domain access module is not a good option, because we are going to produce lots of data and keeping all data in one database is hard. we want to be able to separate any high traffic spin off in the future, but with domain access, all should be at one database.
what options do I have for sharing users and contents without sharing database?

what I mean is someting like stackexchange that there is no need to sign up anytime. is it possible to do that with OpenID or OAUTH etc?


texts: How do I avoid mydomain.com/node/1 or mydomain.com/node/4 is used?

texts:
I am using the Pathauto module for creating user-friendly and SEO-friendly URLs.
Therefore, I do not want and there is no need that the "old URL" like mydomain.com/node/1 or mydomain.com/node/4 is any longer public. So, how do I hide this and make only the path aliases public?


texts: how to set the author of the feed item to the author of the feed source in feed importer?

texts:
I have created a feed importer.
I do not know how to set the author of the feed item to name of the original author of the feed?
Is there any method to do it?
Or will apply any patch?
Any patch for this functionality will be welcome.


texts:
Using Drupal 8, I want to use registration form outside user/register.

I can generate the user login form but I couldn't find how to get the user.register form.

So my question is, how can I render the user registration form?


texts:
I have a custom module named rsm_library.  I would like to use hook_page_attachment_alter() in rsm_library.module and called the hook as follows:

rsm_library_page_attachment_alter($attachments);

I then issued $ drush cr to clear the caches.

This resulted in:

  AH01071: Got error 'PHP message: Error: Call to undefined function
  rsm_library_page_attachments_alter().


texts: How to set and use direct files folder path in a multisite installation

texts:
Drupal 8 multisite install where

First site is on a subdomain one.example.com
Second site is in a subfolder one.example.com/two

How can files folder for both sites to be accessible via URL/files and not URL/sites/domain/files

current: one.example.com/sites/one.example.com/files
desired: one.example.com/files
current: one.example.com/two/sites/two/files
desired: one.example.com/two/files

I tried several variants listed here https://www.drupal.org/node/53705 and put them at following locations, but nothing worked.

Drupal8/.htaccess
Drupal8/files/.htaccess
Drupal8/sites/two/files/.htaccess

Setup information is provided below

Filesystem setup

--Drupal8
  --index.php
  --one.example.com (sym link ln -s . one.example.com)
  --two (sym link ln -s . two) Not required in D8, but could not get the subfolder site to work without it.
  --sites
    --default (sym links to one.example.com)
    --one.example.com
      --settings.php, services.yml
      --files, modules,etc
    --two
      --settings.php, services.yml
      --files, modules,etc

Sites.php

$sites = [];
$sites['one.example.com'] = 'one.example.com';
$sites['one.example.com.two'] = 'two';

Apache setup : One virtual host for one.example.com


texts: Can payment be done in pop-up rather than using redirect?

texts:
We have an online store with a few hundred products, and we'd like to streamline the checkout & payment process.
Currently our payment processor requires the website to be redirected to their site to make the payment, then the user is redirected back to our site for confirmation.

Instead of redirecting our users to the payment processor's site, can we open the payment processor's site in a popup? I think the popup could either be a separate window (though that might be extra complicated), or as a lightbox (possibly using an iframe).

Does Drupal Commerce support this sort of thing, and is it safe to do or not recommended (as a security risk)?

We're using Drupal 7. Our site is a fairly standard online store.


texts: Difference between drupal_static and \Drupal::state?

texts:
Imagine I have a hard-to-compute value.

$my_heavy_value = compute_heavy_value();

What's the difference, at performance level, between storing the computed value using drupal_static() and using \Drupal::state()?

Which one is stored in the database? Is there one that is stored in memory?


texts: adding javascript to tpl file from template.php

texts:
<?php
drupal_add_js(drupal_get_path('theme', 'mytheme') .'/my_js_file.js', 'theme');
?>

I want to add a javascript file just to the tpl file titled

views-view--gurus--page-1.tpl.php

I have this code to enter it to a specific them but what about just a certain tpl file.

I am guessing something like this

drupal_add_js(drupal_get_path('theme', 'mytheme') .'/my_js_file.js', 'view');


texts:
How can I get rid of the link for registering a new account in the login form/popup?

I want my new users to register through a page but not through the login form.


texts:
I have a field name called 'field_serial_571' that contains an array. I've tried several ways to display it and it only display blank space. I ran a debugging script (printr) and this is what I found:

[field_serial_571] => Array ([und] => Array ([0] => Array ([value] => 1)))

Does anyone know how to display results from a field with an array?


texts:
I'm trying to use the states API in Drupal 8 but I'm having trouble, and I'm also having difficult debugging.

Use case:

On user accounts, I have a taxonomy term reference field called Gender.  The three terms in the taxonomy vocabulary are female, male, and other.

I also have a text field on user accounts called Other.  I want to show this Other field if and only if Gender is set to other (term ID: 27).

Here is the code I'm using:

function mymodule_form_user_register_form_alter(&$form, &$form_state, $form_id) {
  $form['field_gender_other']['#states'] = array('visible' =>
    array('input[name="field-gender"]' => array('value' => '27'),
    ),
  );
}

I based this off of code I used for Drupal 7.  Unfortunately, it's not doing anything.

I looked at StateDemo.php in the fapi submodule of the Examples module for Drupal 8, but that's for building a new form, and I'm trying to modify an existing form.