texts: hook_field_widget_form_alter - modify specified field only

texts:
I'd like to use a hook to modify a widget, but only for a named field.

Use case: a form has an entity reference to another content type, using an options_buttons widget (a list of available courses the user can apply for). Rather than just the title alongside each checkbox, I'd like to display some extra fields from the content type such as date, a URL etc.

The documentation suggests $context['widget'] ("The widget plugin instance.") is the place to look, however a var_dump of that just seems to give me lots of protected properties and no clear way of getting the field name.

Essentially I'm after a D8 version similar to this old example I found:

if ($context['field']['field_name'] != 'field_bannerimage') return;


texts: Which hook is invoked when pressing the remove button with widget image?

texts:
In a content type named "R" there is a image field say "I". When a node with R->I is filled with a image file then standard you can remove this by pressing the remove button.  The standard images widget is used in drupal 7.

When I press this remove button something is executed as I get a message just 2 cm above the field "I" which is displaying the following message:

  content_type_name, content_type_title has been updated.

How do I find out which hook is invoked?


texts:
I follow these steps to achieve the gallery thumbnail in footer
  https://www.drupal.org/node/1497058
  and now my thumbnails shows like below

  but only thing left is when i
  click thumbnail image its open the next page and show the big image
  but i want when i click the thumbnail the big page open on colorbox
  when i click on thumbnail its shown like below


texts: Ajax validation only works when I am logged in as an administrator

texts:
I have created a custom contact form and I have set up an ajax inline validation. My form works very well. But Ajax validation only works when I am connected. When I am not logged in as an administrator, ajax validation does not work.

Also I created a block to display the form in my footer. This form does not appear when I am logged in as an administrator. When I am connected I have access to the form only through the path I defined in module.routing.yml. And when it appears (so when I'm not logged in and I'm just a visitor), Ajax doesn't work on this block form either.

Does anyone have any idea what could cause this?
Please help me.


texts:
I need to select entities with specific dates.

How should the following be formatted. Do I need to parse 15-May-2010

Also how I get the error page.

function events2() {

$query = new EntityFieldQuery();
$query
  ->entityCondition('entity_type', 'node', '=')
  ->propertyCondition('status', 1, '=')
  ->propertyCondition('type', 'event')
  ->propertyCondition('field_event_date', '15-May-2010', '=');

$result = $query->execute();

 return $result;

}


texts: Unclickable Menu link keeps refreshing my page

texts: Hello and sorry for my bad English. I am using Drupal 8 and i want to make a menu with categories. The menu title has to be CATEGORIES and when someone click on it, the menu has to show the categories with a drop down. So i've created categories. Then i created a menu called - CATEGORIES and i marked "show as expanded". In the menu link i added - "route:<nolink>" . So now i have Categories menu with drop down listing categories, but when i click on it, the page is refreshed. I dont whant the page to be refreshed everytime i click on CATEGORIES. I just want to show me the drop down and not refreshing the page... I am using this theme https://www.drupal.org/project/news_zymphonies_theme and if you click on Live demo you can see in main navigation the menu link - "LAYOUT". When you click on it, the menu shows 2 categories - "two sidebar" and "left , right". In my case when i click on LAYOUT will show me this two categories but it will refresh the page too and i dont want to refresh it. How to fix that? Please help me i've readed so many topics and didn't find a solution :(


texts: Views 3, contextual filter on language - allow for multiple languages

texts:
So for this site I'm building I need to be able to do the following.

When user views the site in English show all English articles
When the user views the site in Dutch, show all Dutch articles - but also the untranslated English ones
When the user views the site in German, show all German articles - but also the untranslated English ones.

The contextual filter, 'Content translation: Language' only allows to put in one value. That is either a language specified, or all.

But in my case it would be required to be able to set for instance "en+nl" or "en+de". Like one can do with taxonomy 'Has Taxonomy', I would like something like 'Has Language'.


texts: Disable/Hide buttons in view table based on role

texts:
Is there any way to disable/hide certains buttons/links in a view table based on role?

I want to display admin buttons/links in drupal commerce for all the orders if the user/role is admin, customer buttons/links for customers and vendor buttons/links for vendors.

Image for reference :


texts: Can I use Pathauto with additional url values?

texts:
Is it possible to use pathauto url aliases and still use additional url parameters?

For example, I use pathauto for polls to map "node/123" to "poll/title-of-my-poll".
The poll results are at "node/123/results" but using "poll/title-of-my-poll/results" doesn't work.


texts:
I'm new on Drupal. I try to follow a tuto in order to build my own module.

Drupal 8 (latest version) is installed on MacOS.
For example, I use it through URL : http://localhost/drupal/admin/content

My module is defined like this :

Drupal

code
modules

hello_world

hello_world.info.yml
hello_world.links.menu.yml
hello_world.routing.yml

src

Controller

HelloController.php

...

File content : hello_world.info.yml

name: Hello World Module
description: Creates a page showing "Hello World".
package: Custom
type: module
version: 1.0
core: 8.x

File content : hello_world.routing.yml

hello_world.hello_world:
  path: '/hello'
  defaults:
    _controller: '\Drupal\hello_world\Controller\HelloController::helloWorld'
    _title: 'Hello World'
  requirements:
    _permission: 'access content'

File content : hello_world.links.menu.yml

hello_world.admin:
  title: 'Hello module settings'
  description: 'example of how to make an admin settings page link'
  parent: system.admin_config_development
  route_name: hello_world.hello_world
  weight: 100

File content : HelloController.php

<?php
/**
 * @file
 * Contains \Drupal\hello_world\Controller\HelloController.
 */

namespace Drupal\hello_world\Controller;
use Drupal\Core\Controller\ControllerBase;

/**
 * Defines HelloController class.
 */
class HelloController extends ControllerBase {

  /**
   * Display the markup.
   *
   * @return array
   *   Return markup array.
   */
  public function helloWorld() {
  $output = array();

  $output['hello_world'] = array(
    '#markup' => $this->t('Hello World!'),
  );
  return $output;

  }

}

Regardless "clear cache", I have a page not found !

I try the urls :

http://localhost/drupal/hello
http://localhost/hello

But results are the same. What should be the right url ?
And why I'm getting "page not found", where is the issue ?


texts: Field without Used in data in Fields Report

texts:
I had several fields on content that had an empty Used in in  /admin/reports/fields. Apart from being inelegant :-), it's a real problem because Views doesn't see them properly as belonging to content (and it will probably cause other problems down the line, that's only what was apparent now).

After contemplating different ways to solve it (the field-related commands on Drush are unusable, probably not yet ported), I did it manually in the database with a combination of cloning and replacing. All are done but body because, obviously, the UI doesn't allow me to specify field names without the field prefix.

So, I know that this is probably the result of some settings gone wrong, what actually makes Drupal think a field is used in a type? I couldn't locate the exact setting .yml yet. Storage.node.body.yml and the others actually don't show anything really different for body and all the others that are already correct now.

By the way, not some stale data of cache or drush entup.

I am in Drupal\field_ui\FieldStorageConfigListBuilder right now with a little dump:

if ($field_storage->getName() == 'body' && $entity_type_id != 'block_content') {
  ksm($field_storage->getBundles());
}

It returns an empty array. Khm...


texts: Remove query strings from static resources in template.php

texts:
I've read several articles throughout the web about removing query strings from static resources, in the template.php file, after I saw a recommendation to do so in a forum, for better page-loading time in Drupal.

All of the articles I've seen lacked some didcatance in the following points:

Why should one remove Query strings for better loading times? I've never seen them in any URL of any my site's pages, and, I don't understand why would their appearance in a URL effect in any shape or form the loading time of a site's page (that deals more to image-optimization, bandwidth, etc).
What is a static resource in Drupal? Cache is something dynamic so I'm guessing it's not the cache itself. So what is it?
Where should I put the following code of this JavaScript function, at the start of the file, at the end, or between any special segments? It wasn't clear from none of the articles.

/**
 * Implements template_process_html().
 */
function MYTHEME_process_html(&$variables) {
  $variables['styles'] = preg_replace('/\.css\?.*"/','.css"', $variables['styles']);
}


texts: Drupal 7 - View listing Organic Groups AND content within that group

texts:
I'm trying to create a view that lists all of my Organic Groups on a page AND lists the content within that group. Specifically, I would like to show image fields that have been posted to each group.

Any ideas on how I can achieve this? I can't seem to get the relationships right.

Thank you in advance!


texts:
In my register form email address description is overflow. I know that I have to change theme, but I would like to know where to theme it.

Thanks,


texts: Disable a field for input, without deleting it (to not lose old data)

texts:
I have a field in my customer profile (shipping/billing, doesn't matter which).
I don't need this field anymore on checkout, but I want to keep the data of older orders.
(this can be extended to any entity type, it just happens that commerce customer profile is my use case)

Is it possible to somehow disable the field for input, but not really delete it?

Ideally with a UI solution.
I already know hook_form_alter() would do the trick..


texts: Is there a way to set the pager's page number programmatically without the page being in the url?

texts:
I would like a user who has previously left a comment on a node to initially see the last page of comments while a new user (to that node) will initially see the first page of comments.
I know that the page is controlled by the pager and is set by the "page" variable in the URL ($_GET['page']). Is there a way to set this programmatically?

(Just to clarify, I am not using the Views module on this project.)


texts: User Role creation in module overridden by configuration import

texts:
I'm creating a user Role in a .yml file like user.role.myrole.yml.
This works fine when this module is installed manually and the Role is created.
When I enable this module via configuration import though, only the roles defined in this configuration set are installed and not what is in the config/install folder of that module.
Tried putting that file in config/optional folder and writing a hook_install() for the user creation also with the same results.
I would like to have this only in the module, the module may or not be installed via config, so I need this role only when this module is enabled. How can this be achieved?
Thank you


texts: entitymetadawrapper with field collection multi value

texts:
How can I save multiple values in a multi-value field collection using EntityMetadataWrapper ?

Here's some of my code

$field_collection = entity_create('field_collection_item', array('field_name' => 'MY_FIELD_COLLECTION'));
$field_collection->setHostEntity('commerce_line_item', $line_item);
$wrapper = entity_metadata_wrapper('field_collection_item', $field_collection);

for($delta=0; $delta<$max_delta; $delta++) {
  //MISSING something like $wrapper->setDelta($delta);
  $wrapper->field_example->set($new_value);
  $wrapper->other_field_example->set($new_value);
  $wrapper->save();

}

$field_collection->save();

I'm fighting with the field delta : I can't use $wrapper->field_example[$delta]->set($new_value) because the wrapper itself is the multi-value field, not its children fields.

So I need to find a way to perform something like

$wrapper[$delta]->field_example->set($new_value);

But this returns "Fatal error: Cannot use object of type EntityDrupalWrapper as array".

Summary : where can I set the delta of the wrapper in the loop ?


texts: I am on Drupal 7. I would like to ask if you know of any Drupal modules or tools that will 'spit' (sorry for using this term) an instant documentation of a given Drupal install (Drupal version, installed modules list, installed modules versions and maybe some more information). Thank you!


texts: How do I use the value of a webform_field as the default-value for a later webform_field?

texts:
Is there a way with Drupal 8 Webform UI to set the default value of a text field as the value of an earlier text field in the same form, and update via Ajax?

example:

user_name:
     '#type': textfield
     '#title': 'User Name'

nick_name:
    '#type': textfield
    '#title': 'Nick Name'
    '#default_value': '[webform_submission:values:user_name]'
    '#ajax': true

But the default value does not render the token and just prints plain text.

Any help is much appreciated, thanks.


texts: Implement multiple views-blocks in a custom template page

texts:
I have 3 views-blocks and these blocks should be available with a single url only. Just say example.com/personal-content .

I want to place this blocks in this single URL based on  a custom design.
Like one in the first side bar, another in the second side bar and the third one in the top .

How do I proceed to implement the same.

Please help
Thanks in advance


texts: Howto archive a new response page for a view block with exposed filters?

texts:
In drupal 7 i have created a view with a page and a block.

Inside the views block I have exposed filters. I placed this views block on the frontpage. The exposed filters only work with ajax enabled, otherwise the exposed filters are not visible.

If you use the exposed filters on the front page, ajax will show the results on the front page.

I like to archive to redirect the results to the views page. Where do I need to change the code to tell ajax to use a specific page?

In other words, there are many results, if you use the exposed filters on the frontpage. Thats why I need a redirection to style the results.


texts: Issue with download large file from private_files

texts:
I need to distribute large files (say about 1GB or more) in a private_files sections because I do not want unauthorizes download of those files.

However when downloading a file of 1GB from our server equipped with 785MB RAM the download fails (without any warning) before reaching the end.

Someone suggested to me that when downloading from private_files section the complete file(s) was copied into memory before download starts (which off course will not fit for this size)?

Off course I can increase the RAM size, but then again if 2 people start to download large files, it probably is copied both in RAM ending with same result?

Who have experience with this issue and hopefully suggestions or even better a solution for my issue?


texts:
I am creating a sampler pack of all my products. I have a product display with several node reference fields (not product reference) so that whenever a new product is added, that reference field is updated.

I have Rules set up to automatically price those selections (each selection has a different price).

Now I'm trying to use Rules to update that line item's weight (for use with Commerce UPS). However, I can't seem to find a way to update the weight. Is this possible in Rules? Or am I going about this in the wrong way?


texts:
In the media library, I should see a dropdown selector that allows me to delete bulk items. Is there a way to turn this off and on? I've inherited this site and I'm not sure if the original owner has turned this option off somewhere.

Here is the code that should appear:

        Action
        <select data-drupal-selector="edit-action" id="edit-action" name="action" class="form-select">
          <option value="media_delete_action">Delete media</option>
          <option value="media_publish_action">Publish media</option>
          <option value="media_save_action">Save media</option>
          <option value="media_unpublish_action">Unpublish media</option>
       </select>

  <input data-drupal-selector="edit-submit" type="submit"
      id="edit-submit--2" name="op"
      value="Apply to selected items"
      class="button js-form-submit form-submit" />


texts: How can I debug adding libraries via hooks?

texts:
I am trying to attach simple css via hooks in the themes and it does not work? The code looks correct to me. It doesn't attach. What am i doing wrong?

global-styling:
  version: 8.x
  header: true
  css:
    base:
      css/main.css:

  js:
    js/main.min.js: {}
    js/scrollreveal.js: {attributes: { defer: true} }
    src/js/vendor/picturefill/picturefill.min.js: {attributes: { defer: true} }
    js/custom.js: {attributes: { defer: true, async: true} }
    js/tp.widget.bootstrap.min.js: {attributes: { defer: true} }
    js/js.cookie.min.js: {attributes: { defer: true} }
    js/api.js: {attributes: { defer: true} }

  dependencies:
    - core/drupal
    - core/jquery

content-styling:
  css:
    base:
      css/content.css: {}

carousel-styling:
  css:
    base:
      css/carousel.css: {}

I am trying to attach css/content.css only when an entity reference to a paragraph is displayed.
I am trying to attach css/carousel.css only when an certain paragraph type (slider) is displayed

function porto_sub_preprocess_field(array &$variables, $hook) {

  if(  $variables['element']['#entity_type'] == 'paragraph' ) {
     \Drupal::logger('my_module')->notice('content should be');
        // tried both these on all
        $variables['element']['#attached']['library'][] = 'porto_sub/content-styling';
        $variables['#attached']['library'][] = 'porto_sub/content-styling';
  }
}

function porto_sub_preprocess_paragraph(&$variables) {
  $paragraph = $variables['paragraph'];
  if($paragraph->getParentEntity()->bundle()=='slider') {
    \Drupal::logger('my_module')->notice('carousel should be');
    $variables['element']['#attached']['library'][] = 'porto_sub/carousel-styling';

  }
}

Then i tried....still nothing

function porto_sub_page_attachments(array &$attachments) {
      $attachments['#attached']['library'][] = 'porto_sub/content-styling';
    $attachments['#attached']['library'][] = 'porto_sub/carousel-styling';

x    }

Is there some way i can debug? I get no information regarding what's wrong here.


texts: Print rendered field in views-view.html.twig

texts:
I try to render a custom node field in a views-view.html.twig and it works, the only thing is that i get the machine name and not the formatted name. Please can somebody describe me what i am doing wrong?

I have tried several ways like:

{{ view.field.field_my_field.value(view.result[0]) | render }}

or

{{ view.field.field_my_field.value(view.result[0]) }}

Thanks for helping!


texts: Cck date field save not working properly

texts:
I am saving a date field and when i print the value as
print_r($node->mydate[0]['value']); it is printing only year 2012. This problem is only for one field. If i adds a new date type field in that content type that works perfectly.I checked all actions and in my custom code but still not found anything wrong with that. If i update timestamp value with my sql query using db_query that still have problem. I can't delete my field because of my previous content. Please help.


texts: My theme CSS uses relative paths, but Advagg or another module seems to be rewriting them to absolute paths. Core aggregation uses relative paths

texts:
Our CSS authored in the theme uses relative paths for all references to assets
But the CSS aggregated/processed by Advagg has absolute paths where the authored CSS uses relative paths

I can't see any Advagg settings where I am asking it to convert relative paths to absolute

When Advagg is disabled, the CSS aggregated by Drupal core noes not have any absolute paths, instead the relative paths from the authored CSS are used
If I enable Advagg but enable the advagg_convert_absolute_to_relative_path setting then relative paths are used, but doing this would cause problems elsewhere on the site where some CSS is used that requires absolute paths. I'd rather Advagg left our relative paths alone, rather than seemed to convert them to absolute paths, and then back to relative paths.
I have a custom module on the site that alters the base URL to make links/URLs absolute for a small subset of the site (which is consumed and displayed on an external domain). This seems like a potential cause, but disabling this module does not resolve the issue.

A potential cause of the issue?

I have a module that uses hook_url_outbound_alter() to make URLs on some pages absolute by modifying the base URL:

/**
 * Implements hook_url_outbound_alter().
 */
function site_absolute_paths_url_outbound_alter(&$path, &$options, $original_path) {
  if (drupal_static('_is_absolute_path_requiring_callback')) {
    $options['base_url'] = _site_absolute_paths_url_modified_base();
    $options['absolute'] = TRUE;
  }
}

This seems like it could be a candidate for causing the issue, but the problem persists even when the changes to the options array in this function are commented out.

I'm not sure how else to debug this? I suspect it is not an issue with Advagg, but something else on this site that is interacting badly with Advagg. That said, it is odd that the aggregated CSS produced by Drupal core has the correct paths rather than the absolute paths.

If the advagg_convert_absolute_to_relative_path setting seems to resolve the issue, does that suggest that something 'upstream' of Advagg is adding the absolute paths? But isn't adding them when the core aggregation process is run?

Things I have tried

A breakpoint in the first line of advagg_file_create_url() gives "/" as the value for $aggregate_settings['variables']['base_path']. This is what I would expect to be working OK.

global $base_url;
echo $base_url;

In /devel/php gives http://my-site.drupal.dev

Variables used in Advagg hash

Array
(
    [variables] => Array
        (
            [advagg_gzip] => 1
            [is_https] =>
            [advagg_global_counter] => 10
            [base_path] => /
            [advagg_ie_css_selector_limiter] => 1
            [advagg_ie_css_selector_limiter_value] => 3500
            [advagg_scripts_scope_anywhere] =>
            [advagg_devel] =>
            [advagg_convert_absolute_to_relative_path] => 0
            [advagg_convert_absolute_to_protocol_relative_path] => 0
            [advagg_force_https_path] => 0
        )
)

Is this an intended feature of Advagg? This line seems to suggest so:

// Anchor all paths in the CSS with its base URL, ignoring external and absolute paths.
$contents = preg_replace_callback('/url\(\s*[\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\s*\)/i', '_drupal_build_css_path', $contents);


texts: jsonapi Cross-Origin Read Blocking (CORB) blocked cross-origin response in vue

texts:
I got the data with postman in json:api at drupal.

 But I has error of CORB in  Vue-resource.get() with code blew：

 data(){
    return{
        cyclePic:[],
        rootUrl:this.$http.options.root,
        header:{headers:{Accept:'application/vnd.api+json',
            'Content-type':'application/vnd.api+json',
            Authorization:"Basic dG1wQWRtaW46VG1wQDEyMyM0NTY="}
            }
    }
},
created(){
    this.getCycleList()
},
methods:{
    getCycleList(){

        this.$http.get('jsonapi/node/banner?include=field_image',this.header).then(result=>{
            console.log(result)

            if(result.ok && result.status===200){
                this.cyclePic=result.body.included
                console.log(this.cyclePic)
            }else{
                Toast('Fail')
            }

        })
    }

what i miss some thing?


texts: Adding action to each step of a multistep form

texts:
I'm trying to have a multistep form for user registration.
I'm trying the Flexiform module.
In the first step I ask for user mobile number, then using an action I want to send a random number to him.

In the second step I'll ask him for the random number so I can validate the mobile number.(I can have a default random value for a hidden field in the first step to be able to use it for the validation).

The question is: How I can actions to each step of the form?
In the rules actions, it seems I have only actions for submission of whole form.

Thanks in advance for any help.


texts: How do I get a field value in another field's template on a paragraph?

texts:
I have a Paragraphs bundle that has 2 fields.  I want to have the value of the first field in the second field's template so I can combine it with {{ loop.index }} to make unique classes for a grid layout.

Is this possible using a preprocess function and a theme template?


texts:
I'm attempting to write DBTNG query for a Migrate v2 class (D6), and I can't quite get a WHERE clause using IN to work.  Here's the query I need:

select ngeuu.user_name, ngeu.email_address1
from nge_users ngeu inner join nge_user_to_group_tbl ngeutg on ngeu.user_id = ngeutg.user_id
where ngeutg.usergroup_id IN (16, 5608, 48, 34, 22, 26, 24, 18, 28, 20, 14, 12, 6879, 36);

This query returns the appropriate amount of rows.  The way I have the query written in my Migrate class is:

$query = db_select('nge_users', 'ngeu');
$query->innerJoin('nge_user_to_group_tbl', 'ngeutg', 'ngeu.user_id=ngeutg.user_id');
$query->fields('ngeu', array('user_name', 'email_address1'))
$query->condition('ngeutg.user_id', array(16, 5608, 48, 34, 22, 26, 24, 18, 28, 20, 14, 12, 6879, 36), 'IN');
$query->duplicate();

but I start getting duplicate rows after 4 records, even though the query by itself doesn't return any.  How do I need to change this to make it correct?

Thanks.


texts:
Is there a way to output the content of a view as a definition list?
Example:

Nodes title

Nodes content

Another nodes title

Another nodes content

Any ideas?


texts: How to use inline entity form field in custom form?

texts:
I have a site with Drupal 8 and Commerce 2. Now trying to build a custom "Create new order" -form for admin. Created a custom module and form with buildForm() function.
Managed to add selection for store and user (as entity reference fields) but I got stuck when trying to add products for order. I had an idea to use inline entity form for this, but I can't figure out how to do that.

In buildForm() function I have

 $form['products']['ief'] = [
    '#type' => 'inline_entity_form',
    '#entity_type' => 'commerce_order_item',
    '#bundle' => 'default',
    '#form_mode' => 'default',
    '#op' => 'add'
  ]

This shows 3 fields (Product variation auto complete field, quantity and unit price) but it does not show "Create new order item"-button.
Should this work out-of-box and is there something wrong with field settings...?

Or do I need to add submit button and some ajax callback myself to generate new fieldset?

Any help is appreciated :)


texts: Why is the recommended release of my module not proposed in Drupal updates?

texts:
For my contributed module I've previously published several releases without any issue.

Most recent releases were successively 7.x-2.0rc2 then 7.x-2.0 and 7.x-2.1.

As of 7.x-2.1 the following happens:

for all Drupal sites having this module installed with an older release, the admin/reports/updates list doesn't mention the newest release (even after refreshing):

for a site currently in 7.x-2.0rc2 it proposes 7x-2.0
for a site currently in 7.x-2.0 it tells it's up to date

(may be not related but) simultaneously I noticed that the git repository summary doesn't show the labels for the tags corresponding to the 2 new releases, in its Age list

However at the same time:

the project page shows the right last release in Recommended releases (and downloading it gives the right content too)
the git repository summary shows the involved releases in its Tag list

BTW I noticed that some other older releases are also shown in Tag list while missing in Age list, so the git behaviour might not be relevant for this issue

Anynay keep wondering why the recommended release of my module is not proposed in Drupal updates?


texts: Is a node linked in any Panel (Drupal 7)?

texts:
Is there a way in Drupal 7 to find out if a specific node is used in any panel of any page?

Would be helpful to prevent my editors from deleting content when it's still needed in some other part of the page.


texts:
I have a table of reservations which is built using Views module.

I want to highlight new reservations only 1 time. So I want to run a database update query (function db_update) after a page load. I tried to run it in hook_page_alter() or in hook_process(), but I didn't succeed, because query runs before showing a table. What hook should I use in my case?


texts:
I would like to modify the value of my VBO checkboxes but can't figure where to hook in.

<input name="objects[selection][1]" id="edit-objects-selection-1" value="1" class="form-checkbox select" type="checkbox">

becomes

<input name="objects[selection][1]" id="edit-objects-selection-1" value="1-XXX" class="form-checkbox select" type="checkbox">


texts: I am getting an error "Notice: Undefined index: distribution_name in drupal_install_profile_distribution_name() ". How do I fix this?

texts:
I am using Drupal 7.69. I log in and go to my modules page and get the following error:

  Notice: Undefined index: distribution_name in drupal_install_profile_distribution_name() (line 207 of /var/www/html/includes/install.inc).

According to this page: https://www.drupal.org/project/drupal/issues/1170362, you're supposed to run the following update SQL statement to set the correct status: UPDATE system SET status=1 WHERE name='standard';

My problem is in my system table I don't have any record with name equal to "standard". How do I add it?


texts: Using Profile 2 with Entity Reference--How to display the user name and not the "Profile Name"

texts:
I've reviewed the threads similar to this, and can't seem to find a definitive answer. I have a Content Type in Drupal 7 where I want to be able to associate multiple users to a content item. For example, I have a "Music Ensemble" content type, and I want the ensemble leader to be able to select all of their ensemble members from the list of user profiles.

I've been through all the steps to configure a view with the Entity Reference Widget, and add / configure the Entity Reference field on my content type. When I go to create a content item, the View loads, displays the correct profile fields and allows me to select users.

However, when I submit the view form and return to the content UI, I get the following:

The "Main profile" text is displayed for every member I select. What I really want to display on the content item is the user's name from their profile.

I can't seem to find a way to configure around this. Is this simply a limitation of the Entity Reference / Profile 2 relationship, or is there something I'm missing that could solve this? I can figure things out on the front-end display with Views, but this is rather challenging for someone unfamiliar with content authoring (which most of my authors are).

Thanks in advance for any help.


texts: Sending webform submissions to email with csv export of submissions

texts:
I need help, because I dont know how to create csv file from submissions and send it as attachment in submission mail.

I have form with some field and after sending webform I need to create custom csv in specific format with values from webform and all this send it like attachment of normal submission mail.

Is there some modul for creating csv from webform, or I need to cook my own custom module to create it?
Thanks a lot


texts: How can I get the current node view mode and add to block template suggestion?

texts:
In my code, I need to get the current view mode of the node to be able to pass it to be used as a block template suggestion.

The function I have set up is able to grab all available view modes, but I just want the current one. Possibly a condition that I haven't come across yet would do the trick?

function mytheme_theme_suggestions_block_alter(array &$suggestions, array $variables) {
// Add template suggestions based on the current view mode and node type.
  if ($node = \Drupal::routeMatch()->getParameter('node')) {

   $view_modes = Drupal::entityQuery('entity_view_mode')
   ->condition('targetEntityType', 'node')
   ->execute();

   foreach ($view_modes as $view_mode) {
   $view_mode = str_replace('node.', '', $view_mode);
   $suggestions[] = 'block--' . $node->getType() .'-'. $view_mode;
  }
 }
}


texts: Entity Query Condition for the referenced entity's type

texts:
According to the documentation for the condition() function, you can append columns to a field name, but I haven't found a way to make a condition on the referenced entity's type.

// Something like this?
$query->andConditionGroup()->condition($referenceFieldName, $someId)
     ->condition("$fieldName.entity:type", ['character', 'movie'], 'IN')

Let's say with the above I am querying for articles that have a reference to the ID in $someId and that reference is to a content type of either character or movie. Is something like this possible with entityQuery?

Background: I'm using the Dynamic Entity Reference module, which allows me to make a reference field that can point to either a taxonomy term or a piece of content. I want to query for references to content in that field, but am concerned that there could be an ID overlap. That is, a taxonomy term and character for example that both have the ID 123. If I am searching for the ID 123, I would only want articles that have references to the characters or movies with the ID 123, not any taxonomy terms with the ID 123.


texts: What does extension-provided configuration mean in Config Snapshot?

texts:
Configuration Snapshot enables snapshotting of extension-provided
  configuration. It's used by Configuration Synchronizer to support
  updating configuration provided by modules, themes, and the install
  profile.

Recently I checked my database and found there are two tables
config
and
config_snapshot
I found that the module Config Snapshot creates the table config_snapshot table
While reading through project page text,I see it says "it enables snapshotting of extension-provided configuration"
What does extension-provided configuration mean ?


texts: Using Event Subscriber change the product custom field value after first checkout of that product

texts:
Using 'Event Subscriber', I'm able to get $order and $items from the order after completing the checkout.

How can I get the product id from the $itemsand modify the product custom field value?

Scenario: I want to change the status of the product after completing the first checkout of that product.


texts: ajax_command_invoke Question related to Commerce + Colorbox + AJAX

texts:
I am displaying a Drupal Commerce node with AJAX add to cart functionality in a popup, with the Colorbox Node module.  In my custom form callback, I have the following code.

// Form callback function
function ajax_module_form($form, &$form_state){
  drupal_add_js(drupal_get_path('module','colorbox' . '/colorbox.js'));
  $commands = array();

  $commands[] = ajax_command_invoke('colorbox-node', 'colorbox.close');

  return array('#type' => 'ajax', '#commands' => $commands);
}

I am trying to use Drupal's ajax_command_invoke to close the Colorbox window after AJAX form submission is complete, but cant seem get it to work. I tried 'parent.colorbox.close' as well but doesnt seem to work. The colorbox link has iframe and sample link is -

example.com/node/45434345?width=500&height=500&iframe=true and link class is .colorbox-node

Also the Colorbox module setting - invoke on all pages is also active.

Any lead/help is greatly appreciated.


texts: How to set up path for library and include files

texts:
In Drupal 7, I am writing PHP from inside the Front Page module, say:

$page = include_once "templates/page.php";

I put the "templates/page.php" under /sites/all/modules/front and Drupal complains about file missing. Any suggestion where best to put up the files to be included?

Then, after installing the PHP Simple HTML DOM Parser, I wrote the following

$html = new simple_html_dom();

and was complained for Class 'simple_html_dom' not found. I have tried duplicating the library file to the same folder and home, but all cases not working. How to set up the correct path?

Many thanks.


texts: Results in view page with search api having multiple duplicate result

texts:
I am in a dilly of a pickle.
I have a view that returns indexed content types.
The problem is that the view is returning multiple instances of the same content.
All of these are indexed nodes.

I read about someone else having the same problem here:
Results in view page having multiple duplicate result
They say you can use
hook_views_pre_render() in your template.php file
to filter the extra content types out of your view.

Specifically the article said to

function YOURTHEMENAME_views_pre_render(&$view) {
  $used_nids = array();
  $new_view_result = array();

  if ($view->name == 'YOURVIEWNAME') {
    foreach ($view->result as $row) {
        if (!in_array($row->nid, $used_nids)) {
          $new_view_result[] = $row;
          $used_nids[] = $row->nid;
        }
    }

    $view->result = $new_view_result;
  }
}

This did not work for me. There was no $row->nid property. I think this is because they are using regular nodes and I am using indexed nodes.

Here is an example of my "$row printed out. (from $row above)

object(stdClass)[489]
      public 'entity' => int 4
      public '_entity_properties' =>
        array (size=2)
          'search_api_relevance' => string '1' (length=1)
          'search_api_excerpt' => string '' (length=0)

I altered this to try and filter by the property on "$row" called entity, which holds the id of the indexed item.

function BootstrapBlocks_views_pre_render(&$view) {
  $used_nids = array();
  $new_view_result = array();

  if ($view->name == 'search_the_mangroves') {
    $count = 0;
    foreach ($view->result as $row) {

        if (!in_array($row->entity, $used_nids)) {

          $new_view_result[$count] = $row;

          $used_nids[$count] = $row->entity;
          $count++;
        }
    }

    $view->result = $new_view_result;
  }
}

Indeed this does filter out the extra content.  I know this because in template.php I printed it out to be sure, but when I set the view to use the new content
ie:  $view->result = $new_view_result;
I get no content type back from the view.
Any idea what might be the issue?

Please help me.

Sincerely,

David Pugh

PS: if you need any more info, let me know.


texts: how do i link a field to another field in views

texts:
I have a Views on which I display an event calendar. Events get created through a separeate content type which contains a checkmark "Link to page" which will (if checked) display a "view" link in the table which links to the created content. Now i have added another field in the content type of type text "External link {will link to current page if left empty)" which should override the linkage to the current page and render the "view" link to link to the url entered in "External link" field. How would I do this?
Please advise!
Thanks!

edit 1

No, I currently hacve a checkbox that creates a link whichj links to the current content but nothing that woul consider the newly added field "External link (will link to current page if left empty)"...
How do I can I do this?


texts: How to enable highlighted search functionality?

texts:
I want to enable search functionality such that:

I have one word say "school" in my website and if I put "sc" word in search box, then search result should give "school" word with "sc" word highlighted.
I have one word say "school" in my website and if I put "oo" word in search box, then search result should give "school" word with "oo" word highlighted.

How can I solve this problem?


texts:
I created a module that hooks into the admin menu and allows you to upload a specific file for the site to use.

It allows you to upload a file, and change a file, but as soon as you remove a file and click submit I get the error:

  PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062
  Duplicate entry '' for key 'uri': INSERT INTO {file_managed}
  (filesize, status, timestamp) VALUES (:db_insert_placeholder_0,
  :db_insert_placeholder_1, :db_insert_placeholder_2); Array (
  [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1
  [:db_insert_placeholder_2] => 1412011464 ) in drupal_write_record()
  (line 7202 of /var/www/html/includes/common.inc).

I think Im missing a step when it comes to managing files in a form. Here is the relevant module code:

function read_more_news_admin_form($form, &$form_state) {

    $form = array();

    // File selection form element
    $form['csv_file'] = array(
        '#name' => 'file',
        '#type' => 'managed_file',
        '#title' => t('Choose a CSV File'),
        '#description' => t('Upload your Daily Nav CSV here'),
        '#upload_location' => 'public://',
        '#default_value' => variable_get('csv_fid', ''),
        '#upload_validators' => array(
            'file_validate_extensions'=> array('csv'),
        ),
    );

    $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
    return $form;
}

function read_more_news_admin_form_submit(&$form, &$form_state) {

    // Saving the file, setting it to a permanent state, setting a FID variable
    $file = file_load($form_state['values']['csv_file']);
    $file->status = FILE_STATUS_PERMANENT;
    file_save($file);
    variable_set('csv_fid', $file->fid);

}


texts:
i have:

/**
 * @ContentEntityType(
 *   id = "my_entity",
 *   label = @Translation("drwywr werwer label"),
 *   bundle_label = @Translation("My entity type"),
 *   handlers = {
 *     bla...
 *     "form" = {
 *       "default" = "Drupal\my_entity\Form\MyEntityForm",
 *       "edit" = "Drupal\my_entity\Form\MyEntityForm",
 *       "delete" = "Drupal\Core\Entity\ContentEntityDeleteForm"
 *     },
 *     bla...
 *   },
 *   translatable = FALSE,
 *   entity_keys = { bla... },
 *   bundle_entity_type = "my_entity_type",
 *   links = {
 *     "collection" = "/admin/test/entity/collection",
 *     "canonical" = "/admin/test/entity/{my_entity}",
 *     "edit-form" = "/admin/test/entity/{my_entity}/edit",
 *     "delete-form" = "/admin/test/entity/{my_entity}/delete"
 *   }
 * )
 */

based on above, how do i load my entity in form below:

<?php

namespace Drupal\my_entity\Form;

use bla...

/**
 * Form controller for the node edit forms.
 */
class MyEntityForm extends ContentEntityForm {
 //how to load my entity type here?
}

i tried a couple way but i keep receiving:

  Error: Call to a member function getEntityTypeId() on null

mainly because the entity is not loaded (null value)

this is how i create the route:

in my_entity.routing.yml:

route_callbacks:
  - 'entity.my_entity.routes::routes'

in routes:

public function routes() {
// Build Entity Create Route - CREATE
  $route = new Route(
      (substr($type->getRoute()['path'], -1) == '/' ? $type->getRoute()['path'] . $type->id() : $type->getRoute()['path'] . '/' . $type->id()) . '/create',
      [
        '_form' => '\Drupal\my_entity\Form\MyEntityForm', //TODO : not finish
        'entity_type' => 'my_entity',
        'bundle' => $type->id(),
        '_title' => 'Create ' . $type->getRoute()['label'],
      ],
      ['_permission' => 'entity admin settings']
    );
  $route_collection->add('entity.my_entity.' . $type->id() . '_create', $route);
}

if you see in my content entity type config above, i have:

 *   links = {
 *     "collection" = "/admin/test/entity/collection",
 *     "canonical" = "/admin/test/entity/{my_entity}",
 *     "edit-form" = "/admin/test/entity/{my_entity}/edit",
 *     "delete-form" = "/admin/test/entity/{my_entity}/delete"
 *   }

which i want those: edit, delete to be able to 'link' with my form as well - how to do this?

what i'm trying to achieve is: to generate forms based on field define in my entity type


texts: Why source is empty object for hook_feeds_after_parse in dpm()?

texts:
Working on a module that modifies some CSV files before it's processed
by feeds_import. I use the hook_feeds_after_parse($source, $result).
The processing and $result is ok.

But the object $source of type FeedSource is empty!
So how can we know which source is being handled?

Why is it empty?

if $source == x: // do that.

is not possible.

Any solution?


texts: Twig Translation String without Enabling Interface Translation

texts:
Is it possible to provide translation strings to Twig, without the Interface Translation module enabled?

We have Content Translation enabled but do not want to enable Interface translation (we would like the Drupal administration menu system to remain in English).

We have a couple of landing pages that base most of their content on a translated entity however, there are still a few labels and links we would like to translate using {{ 'foo'|t }} in Twig.

Is this possible? And if so - where would the translation stings be stored?


texts: What is the difference between hidden and value types in form API?

texts:
In Drupal's Form API page mentioned both hidden and value will not display to user.

What is the difference between them?


texts: How do I set a Boolean config variable to false?

texts:
I can't set a boolean config value to FALSE with drush.  I'm using Drush 8.9.4.
pk@DC:~/$ lando drush config-set advagg.settings enabled 0 -y

 // Do you want to update enabled key in advagg.settings config?: yes.

pk@DC:~/$ lando drush config-get advagg.settings enabled
'advagg.settings:enabled': false

pk@DC:~/$ lando drush config-set advagg.settings enabled true -y

 // Do you want to update enabled key in advagg.settings config?: yes.

pk@DC:~/$ lando drush config-get advagg.settings enabled
'advagg.settings:enabled': true

pk@DC:~/$ lando drush config-set advagg.settings enabled false -y

 // Do you want to update enabled key in advagg.settings config?: yes.

pk@DC:~/$ lando drush config-get advagg.settings enabled
'advagg.settings:enabled': true

Why does setting it to false make it true?


texts:
I have a strange problem.
Today I moved a site from staging to production and the site work fine but I cannot se the images.

I can see in ftp the picture but drupal do not serve it in the page.
I already tryed to clear cache.

In the reports log I there is a lot of

Unable to generate the derived image located at public://styles/ensemble-small/public/anne ristorcelli s.png.

errors but I do not understand what I can do.
The GD tookit works fine.. I checked it.
I tryed to re-upload some images but do not work and I can't see they in the editing page too.

Can someone help me to solve this?

UPDATE:
I tryed to delete the images generaten in the staging server to verify the correct working of the images modules. The images was ok.
So the problem is in server request?

If I try to see the image directly I have this error:

    Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, postmaster@ensemble05.it and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


texts: How to find the right token to use in a rule for sending an email to the node author?

texts: I am having the toughest time figuring out how to send an email to the node author. I created my rule and everything works if I hard code the email but I can't seem to get the right token to use and it seems the tokens available only allow:[node:author] nothing for the node authors email?


texts:
This is related to this question I asked.

Bottom line is that for some reason some junk view is stuck under the Views list and when accessing the List I get a WSOD.

I confirmed that is a view issue after uninstalling and reinstalling Views the problem went away.

An easier fix might be to take a look on the saved Views. But the major question here is where are the created Views located? (in a folder? in the DB?).

I just want to see that malformed View and delete it.

EDIT: A screenshot of the output of drush vl. Note the enabled view on the top that has no name or machine name.


texts: Replace Ubercart radio button with image?

texts:
I have a product with three radio button options, and I want to replace those radio buttons with clickable images. This is how those radio buttons appear in the code:

     <input type="radio" class="form-radio" value="136" name="attributes[51]" id="edit-attributes-51-136">Red, +$3.00

     <input type="radio" class="form-radio" value="135" name="attributes[51]" id="edit-attributes-51-135">Green, +$5.00

     <input type="radio" class="form-radio" value="137" name="attributes[51]" id="edit-attributes-51-137">Blue, +$10.00

Instead of the radio button and label, I'd like to simply display a image color swatch. How can I accomplish this? I assume I'd need to somehow reference the "for" value in the "label", but I'm not sure how to do so. I'd prefer not to go the "nth child" route, but I can if I need to.

Thanks!


texts: Setting up a date field to require an end date

texts:
I'm attempting to create a custom content type for a module via hook_install. When I create a date type (from Date module), I want it to require an end date (there's a checkbox when you're setting up the field via the gui). This is the settings array for the field:

'settings' => array(
    'enddate_get' => 1,
    'enddate_required' => 1,
),

This isn't working (the widget is still only asking for one date), so I'm guess that I have the wrong settings. Does anyone know how to properly set this up?


texts: I am new to Drupal, I have requirement to add a readmore link to Basic Page content. That readmore trim the full content.


texts: How to import data into db using Feeds importers

texts:
I created a Feeds importer and when I try to run it, it gives this error

SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1

What can cause this?

It's the header of CSV file that I'm trying

id,Title,LeakZip,Category,Type,LeakPhoto,Description,Username

and I'd mapped the same name in the importer as well

also in what table it puts the data in database ?

Screen

CSV snippet

id,Title,LeakZip,Category,Type,LeakPhoto,Description,Username
1,Angela Brown,"Hoboken,     NJ","Relationships","Negative","MuploadsMprofileM321267846956_sm.jpg","no scars or tattoos but she has a really bizarre hairline in the back shaped like the letter M. Last 3 digits of phone number : 265.", superUser


texts: How do I add a view exposed filter on a node reference field?

texts:
I have a view on a book node that has many different fields; one of them is the Author field, which is a node reference to the node's author.
I would like to build a search view for books adding some parameters, one of which is a text field for the author name.

Is there a way to create an exposed filter on a node reference field? I've not found a way.


texts: How to validate a form against a custom user profile field?

texts:
I unsuccessfully tried https://www.drupal.org/project/rules_forms for forms validation so I am writing my own little validation module.
Basically, on node creation I want a validation against a custom user profile field (machine name: field_points). When the user enters on node creation more points then he has on his profile, an error message should appear.
Static validation against a number works just fine, but how can I access custom fields of the user object? Using devel, for some reason they don't show up in dpm($user).

function custom2_form_contenttype_node_form_alter(&$form, &$form_state, &$form_id) {
drupal_set_message("Form ID is : " . $form_id);
dpm($form);
//$form['field_points']['und']['0']['value']['#default_value'] = 164;
$form['#validate'][] = 'custom2_form_contenttype_node_form_validate';
}

function custom2_form_contenttype_node_form_validate($form, $form_state) {
global $user;
dpm($user);
$profilePoints = $user->field_points;
$enteredPoints = $form_state['values']['field_points']['und']['0']['value'];
dpm($form['#validate']);
dpm($form_state);
if ($enteredPoints > $profilePoints) {
   form_set_error('field_points', '"You can only spend" .     $profilePoints . " //points."');
   }

}
EDIT: uploaded devel user screenshot


texts: How can I sort by last word in the node title field?

texts:
In one of my content type, we are storing names in the Title field. For example, title is "John Smith". Due to the recent requirement change we now need to sort results by last name.
But since the name is stored in Title how can I sort by last name in the view? Is there a way I can create a field which automatically gets the last word in the title? Or may be some other way that I am missing out?


texts: How do I set the fixed amount of values to 11?

texts:
I'm setting up a field with multiple values. The maximum fixed amount of values I can configure is 10.

If I want more I have to set this to unlimited.

Is there a way tho set the fixed amount of values on a field to 11 values?


texts: Possible to insert class based on language?

texts:
Is it possible to insert additional class to the body tag through the page.tpl.php file but with the condition:

$language->language == 'zh-hans'

in an IF statement?

I tried adding the following code to the template.php:

function MYTHEME_preprocess_html(&$variables, $hook) {
global $language;
if ($language->language == 'zh-hans') {
    $variables['classes_array'][] = "zh-hans";
}

}

but I'm not sure if the function is supposed to be used like this. The class does not appear.


texts: taxonomy terms that get URL aliases and then end up being ugly google sitelinks

texts:
Including tags of course. I used some tags like  that I thought would be running in the background to use them as view filters, but then end up being google sitelinks such as 'subject-teaser-list'. How ugly and unprofessional that looks!

I rather have no sitelinks at all instead of these ugly looking sitelinks.
You have this result when search google for 'breinwijzer'

cheers,


texts: How can I strip out default markup for a text field?

texts:
I have created text fields for first name and last name (which i need as separate fields so i can sort by last name when needed) but the default markup is so cumbersome! they each are nested in 3 divs, and all I want to do is display as a typical manner, ie. Firstname Lastname

How can I strip out the default markup for these 2 fields only? creating a field override template doesn't seem like a good idea, or is it?


texts: How to fill form fields based on other fields values using AJAX

texts:
I have 3 fields. On blur on any of them I want to look for empty ones - if blurred one has value and any of the others does not, I want to copy value.

Obtaining value is easy, simply $form_state['triggering_element']['#value'], but setting it elsewhere gets tricky.

Changing $form['item']['#default_value'] does not work if field is empty after user's edit. Changing $form['item']['#value'] makes Drupal ignore any further user input. Changing $form_state['values'] seems to do nothing. What is the correct approach that should work? When I'll know that, I'll be able to debug.


texts: How to filter Search API index view by taxonomy parent

texts:
I am using the default database server that comes with search api. I have the Hierarchy Index ticked and I also have the taxonomy field that I want selected.

Could someone give me instructions on how to configure the view to have it filtered by the taxonomy parent/show only the children of the selected parent term? I just want a drop down like you would have with a regular view.

(I got this to work in D7 a while ago but I think that was because the field still retained its taxonomy data type when indexed but now with D8 it has none of that.)

I can add a field that has a parent relationship but that does nothing.
I tried adding a field Vocabulary » Taxonomy term » Term Parents and tried to filter by that but nothing.


texts: Complicated 'double' contextual and relationships view

texts:
I would like some help on how to implement the following view:
A block that shows all the 'events' happening at any 'location' created by a user.

I have 'event' and 'location' content types. There is a field in the 'event' node which refers to a 'location' node (it's nid).

I am familiar with views, just not sure how to get the 'double filtering' required to show only events that have a location that is created by the user logged in. I cannot create an 'author' relationship to a contextual filter for the location or event to a simple filter, as the view displays events, not locations... Any ideas?


texts: How do I stop a node submission programmatically?

texts:
i'm using Drupal 8. I would like to stop the user to submit a node when he tap save, and show some message. How can I do it programmatically?

Thanks!


texts: Restrict language based content editing for nodes and blocks

texts:
I am running a D7 multi-language site. I am looking for a solution to restrict node AND block editing for english language, only. The editor should not be allowed to edit french content. How can accomplish what I'm looking for?

So far, I have created a new user (e.g. english editor) and added them to a new role. I am also using contrib module 'Content Access' and 'block access'. However I have to restrict access per node which is not my perfect choice. With block_access module, english editors are still able to see/modify translations


texts: drop migration tables after migration ended

texts:
After uninstall migration modules the tables created not removed and still exist and can not be reasonable to deploy without remove that tables.

Problem:

The 3 modules Migrate, Migrate_drupal, Migrate_drupal_ui didn't implement Hook_uninstall() to remove these tables or other data related to migration and have no use after complete migration

The issue on drupal.org


texts: Give restricted editors access to unpublished nodes

texts:
Using Drupal 6.22.

I want to have editors create nodes (in a unpublished state) and be able to edit them. If they navigate away from the node their editing, they can't find it unless they have the full URL to it.

Is there a way to give them access without granting privileges to the admin pages and administering nodes?

I think creating a view of unpublished content and having it only show for editors is one possibility.


texts: Form ajax submit handler not called when loading in ModalDialog from submit handler of another form - Drupal 8

texts:
I've custom form (suppose FORM1) with few fields and AJAX submit button. When user submit this form, I'm opening another form (suppose AJAXFORM1) in ModalDialog with few more fields and AJAX submit button. When I open AJAXFORM1 using link (i.e. a tag with 'use-ajax' class), form submit handler gets call and modal dialog is closing properly. But when I open AJAXFORM1 from submit handler of FORM1, form submit handler of AJAXFORM1 is not called (neither normal submit handler nor ajax callback). Below is code snippet I'm using:

FORM1

class CustomForm extends FormBase {

  /**
   * {@inheritdoc}.
   */
  public function getFormId() {
    return 'custom_form';
  }

  /**
   * {@inheritdoc}.
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form = [];

    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Submit'),
      '#name' => 'submit',
      '#ajax' => [
        'callback' => [$this, 'ajaxFormSubmit'],
      ],
    ];
    $form['#attached']['library'][] = 'core/drupal.dialog.ajax';

    return $form;
  }

  public function ajaxFormSubmit(array &$form, FormStateInterface $form_state) {
    $response = new AjaxResponse();

    $options = [
    ];

    $modal_form = \Drupal::formBuilder()->getForm('Drupal\mymodule\Form\ConfirmDialogForm', $options);
    $response->addCommand(new OpenModalDialogCommand('My Modal Form', $modal_form));

    return $response;
  }

}

AJAXFORM1

class ConfirmDialogForm extends FormBase {

  /**
   * {@inheritdoc}.
   */
  public function getFormId() {
    return 'confirm_dialog_form';
  }

  /**
   * {@inheritdoc}.
   */
  public function buildForm(array $form, FormStateInterface $form_state, $options = []) {
    $form = [];

    $form['confirm'] = [
      '#type' => 'submit',
      '#value' => $this->t('Ok'),
      '#ajax' => [
        'callback' => [$this, 'submitModalFormAjax'],
        'event' => 'click',
      ],
    ];

    $form['#cache'] = ['max-age' => 0];
    return $form;
  }

  /**
   * {@inheritdoc}.
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $values = $form_state->getValues();
    \Drupal::logger('submit')->error('
' . print_r($values, TRUE) . '
');
    // return TRUE;
  }

  public function submitModalFormAjax(array $form, FormStateInterface $form_state) {
    $values = $form_state->getValues();
    $triggerd_element = $form_state->getTriggeringElement();
    \Drupal::logger('submit')->error('
' . print_r($values, TRUE) . '
');

    $response = new AjaxResponse();

    $redirect_to = 'redirect.to.route';
    $redirect_url = Url::fromRoute($redirect_to, [], ['absolute' => TRUE])->toString();
    $response->addCommand(new RedirectCommand($redirect_url));

    // $response->addCommand(new CloseDialogCommand());
    $response->addCommand(new CloseModalDialogCommand());

    return $response;
  }

}


texts: I have a custom module to audit entities changes. Because this data is important to preserve I need to warrant that a backup will be saved if the module is uninstalled. I need to rename the table in a module's uninstall process to avoid data loss when the module is uninstalled. Do you have any idea or suggestion?


texts: How can I set a different theme basing on the language currently used for the page?

texts:
We have built one website in English and we want to translate it in Arabic.

Since I am new to Drupal, I am not sure how I can set a theme for English, and one for Arabic. How should I achieve this?


texts: How can enable multiple contact form in drupal 8?

texts:
I want multiple contact forms(different fields) in my drupal 8 site Like Webform module drupal 7.

I have tried to add multiple contact forms and i am able to number of contact forms with different different fields but at time only one form i can able to enable. Can i enable different contact form with different menu link?

Is there any alternatives to achieve this or i need to go for custom form?

Thank you


texts: How to bring facebook connect button in login form?

texts: For one of my projects I installed the Facebook O Auth module in my site. Now I would like to display the Connect with facebook in my login form.


texts:
What is the best method to check if a field is empty in a node template.

In node--example.html.twig we can use "content" variable.

I can't use check like checking a block

{% if content.field_example  %}

I can use something like this:

{% if content.field_example['#object'] is defined  %}

But what is the best method?


texts:
Am i doing wrong to define, jQuery Accordion inside my .module file,
just like this:

<?php
  drupal_add_library('system', 'ui.accordion');

Drupal no longer loading jquery itself.


texts: How to choose a CSS grid system for new theme?

texts: I am going to make a new responsive theme based on an existing base theme for drupal 6. The theme need to be minimal but flexible. As there are many CSS grid systems to choose from, I've read that 960.gs has fallen out of fashion as it is too small for current monitors. So I'm wondering whether there are any important differences between fluid and non-fluid ones, and currently what are the best options available and why?


texts: Change style of custom view mode condionally

texts:
I have a custom view mode created with ds module,
this view mode lists node articles, each article displays like this :

  title
  description
  url
  term reference field
  some other fields...

I want to add some style condionally depending on the term reference field
For example:
the first article has the term reference with the value "1", I change the backgroud of the this article to "red"
the second article has the term reference with value "2", I change the backgroud to "green"
...

EDIT :

this is an image how look like the manage display of some fields :

My interest is with the Flag field:
It's a taxonomy field reference having (title, color (hexadecimal value), description...)
This flag field as you see has the formatter 'editable' (done with editablefieds module), so editors can edit the value of this field.

Now I want to add another field next to Flag witch is the color field of the current Flag taxonomy term, and render for example a simple div with some width and height and with the backgroun-color, this color field

Hope it's more clear than the old post :)

Thanks in advance.


texts:
How to remove any duplicate messages of a certain type.

For example when performing 2 searches using the search api module before rendering the page the message "To perform a search you must enter at least 3 characters" may be displayed twice.


texts:
I'm currently having a Drupal 6 (because some modules are not available in Drupal 7) site running. But the loading time is very slow(www.hard-dance.org)

Here's what I've tried so far to eliminate possible reasons:

I have looked in my admin panel for problems, and did a cron job manually
I have checked to see if Clean-URLs was causing the site to slow down, it was not.
I've disabled some modules, but no change.

I also noticed that my website is going slow, once logged in.

Does anyone have an idea of what the cause of it could be?


texts:
I'm looking to add an exposed filter that only contains existing user inputed value.

For example.  I've create a content type called 'Items'.  Inside that content type there is a field called 'Team name'.  The user can freely enter the Team name and add multiple items associated with that Team.

When the user is viewing items, I'd like for them to be able to filter based on that Team Name, but rather than force them to type in the name, I'd like for the exposed filter to contain a list of Team Names that have been added into the nodes.

How to make an exposed filter that only contains existing database values?


texts: UI issues with the "Registration" module

texts:
I am working on my second Drupal 7 site and try integrating the "Registration" and "Registration Views" module (7.x-1.0-alpha5) the first time to create an event system where members can join events and see who else joined.

For this I've created a content type "Events" with the event-fields as well as a Registration Type for the events (with some additional registration fields on it). Then I added the registration as a field to "Events". So far so good - no problem here.

The issues I now have is with the User Interface:

a) The registration is rendered on top of the content as a tabbed-UI. I like to see just a link to register or maybe an embedded register-form. I also like to show the list of members who actually have registered for this event. ...maybe as a block on the sidebar or something like this. Can I change the way the registration module renders? Is there a way to create a block to render the registrants into?

b) In the event-nodes (only on the event-nodes - not on other node-types) I have the comments elements above the regular node content (in this case the event-field-contents) and below the registration-tabs. How do I control where the comments appear?

Any help or pointing whould be great!

Cheers, Marc


texts: weight changer view doesn´t save the order applied. why?

texts:
I have a D6 site with views 3 and latest version of weight module.

upon clicking the Save button ..it doesn´t apply the weights

Is there any bug on the module itself?

here-s my configuration..


texts: I am writing a module configuration page for a module. Is there a way to make variables submitted and saved by system_settings_form translatable?


texts:
1) I created a content type Portfolio-Item. In this type a text field Project-Url was defined.

2) I created a view containing a gallery using jQFX module displaying content of Portofolio-Item elements which where published.

I wan't to add this view to different pages containing different projects portfolios.

a) Is it possible to add a "filter criteria" or "contextual filter" that would compere the Project-Url field with page URL and filter available Portfolio-Item's to display only proper one's. ?

b) Is there any easy way to achieve this?

c) Can contextual filter's be used with regular expressions?


texts: Different entity types for one field value

texts:
I have a content type "Application".  And "Site Administrator" and "Developer" users are allowed to add it.

If logged-in user is "Site Administrator", the value of "Author" field will be the reference of other content type. So, in the respective field table,

entity_type : node, bundle : {content-type-name}

If logged-in user is "Developer".  I'd like to save current logged-in user id as the value of "Author" field.

entity_type : user, bundle : user

How could I get it with drupal?

Thanks in advance.


texts: Adding pager to queried content in a custom module Drupal 8

texts:
I've created a custom module to get X items using entityQuery, and then display them as a list. I need to limit these and add a pager to click through to the next page, but I cannot find how best to do this. Examples I've found either use external search sources, or are depreciated functions of older versions of Drupal.

I've added the pager option in the query, initialized the pager, and added the #type = pager to the content block, but it's not showing up. I know I am missing something but I cant figure out what it is.

class MyPageController extends ControllerBase {

public function myPage1() {

    $query = \Drupal::entityQuery('node')
    ->condition('status', 1)
    ->condition('type', 'page')
    ->range(0, 10)
    ->pager(3)
    ->sort('created', 'DESC');

    $nids = $query->execute();
    $nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($nids);

    pager_default_initialize($query->total, '7');

    $list = array();

    foreach ($nodes AS $node){
        $list[] = $node->get('title')->value;
    }

    $content = [
        '#theme' => 'item_list',
        '#list_type' => 'ul',
        '#title' => 'Page list',
        '#items' => $list,
        '#attributes' => ['class' => 'my_page1_list'],
        '#wrapper_attributes' => ['class' => 'container'],
        '#type' => ['pager'],
    ];

    return $content;
}
}


texts:
How can I add a css file to the specific page where you delete a node of type = ... . I know you can add css files to specific pages like this:

function hook_preprocess_page(&$vars) {
    $path = current_path();

    if ($path == 'user/login') {
        drupal_add_css(drupal_get_path('theme', 'hook') . "/css/login.css", array('weight' => 1000));
    }
}

But when I want to delete a node as a user the delete modal opens in overlay. And when I then check the path he just gives me the path of the underlaying page of the overay.

This is how the overlay of deleting a node looks now:

But I want to add a css file to the specific overlay, how can I do this?


texts:
My D7 content type has a field for an MP3 file. I want the field to display as an image which the user can then right click to download the file ie like this. My field template file looks like this:

var_dump($items) =

<?php var_dump($items); ?>

print_r($form) =

<?php print_r($items); ?>

<?php echo $items[filesize]; ?>
<?php echo $items['filesize']; ?>
<?php echo $items["filename"]; ?>
<?php echo $items['url']; ?>
<?php echo $items['uri']; ?>

<a href="<?php echo $items['url']; ?>">

The result is here.
Can anyone please tell me why the orange box is empty / not printing out, and the correct syntax re the green box to make the image link to the MP3 file URL instead of the page URL?

Thanks...


texts: Drupal 7 Ckeditor cannot edit profiles (picture added)

texts:
Recently I must have done something that changed something with my ckeditor.
I can no longer edit my profiles.
The strange thing is that I have multisite setup and only 3 sites are affected.
The 3 sites have a different theme, looked everywhere there but I cannot seem to find it.
Normally you see drop-down (clickable) buttons and then you can edit the options.
This is what I have now:

Anyone have an idea of what I might have done wrong?
The picture shows just plan text instead of buttons... I'm useing Omega 3.


texts: Changing an inner join to a left join in views 3.3?

texts:
Using views 3.3, I have a view in Drupal 7 where I am showing two content types. I have a filter criteria based on the value of a field that is attached only to one of the content types. So long as I have that field criteria, views is doing an INNER JOIN, which causes it not to return views of the first content type which doesn't have that field attached.

I copied the query from the view, changed the INNER to a LEFT join, pasted it into the mysql shell, and I got all the rows that I expected to get. But I don't know how to make those changes in the view editor.

I was playing around in the 'relationship' block on the view editor, but I didn't see where I could change the join type.

Am I able to change how views 3.3 does joins?


texts:
How can I get just the url of the uploaded file from the Views module 'file' field.  If I do the following:

print $view->render_field('field_url', $id);

I get the entire 'file' object in html format. How can I retrieve just the url of the uploaded file?


texts: How to dynamically group content in a views listing

texts:
I've hit a massive wall in trying to group a list of nodes displayed through a view on my Drupal 7 site. Currently I have a view that lists a group of nodes that are under a specific vocab term. I then use a weight field to make sure they are in the order that I would like. This works just fine.

Here is an example on my site. In this example I have 11 videos bundled together under one taxonomy term.

What I would like to do is now create "chapters" to better organize these. Using the example above I would like to be able to have the following output:

HEADING 1  <-- I want to add headers like this. And then group videos in each header.
 1. Video
 2. Video
 3. Video
HEADING 2
 4. Video
 5. Video
HEADING 3
 6. Video
 7. Video
 8. Video
 9. Video
 10. Video
 11. Video

The big caveat is that I want to be able to assign these "chapter headings" at different spots for each video series that I have. I don't want to have Chapter 1,2,3 in the same position every time.

Here is an example of how I would like to be able to group my individual videos. Take a look at the video list on the left.

One route that I tried was to create a new Vocabulary called "Video Headers" and then create terms for each header that I wanted. I then created a new term reference field in my video content type where I would choose the corresponding "header" term that I wanted. But I am having trouble grouping this in my view. It's just not grouping correctly.

I've looked into the Book Module, but that doesn't seem like the right fit. My gut tells me that it has to come down to using taxonomy terms to group these videos.

UPDATE: Thanks to Jason below I was able to almost get it working. The problem is that all of my videos show up in the view rather then just the videos that are under a term. In order for my lists to work I have to have a contextual filter:

UPDATE #2: Figured it out! With help from Jason below, I also added a contextual filter of "Has Taxonomy: Term ID". That showed only the nodes associated with a term.

So as soon as I add that contextual filter, it ruins my grouping and groups all of the videos that I have together with one header. Somehow that is breaking it.


texts:
below code is not working in our custom module.

$site_name = \Drupal::config('system.site')->get('name');
$site_mail = \Drupal::config('system.site')->get('mail');

$message['headers']['From'] = $site_name . ' <' . $site_mail . '>';
$message['headers']['Sender'] = $message['headers']['Return-Path'] = $site_mail;
$message['from'] = $site_name . ' <' . $site_mail . '>';

It gives the output like this :

 MailSender <MailSender> <email@example.com>

and I want the output like this :

MailSender <email@example.com>

How can I do this?


texts: Primitive type error when saving a node with a custom datetime field

texts:
I have a custom module providing a few fields to nodes - a checkbox, datetime field and a select.

Previously the datetime field only contained date and the node would save correctly however since trying to change this to also accept time the node won't save and returns the 'This value should be of the correct primitive type.' error.

I get no issues when adding the field itself and have tried completely removing the field from the entity (and removing just the datetime piece to check the checkbox and select are behaving) but get nothing.

My class extends FieldItemBase and has what I think are correct property definitions:

public static function propertyDefinitions(StorageDefinition $storage) {
    $properties = [];
    $properties['enabled'] = DataDefinition::create('boolean')
      ->setLabel(t('Enabled'));
    $properties['date_time'] = DataDefinition::create('datetime_iso8601')
      ->setLabel(t('Date and Time'));
    $properties['value'] = MapDataDefinition::create('string')
      ->setLabel(t('State'));
    return $properties;
  }

Also a correct schema (hopefully):

public static function schema(StorageDefinition $storage) {

    $columns = [];
    $columns['enabled'] = [
      'type' => 'boolean',
      'not null' => 'true',
      'mysql_type' => 'tinyint',
    ];
    $columns['date_time'] = [
      'type' => 'varchar',
      'length' => 20,
    ];
    $columns['value'] = [
      'type' => 'text',
      'length' => 255,
      'not null' => 'true',
    ];
    return [
      'columns' => $columns,
      'indexes' => [],
    ];
  }

The fields are provided in another class which extends widgetBase. The field giving me problems is set out as such:

$element['date_time'] = [
      '#type' => 'datetime',
      '#title' => t('On'),
      //'#default_value' => isset($items[$delta]->date) ? DrupalDateTime::createFromTimestamp(strtotime($items[$delta]->date)) : NULL,
    ];

Within public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $formState).

The rest of the custom field stuff provided by the module seems to all be correct as the field is added, no other errors given etc and everything worked correctly before attempting to implement the time aspect of datetime.


texts: How can I hide the user profile from users?

texts:
I'm using IP-based login to give visitors in a private network access to some parts of my Drupal 6 site. This means that all users from this private network are logged in as the same user.

Theoretically, anyone accessing the site that way could change the user password, which is something I don't really want to allow. I tried the User Protect module, but that just doesn't work at all on my site. I suspect that it is just incompatible with the IP login module.

Ideally, I'd like to hide the /user page entirely from certain users. They shouldn't be able to access it and shouldn't be able to change their password or any other profile information.

How can I prevent access to the user profile?


texts:
I have created a View. Its display format is grid.One of field is Time.

It is displayed as "Time: 1300". I need to get it printed as "Time: 1:00 pm".
I am using Room Reservations module and in my reservations tab time is displayed.

Can it be done with GUI or code needs any modification?


texts: I'm developing a website with drupal 7. I want to put the menu above the content. I use zen theme. How I does it?


texts: How to get all field name of field type?

texts: I want get all the field names for the fields whose field type is image, by code. How can do that?


texts: How to setup views exposed filter with result between 2 fields values

texts:
I have content type called the materials with 2 temperature fields as Max. and Min.

in the views, there is between operator from filter and normally it use for user could input 2 values to the form for filter.

from my case, I want user could input 1 temperature value in the filter and the views result will be the termperaure between Max. and Min.  fields.

is that any way could approach this function?


texts:
Due to request, every page (except the front page) needs to be prefixed with "training"; if the path was first /aboutus, now it needs to be /training/aboutus.

I edited almost every page I needed by rewriting mypage.tpl.php, so to change all path would be troublesome.

I tried to edit the .htaccess file, for example using the following rewrites.

RewriteRule ^/training/about$ /about

RewriteRule ^(.*)/training/about$ $1/about

Neither of them works.

Could someone point me to the right direction?


texts:
hook_node_insert() doesn't work after node insertion in Drupal 8. When I'm trying to get the node details in that hook, it's not working.

My code is the following one.

use Drupal\Core\Entity\EntityInterface;

function test_node_insert(EntityInterface $node) {
    dpm($node);
}


texts:
i have a newsletter content type which consists of a link to a file (pdf) and a summary field.  the idea behind the summary field is that it will contain a list of keywords and when a search hits one of these keywords the newsletter item (and so the pdf file) will be highlighted.

the issue is that i don't really want the summary text to be displayed, but if i set it as hidden in the display it doesn't seem to be indexed.

anyway that i can persuade drupal to index this field?

using 7.12 by the way if that's important.

Dave


texts: How do I obtain the result summary from within a form on the view page?

texts:
I have a design requirement or ask that wants to have a search form at the top of a Views page look like the attached image.

So there is an exposed full text input, exposed sort by filters.

However, the result summary for the view would appear to need to go in the middle of the form.

Since this is on a View page, is there a way to get the current View and fetch its result summary within a hook_form_alter()?


texts: Restrict media files to other users once uploaded

texts:
I'm using Media Entity Browser to let users add new or existing media files in a content type.

I have two groups. Business-A uploaded an image in a content. Business-A can re-use the image in writing other contents but Business-B should not be able to add it as an existing media for their own article.

I want that only a group can get access to its uploaded media. Because when I upload images using media browser, in default, all files get public accessed.

How can I restrict uploaded media files be added by other users.


texts: How to align views pager url with real page number?

texts:
When creating pager in views (D7) you get urls with query parameter like page=X by default. But this X does not match actual page number.

page=1 is generated for 2 link in the paginator and so on.

Is there any way to make them the same without too much of code kung-fu or did I miss some checkbox?


texts: Is there a way to apply cached access results to listings?

texts:
Code that is put in either hook_entity_access or an access handler has no effect on listings such as views field displays and search. I am not sure if this is by design or due to an error from my side, but my guess is that the db queries don't have a way to factor in the generated then cached access results.
This bit I mean:
return AccessResult::forbidden()->cachePerPermissions()->cachePerUser()->addCacheableDependency($stuff);

Is there a way to factor it in listings? If not how should I go about applying the same logic in hook_entity_access or access handlers to listings?


texts:
What is the best way to enter footer links (horizontally)? I was thinking a Menu would be best but this causes limitations around what content goes in the links (eg. cannot have images or non hyperlinked text). While looking at another drupal site I noticed that the footer links are just regular content (not even in a list) ...

What is the best way? And how would you go about deciding how to do it?


texts: Move commerce kickstart 1 to regular drupal base

texts:
Is there any way to move project under Commerce Kickstart 1 to a regular drupal base?
The answer to Can I move distribution profile modules from profile folder to sites/all/modules? (which seems to be the prerequisite) is negative, but maybe there's another way?


texts: Embed a node form with default values in drupal 7

texts:
How do I embed a node form and set some default values in that form in Drupal 7?

I understand that I can use this:

 $form = node_add('product_plan');
 print drupal_render($form);

That prints the form on to the page just fine, but I need help understanding how I can add default values. In Drupal 6, I would normally do this:

 function module_nodetype_form_embed( $property )
 {
     global $user;

    $node = new stdClass();
    $node->type = 'node_type';
    $node->uid = $user->uid;

    // Hidden through form alter
    $node->field_node_reference[0]['nid'] = $property->nid;
    node_object_prepare( $node );

    return drupal_get_form( 'node_type_node_form', $node );

 }

So how can I get the same functionality in Drupal 7


texts: How to Associate Page Title with Author as Variable or Token or Relationship

texts:
I have created a custom content type for each of several contributing users for multi-blog purposes. I then used Views to create a page for each content type and thus a "blog home page" for each user.  I have also modified my theme's node.tpl.php file to reflect the custom look I want for displaying the teasers for all the custom content that is created.

The current header portion of my node.tpl.php file:

<?php if (!$page): ?>

<?php endif; ?>

  <? print " | "; ?><? print render($date); ?>

<?php print render($title_prefix); ?>
<?php if (!$page): ?>
  <h2 class="title" <?php print $title_attributes; ?>>
    <a href="<?php print $node_url; ?>"><?php print $title; ?>

<?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($display_submitted): ?>
  By
    <?php print $submitted; ?>

<?php endif; ?>
<?php if (!$page): ?>

<?php endif; ?>

I can display the custom content title with $title, the date it was submitted by $date and the author by $submitted.  What I would like to include is the title/link to the page (that was created by the view of the custom content type associated with the author).

Is this something I can use relationships for to somehow generate a token and/or variable?

I don't really have any idea about how to approach this; any ideas or advice are much appreciate... thanks!


texts: How to create complex conditional clauses / queries?

texts:
I've been reading the documentatoin on conditional clauses and also studied the api description for db_and() and db_or() but I fail to create a $query with 3 ->conditions:

select all between 0 and 100
but exclude 23, 48 and 97
select also 107, 123, 126 and 128

That's what I have tried so far:

$query->db_or()
  ->condition('my_field', array(107, 123, 126, 128), 'IN')
  ->condition(db_and()->condition('my_field', array(0, 100), 'BETWEEN')
                      ->condition('my_field', array(23, 48, 97), 'NOT IN'));

But I get the following error:

PHP Fatal error:  Call to undefined method SelectQuery::db_or() in [... first line]

I've tried to play around with the syntax like that:

$query->condition(->db_or()
  ->condition('my_field', array(107, 123, 126, 128), 'IN')
  ->condition(db_and()->condition('my_field', array(0, 100), 'BETWEEN')
                      ->condition('my_field', array(23, 48, 97), 'NOT IN')));

But again getting errors like that:

PHP Parse error:  syntax error, unexpected T_OBJECT_OPERATOR, expecting ')' in [... first line]

I also tried working with variables:

$cond01 = array('my_field', array(107, 123, 126, 128), 'IN');
$cond02 = array('my_field', array(0, 100), 'BETWEEN');
$cond03 = array('my_field', array(23, 48, 97), 'NOT IN');
$db_and = db_and();
$db_and->condition($cond02);
$db_and->condition($cond03);
$db_or = db_or();
$db_or->condition($cond01);
$db_or->condition($db_and);
$query->condition($db_or);

But this again yields drupal errors like that:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in 'where clause'

How to create a complex conditional database query with both AND and OR statements?


texts: I need a solution to in-depth scan into Drupal git repositories to find useful code snippets

texts:
I'm looking to find out the best solutions to in-depth search into git repositories for code snippets: inside Drupal custom modules, revisions, contribs, themes, profiles.

As far as I know, Drupal no longer uses CVS/SVM but switched to git instead.

I am working on a Windows machine, but I commit/checkout to linux server using tortoiseSVN.

There is an old nice tutorial movie by Jonathan Lambert about how to search into SVN on GotDrupal.com on how to search into http://www.searchdrupal.org/ but searchdrupal.org no longer exists.

I need to know how you guys are building up modules using other people's snippets and how do you find it.
Any solution is precious to me


texts: Display hash anchor tags into drupal 7 menu items without modifying hooks or adding modules?

texts:
currently when path url in menu items are set to: node/1#anchor the anchor is removed.

How would you solve this?


texts: I am using Acquia Dev Desktop 2 for my Drupal 8 project, I tried to download module with Drush. But I can only access the internet via a proxy. How can I configure drush to use the correct http proxy settings for downloading?


texts: How to create nodes from shell script at server?

texts:
I need to create nodes from shell script at my server (some server statistics).

As I know drush cannot add new node. (It was a discovery for me)

So I think make shell script which will create CSV file with node fields and make periodical import by Feeds.

Is there more smart solution?


texts:
I'm trying to determine if I can migrate a site from 6 to 7 with Drush 7. I get this, "Error: Call to undefined function drush_sql_empty_db()", and I did some searching and this function does not seem to exist in Drush 7. On the drush_sup page it says to use Drush 6 or later, which would insinuate that Drush 7 is compatible. Any insight would be appreciated, I'm not in the mood to downgrade my Drush installation.

Thanks!


texts:
I have a Drupal content type that includes Zip Codes (Postal Codes).  An unlimited number of Zip Codes is allowed, and the Zip Codes are defined in the "Allowed Values List" in the field definition.  I have many Zip Codes that I need to insert, and have them staged them and their relationship to nodes in a temporary database table.

I do the following insert to both "field_data_field_zip_codes" and "field_revision_field_zip_codes", but I still do not see the values in the online Content.

Has someone done this type of thing before, and know what I am missing?  I looked at using "Feeds" but that module doesn't seem to support multi-value fields, just flat tables.

INSERT INTO  field_revision_field_wp_zip_codes
SELECT c.entity_type                     AS entity_type
      ,'wp_content_component'            AS bundle
      ,0                                 AS deleted
      ,c.entity_id                       AS entity_id
      ,c.entity_id                       AS revision_id
      ,'und'                             AS language
      ,(@rownum:=@rownum+1) - 1          AS delta
      ,z.zip                             AS field_wp_zip_codes_value
FROM field_data_field_wp_cc_id c
  INNER JOIN cc_zips z
     ON z.cc = c.field_wp_cc_id_value,
     (SELECT @rownum:=0) r
 WHERE z.cc = '1039'
 AND c.entity_id = '3699';


texts:
I created my custom content type 'Proposal' in D7 and used field API to attach fields.
In order to write unit test for it using "simpletest" (core module), do I need to setup my proposal content type in the unit test method from scratch or will the content schema be available to the unit tests?


texts:
We have content inside of D7 template files for pages that are heavily styled—cases where a Body field just doesn't make sense. A front-end developer writes the page like a normal HTML page, and the content goes in.

Search API Solr Search can't pick up the content on these pages though.

Our solution right now is to paste all the content on these pages in to a node's body field and hide that duplicated content, but then there's a fragmentation problem between versions. The body field doesn't go in to source control, and likewise the template's text doesn't go in to the database.

Is there a better solution to indexing content on a hard coded template? (Bonus: Is it less of an issue in D8?)


texts: dynamically populate a select field based on the selection in another field works only the first time

texts:
I am trying to dynamically populate a select field (chamiponship) based on the selection in another field (country).
It works fine when I load the page but just the first time, the second time I select another country it does not work.
Did anyone have this issue and how did you solve?
Here is my code

<?php

function testform_menu(){

    $items['data'] = array(
        'title' => 'data access',
        'description' => 'get acess to the data',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('testform_form'),
        'access callback' => TRUE,
    );
    return $items;
}

function testform_form($form, &$form_state) {

        $form['country']=array(
            '#type'=>'select',
            '#title'=>t('Select your country'),
            '#options'=>array('FR' =>'France', 'UK' =>'England','DE' =>'Germany'),
            '#ajax' => array('event'=>'change','callback' =>'LoadDiv','wrapper' => 'DivSelect',),
        );

        $optionsDiv = array('Ligue 1','Ligue 2');
        if (isset($form_state['values']['country'])) {
            $optionsDiv = loadDivision($form_state['values']['country']);
        }

        $form['champion']=array(
            '#type'=>'select',
            '#title'=>t('Select your championship'),
            '#options'=>$optionsDiv,
            '#prefix' => '
',
            '#suffix' => '
',
        );

        $form['submit'] = array(
            '#type' => 'submit',
            // #value is the text to display inside the button
            '#value' => t('Submit'),
        );

        return $form;
}

function LoadDiv($form, &$form_state) {
  return $form['champion'];
}

function loadDivision($country_id) {
  $data_count=array('FR' => array('Ligue1', 'Ligue2'), 'UK' => array('Premier','Championship'), 'DE' => array('Bundesliga1','Bundesliga2'));
  $championship = $data_count[$country_id];
  return $championship;
}


texts: Should I be concerned about enabling too many modules at the same time?

texts:
I am using features to manage deployment.  I have a controller feature which lists 8 other features I have created as dependencies.  These features in turn together list over 100 modules as dependencies.  Is it ok to simply turn on the controller module and allow it to automatically enable all the other modules, or does Drupal have trouble doing this?

So far when I enable them all at once it seems fine, but I'm just asking to make sure I don't have problems down the line.