texts:
I'm working on a custom migration from Drupal 6 to Drupal 8. Some of the content types have a field used for file attachments (field_attachments).
When I run the migration that connects the files to the nodes, I get this error.

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'title' cannot be null: INSERT INTO {node_field_data} (nid, vid, type, langcode, status, uid, title, created, changed, promote, sticky, default_langcode, revision_translation_affected) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12); Array ( [:db_insert_placeholder_0] => 2064 [:db_insert_placeholder_1] => 3019 [:db_insert_placeholder_2] => forum [:db_insert_placeholder_3] => en [:db_insert_placeholder_4] => 1 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => 1558576761 [:db_insert_placeholder_8] => 1558576761 [:db_insert_placeholder_9] => 0 [:db_insert_placeholder_10] => 0 [:db_insert_placeholder_11] => 1 [:db_insert_placeholder_12] => 1 ) (/app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:847)

The migrate_plus.migration.custom_upload.yml file for the migration contains the following lines.
langcode: en
status: true
dependencies: {  }
id: custom_upload
class: Drupal\migrate\Plugin\Migration
field_plugin_method: alterFieldInstanceMigration
cck_plugin_method: null
migration_tags:
  - 'Drupal 6'
  - Content
migration_group: custom
label: 'File uploads'
source:
  plugin: d6_upload
process:
  nid:
    -
      plugin: get
      source: nid
  vid:
    -
      plugin: get
      source: vid
  langcode:
    -
      plugin: user_langcode
      source: language
      fallback_to_site_default: true
  type:
    -
      plugin: get
      source: type
  field_attachments:
    -
      plugin: sub_process
      source: upload
      process:
        target_id:
          plugin: migration_lookup
          migration: custom_file
          source: fid
        display:
          plugin: default_value
          default_value: 1
        description: description
destination:
  plugin: 'entity:node'
migration_dependencies:
  required:
    - custom_file
    - custom_article
    - custom_forum

From the error message, it appears that Drupal is trying to create a node; even though, I'm actually running the custom_upload migration after I ran the migration of all nodes.
I have migrated the nodes and the files already and I can see all the nodes in the database as well as the files in their directory and the database.
What am I missing?


texts:
What I want to achieve is nested view.

Say I have Content Type 'main' en Content Type 'sub'

How can I create a view that looks like this:

main 1 title
main 1 fields
    sub 1 title
    sub 1 fields

    sub 2 title
    sub 2 fields

    ...

main 2 title
main 2 fields
    sub 4 title
    sub 4 fields

    sub 5 title
    sub 5 fields

    ...

...

Do I need references?

more context:
I know there is something like entity-reference and also the use of tags.
For every sub I placed 'main 1', 'main 2' or 'main 3' as a tag.
I also let every sub refer to content 'main 1' , 'main 2' or 'main 3' with the entity reference (set on main)
I tried already by creating a view of 'main' and a block view for each 'sub' with tag as extra filter. I don't know though how to make the view 'main' implement each 'sub' view and place it in each main node.
Is this clear or do you need more info? If so, which ?


texts: How can I add classes to images added in CKEditor via Media?

texts:
Similar question to How to set width to Media entity image in CKEditor BUT I am trying to do more than insert various sizes of images, I want to add classes to the actual img tag.  So when I insert an image that I've already added to my media into ckeditor, it shows up as drupal-entity instead of img.  Specifically:

<drupal-entity alt="test" data-embed-button="media_browser" data-entity-embed-display="media_image" data-entity-embed-display-settings="{&quot;image_style&quot;:&quot;&quot;,&quot;image_link&quot;:&quot;&quot;}" data-entity-type="media" data-entity-uuid="9467197e-1088-45eb-bbf4-c3970d45fd6e" title="test" class="lightbox"></drupal-entity>

When I save the page it renders as something like

If I add a class like lightbox or dropshadow to drupal-entity it gets applied to the article tag instead of the img tag.  Any way to add classes to inserted images that live in the cool new media functionality?  Seems like there are an endless number of use cases where adding classes to inserted images would be crucial.

Thanks to anyone who can help!


texts:
I'm using Webform Charts.
If I try to call Webform Chart token [node:webform-charts:my_data] on conformation page, it results false formatted output and can not be shown. I think it's because
' is automaticly replaced by '&quot';

Can I disable this replacement?

Thank you very much.


texts:
In Drupal 7, I have a View that works great but I'd like to add a few nodes into the result arbitrarily outside of the scope of the View.

Basically, let's see the View returns Content Type X, I want to include a few nodes from Content Type Y that are in addition to whatever the View generates from Content Type X.

My preliminary thought was to use hook_views_pre_render but I'm not convinced that is the best solution....yet.


texts: When to use Views vs. a hardcoded query?

texts:
I recently took over maintainership of a little module called Suggested Terms and received a feature request to replace the build-in queries with views.

I'm trying to weigh the pros and cons of using Views vs. a built-in query, and I don't really know whether it's worth introducing a dependency on another module, what the performance impact will be, etc.

What guidelines determine when a situation is best suited to Views, vs. using custom queries?


texts:
What I am trying to achieve is I have a drupal site which is basically in English & German. I have installed & enabled all the necessary modules for Translation, and my content is also changing but Menu titles are not translating.

For eg: Categories is a menu and category-1,category-2,...category-n are the sub-menus, so what I am getting is these sub menus are translating in German but Category title is not.


texts: Adding and reading a static HTML page with

texts:
The requirement is that the user can upload a folder, containing static HTML, CSS, JavaScript files, and a link is generated.

So, then I don't want to have any drupal styling whatsoever.

My initial idea

Set a specific content type, allow multiple file upload
Upload all the files to a specific directory via some kind of rules
Access the page at www.example.com/sites/default/files/MYFOLDER/index.html

Do you think this is feasible approach?


texts: "Limit allowed HTML tags" filter is deleting Ckeditor table styles

texts:
I'm using the "Limit allowed HTML tags" filter in my text format and put this to the allowed tags: <th style>

Anyway my table styling <th style="width: 60%;"> added in Ckeditor is filtered out. What have I missed?


texts: Drupal says "e-mail sent" but I don't receive

texts:
I have installed my webserver from a computer at home. On Ubuntu Server, LAMP, everything works fine except email sending.

First I was getting:

  Unable to send email

then I followed these directions.

Then I still got same error. I checked Apache logs and I found

sendmail: fatal: file /etc/postfix/main.cf: parameter myhostname: bad parameter value: myservername.{null}

I changed the file and wrote my website domain like domain.com

At last, Drupal says "Email sent" but I receive no email. What is the problem?


texts: Prevent name collisions on form value flattening?

texts:
The element's name property is declared in the $form array, at the
  very end of the array tree. For example, if an element in the form
  tree was structured like this:
  $form['account_settings']['username'] ?>

  ...then that element's name property is 'username'--this is the key it
  will be available under in $form_state['values'], in your validation
  and submission functions, as the form code flattens the array in this
  fashion before it passes the key/value pairs. NOTE: if you wish to
  have the full tree structure passed to $form_state['values'], this is
  possible, and will be discussed later.

-Source

So, for example, if you have this:

$form['details']['admin'] = array(
    '#type' => 'checkbox',
    '#title' => t('Only admin can view'),
    '#default_value' => variable_get('admin', 0),
  );

You see that you'd be using variable_get('admin', 0);

So what's to prevent naming collisions? Say you have another setting:

$form['more_details']['admin'] = array(
        '#type' => 'checkbox',
        '#title' => t('Only admin can view'),
        '#default_value' => variable_get('admin', 0),
      );

If anyone has a clear explanation as to how this "flattening" works, that'd be great.


texts:
I installed the Subscription module on my site to get forum notifications.
If a user comments on a forum topic, the subscriber gets a notification saying:

  There is a new forum topic “forum topic test” added by sai.

This happens for every comment of the forum post. I need a new comment in place of a new forum topic.

Any solution for this?


texts: Facebook auto post module not posting to my FB page

texts:
When user comments on a particular node the comment title and comment body should be automatically posted to my Facebook page. For this I have used Facebook autopost. I have added my appid in fb_autopost configuration page and it displays the list of pages I manage and I have selected required page. Used below rules for auto posting comment in facebook

{ "rules_facebook_autopost_" : {
    "LABEL" : "Facebook Autopost ",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "fb_autopost_entity", "comment" ],
    "ON" : { "comment_insert--comment_node_theme_display" : { "bundle" : "comment_node_theme_display" } },
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "facebook_publication",
            "param_type" : "link",
            "param_user" : [ "site:current-user" ]
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      },
      { "data_set" : {
          "data" : [ "entity-created:field-facebook-message" ],
          "value" : "[comment:title]"
        }
      },
      { "publish_to_facebook" : {
          "USING" : { "publication" : [ "entity-created" ], "pages" : "1575855786569558" },
          "PROVIDE" : { "facebook_publication_id" : { "facebook_publication_id" : "Facebook publication returned ID" } }
        }
      },
      { "drupal_message" : { "message" : "success" } }
    ]
  }
}

After saving the comment it throws below error and comment not posting in Facebook.

  Facebook SDK threw an error: OAuthException: (#200) The user hasn't
  authorized the application to perform this action

How can I achieve this or Is there any other way to do this. Thanks


texts: connecting words with a integer field in a content type

texts:
I would like to have a content type with the following behavior.

A dropdown list with words that can be selected, when a user selects on or more words these words are added to the node. But every word should have an integer value connected to it, and these values should also be stored in the node.

The problem i'm having is i don't know how to connect the word with the integer value.

This is for a site where there is a periodic maintenance to equipment. The used spare parts in the maintenance would be the words, the integer is the price of the maintenance part. Afterwords i would create a view to add the total value of the integer so the technician can easily see how much the total value is of the used spare parts.


texts: Cache pages/variables in hook_preprocess() for anonymous user

texts:
So I am having trouble understanding the caching of variables set in hook_preproccesses for anonymous users. It seems that the entire page is cached, and not rebuilt, even when set to no caching. With the following simplified example I am troubleshooting:

/**
* Implements hook_preprocess_node().
* @param $variables
*/
function hook_preprocess_node(&$variables) {

  $variables['testing_1'] = [
      '#markup' => date('m/d/Y h:i:s a', time()),
      '#cache' => ['max-age' => 0]
  ];

  $variables['testing_2'] = date('m/d/Y h:i:s a', time());
}

then in twig template:

{{ testing_1 }}

{{ testing_2 }}

Both seem to work fine for logged in users, but these variables never seem to update for anonymous users except upon:

Manually clearing cache
Saving content on the node, which then clears node cache.

Even when page caching is set to "no caching" on /admin/config/development/performance, but that does not seem to matter. Its as though the hook_preproccess does not run for anon users once first page hit from anon user happens.

It seems like from Anonymous user cache control and others, this is due to internal page cache module. Uninstalling this DOES solve the problem, but I am unsure that this is the best way to solve this issue, especially since it is enabled by default. Per the docs, internal page cache says "This module assumes pages are identical for all anonymous users". This is true, I simply want the pages to rebuild (rerun the preproccess hook) for ALL anon users when page cache (set on /admin/config/development/performance) clears.

After a day or so of troubleshooting, I am considering simply creating a cron job to flush caches at this point, but there has to be a better way I am missing. What is the best way to ensure that pages rebuild for anonymous users after a set time?


texts: Drupal 6 Image Resize Thumbnail Maintain Aspect Ratio

texts:
We have a content type which has an original image.  There is also a resized version which is not a thumbnail, but not the original size either which is used on a drill down page.

What is the best way to maintain the image aspect ratio for this drilled down page image?  I've found some functions, but is there a module or best practice way to do this?


texts: How to update the google fonts provided by @font-your-face module?

texts:
I have enabled the @font-your-face module. Then I'm able to use google fonts in my site. Problem is that the list of fonts in the google directory shows more than 500 fonts: fonts but I just have 300 fonts available.

I need a font called Imprima. Is there any way to include this one in the @font-your-face module.

The module is updated to the last version.


texts: How do I tell if the current revision is the published one

texts:
I'm loading each entity and trying to see whether or not the entity is the latest revision.

  $query = db_select($entity_items['revision table'], 'revision')
    ->fields('revision', array($entity_items['id'], $entity_items['revid']))
    ->condition('revision.' . $entity_items['id'], $data->$entity_items['id']);
  $revisions = $query
    ->execute()
    ->fetchAllAssoc($entity_items['revid']);

  $entities = array();
  foreach ($revisions as $key => $revision) {
    $loaded_revision = entity_revision_load($entity_key, $key);
}

The $loaded_revision object has multiple keys that could be related to whether this revision is the current published revision.

This is at the bottom of the object:

[path] => Array ( [pid] => 1256 [source] => node/18205 [alias] => content/path [language] => en-US ) [workbench_moderation] => Array ( [current] => stdClass Object ( [hid] => 47961 [vid] => 39926 [nid] => 18205 [from_state] => published [state] => draft [uid] => 0 [stamp] => 1387146582 [published] => 0 [current] => 1 [title] => Title [timestamp] => 1387146582 ) [published] => stdClass Object ( [hid] => 45461 [vid] => 37599 [nid] => 18205 [from_state] => published [state] => published [uid] => 4 [stamp] => 1375802201 [published] => 1 [current] => 0 [title] => Title [timestamp] => 1387146582 ) [my_revision] => stdClass Object ( [hid] => 42605 [vid] => 35755 [nid] => 18205 [from_state] => published [state] => published [uid] => 4 [stamp] => 1371655937 [published] => 0 [current] => 0 [title] => Title [timestamp] => 1371655937 ) ) )

From what I'm reading, vid 37599 is the current version? Is that correct? Would it be based on the published and current key?

It seems that if current is 1, and published is 1, then that would mean that the revision is the current published revision.


texts: How do you add information text to a Drupal 7 form?

texts:
I have this:

$form['rate_the_room']['room_rating'] = array(
  '#type' => 'radios',
  '#title' => 'How would you rate the room you stayed in?',
  '#options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5),
  '#default_value' => isset($values['room_rating']) ? $values['room_rating'] : NULL,
);

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

This will produce a radio button block where you can select the rating for a room and then a submit button right after it. I want to be able to add a block of text inbetween these two elements. That block should be:

Hello

Is this possible or would I have to somehow make it part of the actual fields?


texts: Fetch images across the internet with File API

texts:
How can I use the FileAPI to fetch an image from another website via URL, and bring it into Drupal? Here is what I tried:

foreach ($data['photos'] as $item) {
            $photo = file_get_contents($item['url']);

            $filename = $entity->field_id['und'][0]['value'] . '-' . $x . '.jpg';

            $file = file_save_data($photo, 'public://' . $filename, FILE_EXISTS_REPLACE);

            if (is_object($file) && file_exists($file->uri)) {
                $file->status = 1;
                $file = file_save($file);
                drupal_write_record('file_usage', $file);
                $entity->field_entity_image['und'][] = (array) $file;
                $x++;
            } else {
                // error
            }
        }

It doesn't quite work. The first time around it grabs some of the photos, then the second time around, it should remove any photos in the system and resave them (even if none changed), I have no way to tell if the remote file is new or not.


texts: Entityform - "The form has become outdated." error

texts:
I have an entityform that appears on a page, for some reason the form will not submit ...

// implement hook_menu

function foiagen_menu() {
  $items['node/%node/foiagen'] = array(
    'title' => 'Foia Generator',
      'description' => 'A foia generator form.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array('foiagen_form', 1),
      'access callback' => TRUE,
  );
return $items;
}

// embed the form (it's an entityform).

function foiagen_form($form, &$form_state) {
  module_load_include('inc', 'entityform', 'entityform.admin');
  $entity_form_name = 'foia_generator';
  $render_estimate_form =
    entityform_form_wrapper(entityform_empty_load($entity_form_name), 'submit', 'embedded');
  $form['foiagen'] = $render_estimate_form;
  return $form;
}

function foiagen_form_validate($form, &$form_state) {
}

function foiagen_form_submit($form, &$form_state) {
}

I have tried to wrap my head around this solution but cannot figure out where, once my form is rendered, filled and the submit button pressed the 'update' occurs that makes the input void...

I have seen the comment here and tried adding

 $form['#token'] = NULL;

to my 'function foiagen_form' that does circumvent the 'The form has become outdated.' error but leads to a blank page. Indicating that perhaps something else altogether is malfunctioning.

  following direction from answer came up with this:

function foia_generator_form($form, &$form_state) {
  form_load_include($form_state, 'inc', 'entityform', 'entityform.admin');
  $entityform = entity_create('entityform', array(
    'type' => "foia_generator",
  ));
  $form = entityform_form_wrapper($entityform);
  return $form;
}


texts: What's the purpose of the type "block_settings" in schema.yml files?

texts:
In the block_example module, from the Drupal 8 Examples for Developers,
what purpose does the file block_example.schema.yml serve?

I'm familiar with using schema.yml files to set configuration and access it like so:

$config = \Drupal::config('system.maintenance');

However, it appears that the "block_settings" type is different.


texts: How do you add taxonomy with fields to page--node.tpl.php?

texts:
I am trying to add to my node pages a taxonomy listing that includes fields I've added to the taxonomy. I'm able to add the field from the corresponding note into my page--node.tpl.php file with the following code:

<?php $field_country = field_view_field('node', $node, 'field_country');
     print render($field_country);
?>

Unfortunately this does not output the corresponding field I've attached to the taxonomy, which is an image field that contains a flag for the country.

Is there a way to print this field into page--node.tpl.php using Drupal 7 and no additional modules? It would be very useful to use these fields attached to taxonomy for more than just the taxonomy pages.

Thanks for the help!


texts: How to delete cache after updating/deleting/adding new content using hooks?

texts:
We have a custom services module and a site in Drupal 7, and I got the task to delete the cache after the editor adds new content or update the existing ones.

I've read about a module called Cache Actions, but, as i said, i need to create the function on my custom module.

Also, I've started reading about Drupal hooks, but still don't have a clue of how to implement this task. Any suggestions? Thanks.


texts: Display content type images using taxnomy

texts:
In a drupal block view that I have created I am currently displaying the images and title of a certain content type. On that content type I have two taxonomy term fields one is a multi-select box

My question is this, I want to filter the title and images according to the taxonomy multi box field when a node is displaying, how?

For example if I have a multi list

water
coffee
tea
drupal
views

On creating the node I select water and drupal so when the node displays it will show all the images and titles that have the same taxonomy term in the block view

Below I have an image of a view that is trying to displaying an image and title according to the taxonomy terms save on a node that a user is currently looking at

It is not working of course. Do I have the right idea what am I missing?


texts: How do I change and translate the "completion message" in Commerce checkouts?

texts:
I want to change the text of the "completion message" that is shown when an order is paid for successfully.  I also want to translate this message.

By default, the completion message text is:

Your order number is 1.
You can view your order on your account page when logged in.

I'm using Commerce 2 with Drupal 8.4.1.

By default, at /admin/commerce/config/checkout-flows/manage/default, the checkout flow looks like this:

There is no option to edit the completion message.  Also, there is a translate link at the top of the page, but this translate link only lets me translate the name of the checkout flow, not the completion message.

So how do I edit/translate the completion message?


texts: Returning an array of all content types in a folder

texts:
I exported all my configuration files to config/sync.
Now i'm trying to get all the content types from that folder into an array.

Its a bit like what this code does:

$manager = \Drupal::entityTypeManager();

$manager->getStorage('node_type')->loadMultiple();

But that returns all the Installed content types on my drupal.
I just want the ones from my sync folder because i'm making twig templates from them.


texts:
I add a new text field that called real name(for entering the real first and last name).
And a "selection filed" that user can select his field between A to D.

Now for registration we have 5 field.

Email
Username
Password
Real name
"Selection field"

And I have an Excel file that contains about 500 users data(all data are in there such as user name and password and ...)

Now I need a similar code to register them automatically in my drupal site.

How?

Note:In the "selection field" the choice are such as First-one First-two and so on.

Example:this is a similar column in my excel file

Username     password     realname     Email     SelectionFild
12321        12321        Mr.Bin       -         F1

Note:in this example - in the Email means the user haven't Email address.
And F1 in the selection field means First-one.


texts: Solution to broken MEDIA 1.X module Image embed + CKEditor. the final submit button doesn't work

texts:
Latest stable Drupal 7, Media 1.x, and CKEditor module (with latest CKeditor library).

When you go to upload an image, and embed it inside of the body area, the final submit after you've uploaded your image, or chosen an image from the library, button doesn't work.

It just generates a nasty javascript error.

see the screen shot here : http://alphex.com/z/js_errors-20130507-124341.jpg

Anyone seen this, have a solution?

Thanks.


texts: How to Send an email with the list of products ordered in its body?

texts:
I created a rule and a component, to send an email to my customers 7 days after their orders. This email asks them to leave a comment on the products they have purchased.

My problem: I can not retrieve the list of products in the email. With [order:commerce_line_items], the e-mail displays "No order items found".

Here is the export of my rule :

{ "rules_schedule_follow_up_email" : {
    "LABEL" : "Schedule follow-up email",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_scheduler", "entity" ],
    "ON" : { "commerce_order_update" : [] },
    "IF" : [
      { "data_is" : { "data" : [ "commerce-order:status" ], "value" : "processing" } }
    ],
    "DO" : [
      { "schedule" : {
          "component" : "rules_send_follow_up_email",
          "date" : "now",
          "identifier" : "Follow-up email for [commerce-order:order-id]",
          "param_order" : [ "commerce-order" ]
        }
      }
    ]
  }
}

Here is the export of my component :

{ "rules_send_follow_up_email" : {
    "LABEL" : "Send follow-up email",
    "PLUGIN" : "action set",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : { "order" : { "label" : "Order", "type" : "commerce_order" } },
    "ACTION SET" : [
      { "mail" : {
          "to" : "[order:mail]",
          "subject" : "Votre avis nous int\u00e9resse",
          "message" : "[order:owner],\r\n\r\n\r\nvous recevez ce courriel car vous avez r\u00e9cemment fait un achat sur notre site. Nous aimerions avoir votre avis sur les produits que vous avez command\u00e9.\r\nC\u0027est simple et rapide, il vous suffit de cliquez sur les liens ci-dessous :\r\n\r\n[order:view-url]\r\n\r\n[order:commerce_line_items]\r\n\r\nMerci pour votre retour d\u2019exp\u00e9rience. Nous appr\u00e9cions le temps que vous prenez et nous l\u0027utiliserons activement pour am\u00e9liorer notre boutique. \r\n\r\n\r\nCordialement,\r\nL\u0027\u00e9quipe [site:name]\r\n[site:url]\r\n\r\nPour rester inform\u00e9 des nouveaut\u00e9s et b\u00e9n\u00e9ficier de nos offres promotionnelles, suivez-nous sur :\r\nhttps:\/\/www.facebook.com\/S1biosecom\r\nhttps:\/\/twitter.com\/S1biosecom\r\nhttps:\/\/plus.google.com\/+S1biosecom\r\nhttps:\/\/www.pinterest.com\/S1biosecom\r\n\r\nPS : ceci est un mail automatique, merci de ne pas y r\u00e9pondre.",
          "language" : [ "order:owner:language" ]
        }
      }
    ]
  }
}

I want to display in my email, the links to the product pages ordered by my client. How can I do so?


texts: Add element inside main menu block, but outside navigation

texts:
I need to add an element somewhere within, or directly before/after, the main menu block. For example, the generated HTML should be something like this:

            About

                General Info

Video

I am currently trying hook_block_view_alter() and have tried multiple variations of something like this:

function theme_block_view_alter(&$data, $block) {
  if ($block->delta == 'main-menu'
    && $block->region == 'menu') {
    $data['content'][] = array(
      '#markup' => '
Close Mobile Menu
'
    );
  }
}

which is the closest I have come.  This adds the div within ul.menu (top level) after the last li element; that won't work.

I can't seem to find a theming function for the menu as a whole, just theme_menu_links().  I see the theme wrapper menu_tree__main_menu within $data in hook_block_view_alter(), but I don't see a file or function that resembles that.

I'm aware that there may be a much better solution that I'm just not thinking of, so I'll state the final goal:

Absolute positioned menu. (I can work with #main-navigation being absolute and the element coming after it or with ul.menu being positioned, and the element coming after it.)
A link that follows the menu in markup, but is outside of the absolute positioned menu, so that I can position relative to window, not the ul.

Thanks!


texts:
I'd like to block access to all taxonomy pages for anonymous users.

For example I don't want them to be able to view http://website.org/category/year/2525 or http://website.org/taxonomy/term/42.

Is there even some built-in functionality to achieve that? I'm using Drupal 6.


texts: Disable creating new taxonomy terms in term reference field

texts: I need to limit the user to the already create terms through admin/structure/taxonomy/VOCABULARY/add in auto complete mode, But when the user types new terms it will be added to the list. How do I can limit the user to the terms list?


texts: How to prevent users from uploading the same file (image) multiple times?

texts: I have a content type, Image, which allows users to add an image using Drupal 7's built-in image field.  I would like to automatically prevent users from adding the exact same image (same filename, same size) if possible.  Is there any way to prevent duplicate file uploads?


texts:
I'd like to issue free Commerce Licenses to files for users of certain roles without creating orders.

I haven't been able to find a tool for this in the Commerce License UI. Have I missed it? Or is it possible to create such a tool without having to code?

Thanks in advance for your answers


texts:
I have a Drupal 7 webiste. I want RSS feed from a few views in my Drupal webiste.
I am able to get the feed but the .xml file has a lot of CSS styling in the description tag which is causing me some issues in the RSS reader.
I want to get rid of the CSS styling in the description tag.
Can anyone help ?

Thanks.


texts: Adding JS to field widget being created in my module

texts:
Cross-posting to stackoverflow.com

I am creating a custom field to eventually be displayed in a custom paragraph.  I need to upload a JS file for the widget view, but can't seem to get it to work.  Can anyone see what I am doing wrong or need to do differently?

I can add the field to the paragraph, add the paragraph to a document and see the fields, but I see no evidence of the JS being attached (the file is not downloaded in the browser and does not activate).

Any help or suggestions are appreciated.

file: src/Plugin/Field/FieldWidget/get_libguides_listings_widget.php:

<?php

namespace Drupal\get_libguides_listings\Plugin\Field\FieldWidget;

use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
use Drupal\Core\Form\FormStateInterface;

class get_libguides_listings_widget extends WidgetBase {

  /**
   * {@inheritdoc}
   */
  public function formElement(
               FieldItemListInterface $items,
               $delta, array $element, array &$form,
               FormStateInterface $form_state) {
    $element['Subject_IDs'] = [
      '#type'=>'textfield',
      '#title'=>$this->t('Subject IDs to Display'),
      '#description'=>$this->t('BLAH'),
      '#default_value'
           =>isset($items->getValue()[$delta]['Subject_IDs'])
          ?$items->getValue()[$delta]['Subject_IDs']
          :'',
      '#states'=>[
        'visible' => [
          [':input[name$="default_value_input[field_libguides_listing][0][SearchBy]"]'
                =>['value'=>'subject']],
          'or',
          [':input[name$="default_value_input[field_libguides_listing][0][SearchBy]"]'
                =>['value'=>'both']],
        ],
      ],
    ];
    $element['Subject_IDs']['#attached'][]
          = 'get_libguides_listings/get_searchby';
    return $element;
  }
}

file: get_libguides_listings.libraries.yml:

get_searchby:
  js:
    js/get_searchby.js: {}
  dependencies:
    - core/jquery
    - core/drupal
    - core/drupalSettings

file: js/get_searchby.js

/**
 * @file
 */
(function(){
  alert('hello there');

  (function ($, Drupal)
  {
    Drupal.behaviors.get_searchby = {
      attach: function (context, settings)
      {
        alert('hello');
      }
    };
  }(jQuery, Drupal));
}());


texts: How to hide the link for creating certain content type?

texts:
I am trying to make a reservation system for equipment in a laboratory. People reserve equipment by creating "reservation" nodes. Some fields in the reservation node already have values, determined by the way the (registered) users reached the "form", and the values can´t be changed by them.
I don´t want the registered users to have access to create the reservation node through the "Add content -> Create Reservation node" way.
How to "hide" that option in the add content menu? (as they do have permission to create the reservation node)


texts: Unable to retrieve value from settings file inside custom module

texts:
I have some specific values that will never change. I could use define and set them as constants but having a module_name.settings.yml file seems more appropriate.

The problem is that I can't seem to get the values from that file. It always ends up in null.

I have a module my_module in docroot/modules/custom', it's installed. Inside the root of the module I've created amy_module.settings.ymlfile with a single entry ofhello: 'world'`.

I've tried retrieving it using:

(\Drupal::config('my_module.settings'))->get('hello')

But the returned value is null. According to the documentation it should be working fine.

I'm using Drupal 8.

What am I missing here?


texts: Fields created by a Feature generated module remains after disabling the module

texts:
In my-site-com I created a new feature to show the component: fields , then I added some fields, I download the feature as a module called my-feature-module, then I saved and enabled this module in other drupal installation my-site-2.com.

I get all the fields properly. So far so good.

Now I disabled the module my-feature-module in my-site-2.com and the problem is that the fields are not removed, they remain there. Is this normal? I mean, expected the fields to disappeared if I disable the module.

I make sure I cleared all caches and updated database, just in case it was a cache problem, but problem still persist.


texts:
I need to build a view with image  width and height available in the node  devel tab (see image). In the view field list, I can't find those.

How can I have these values in my view?

note: Having this data already, I prefer not to install more modules as exif or similar.


texts:
Hi I'd like to alter some of the CSS on the Commerce Kickstart theme, but when I try to create a sub theme by following these instructions https://drupal.org/node/819170 I end up with an unformatted theme. This isn't what I want, I want to alter the current Kickstart theme but from the sites/all/themes subfolder.

I've created a subtheme based on omega, omega_kickstart, but these leave me with no css formatting at all.

I've copied the profiles\commerce_kickstart\themes\omega_kickstart folder to my sites/all/themes, renamed the info file etc.. this left me with partial formatting.

one thing I noticed from the dom entries is css come from various folders, i.e.
alpha, omega.

anyone know how to create a successful subtheme here?


texts: How do I stop content overlap with Display Suite on mobile/narrow screens?

texts:
Building a site where sugar glider breeders and vendors can list their businesses and wares and find informational articles, links to exotic vets, and more.

The site is built on Drupal Core 8.2.7 with Adaptivetheme 8.x-2.0 and uses Display Suite 8.x-2.6 with the Fluid two column stacked layout applied to the Full Content view to display business information in a columnar format with contact info and links on the left and tags from several Taxonomies on the right. Field Group 8.x-1.0-rc6 was used to construct several Fieldset groups, and custom CSS was applied to those fieldsets to give them a unique look and border.

This works pretty well on desktop displays, tablets, and some landscape smartphones:

But looks awful if you narrow down a desktop browser or view the site on a portrait smartphone. The boxes adjust well down to a certain size, then "responsive" goes out the window and they start overlapping. The About Us section is in the Footer of the Display Suite layout, so it is unaffected.

The site exhibits the same behavior, where the Right and Left Display Suite regions overlap on small displays instead of stacking (as would seem logical), regardless of whether the fields are in a Field Group or whether any custom CSS has been applied. This leads me to believe it is something to do with Display Suite, but I have not been able to find any way to control how its regions are rendered. I can control the flow of regions for the theme (e.g. Sidebar 1, Main Content, Sidebar 2) from the theme's Layout settings, but I cannot find any similar functionality for Display Suite regions.

I assume this is possible because my other site (built on the same Drupal Core, Adaptivetheme, Display Suite, and most of the same modules) stacks its content vertically when the screen gets too small. The only significant differences I can think of are that the other site is mostly text next to images or videos rather than text next to text like this one, and the other site's Display Suite layouts are applied to Paragraphs instead of being applied to the Content type directly.

Any thoughts for what may be causing this and how to resolve or work around it are welcome.


texts: How to display View contents in a drop down select list?

texts: I have a View which display the title field of content of the type Partners. However, I want to format the results in a drop-down select list, so when a user selects one of the titles, it will automatically redirect the user to the content page. How can I achieve this?


texts: Clearing Acquia Varnish Cache when any content gets updated

texts:
I have a drupal 7 site on acquia and everytime one of my editor makes  changes to content, I have to manually clear the varnish cache for him. Is there a way to fire this clear cache everytime he saves a content? Also clear cache doesnt work, as I have to goto the acquia admin panel and click on clear varnish cache. What are some work arounds to this?

I actually have the Acquia purge button, is this what is used to clear the varnish cache? But it seems like that is failing:


texts: Automate the product creation and the related node

texts:
I've a View that shows me some data from an external system (Moodle Views).
I want to add the functionality to create a new product (using the Commerce module) with
the main fields automatically filled and then create the related node to show the product
also filled.
The user should view only the filled form for the new node, not the intermediate passage
of creating the product.

What is the best way to do it (both via code or using some module)?
I just need a starting point.


texts: Removing entity queue entries from a view

texts:
I have a list of 100 projects. I have set 10 projects as featured projects using Entity Queue module.

I have a projects page that shows has two views:

First view: 10 projects from entity queue
Second view: all 100 projects

The issue is the 10 projects are showing up twice on the page, is there a way to remove the entity queue featured projects from the second view?

Any help?


texts: media entity browser base view is missing

texts:
What happened to the base view for Media Entity Browser?

Following this tutorial:

https://www.easternstandard.com/blog/2017/12/drupal-media-bundles-media-browser-cropping

I made all the changes since Media Entity is now in core, but I googled and could no mention of what happened to Media Entity Browser. Is it now in core too?


texts: AJAX error: node form + list field with multiple options + image field

texts:
I'm trying to add an AJAX callback to a list field with multiple selection enabled. This works properly on its own, but if I add an image field, the form will throw errors when 2 or more fields are selected.

Here's my setup:

Blank installation of Drupal 7 + image + list modules.
Create a "Sample" (machine name: sample) content type.
Add an image field ("Image").
Add a list field with possibility to select unlimited values ("List").
Enable the custom module below.
Try creating a new node and select 2 options in the "List" field. This will throw the following AJAX validation error:
"An illegal choice has been detected. Please contact the site administrator."

Code:

//
// File: sample.module
//
function sample_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'sample_node_form':
      $form['#id'] = $form_id;
      $form['field_list'][LANGUAGE_NONE]['#ajax'] = array(
        'method' => 'replaceWith',
        'wrapper' => $form_id,
        'callback' => 'sample_form_alter_ajax',
      );
      break;
  }
}
function sample_form_alter_ajax($form, $form_state) {
  // Of course, my logic will be added here.
  return $form;
}

//
// File: sample.info
//
name = Sample
description = Sample
package = Sample
core = 7.x
version = 7.x-1.0

Am I doing something wrong or is this a bug in image.module?
Is there anything I need to change in the way I set up my AJAX callback?

Thanks!

Update 1

The problem can be further narrowed to any file upload field. Here's a sample module that can be used standalone to replicate the issue. No need for creating content types.

sample.module file content:

function sample_menu() {
  $items['sample'] = array(
    'title' => 'Sample page',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('sample_page_form'),
    'access callback' => TRUE,
  );

  return $items;
}

function sample_page_form($form, &$form_state) {
  $form['#id'] = 'sample-page-form';
  $form['list'] = array(
    '#type' => 'select',
    '#title' => t('Select something'),
    '#options' => array(
      'option1' => t('Option 1'),
      'option2' => t('Option 2'),
      'option3' => t('Option 3'),
    ),
    '#multiple' => TRUE,
    '#ajax' => array(
      'method' => 'replaceWith',
      'wrapper' => $form['#id'],
      'callback' => 'sample_page_form_ajax',
    ),
  );
  $form['image'] = array(
    '#type' => 'file',
    '#title' => t('Test fileupload field'),
  );

  $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Submit the form',
  );

  return $form;
}

function sample_page_form_ajax($form, $form_state) {
  return $form;
}

Update 2

This seems to work properly if the field type is changed to checkboxes instead. Not a real solution though, just a workaround.


texts: Workbench: How can I reorder display of Workbench Tabs?

texts:
I'm running Workbench, workbench access, workbench moderation and workbench media on Drupal 7.
I added a new state "Needs publish" for "Waiting to be published", which is under "Configuration > Workbench > Workbench Moderation > States tab". Also, I cloned the "Needs review page" view for "Needs publish page"(just changing the filter "Workbench Moderation: State" to "Needs Pulish"). However, the new tab I have for "Needs publish" is in between "My Drafts" and "Needs Review".

Question: How can I move the new tab "Needs Publish" after "Needs review"?

--- Added screenshot on July 23, 2014 at 1:49pm


texts: How to limit the display of a field on the front end, based on a Form API state

texts:
Following on from a previous question.

I have a slideshow field, an image field and a video field, but I only want editors to choose one of these.

Using Form API states I have created a form_alter in a custom module which reveals one input field at a time based based on a choice from a select list. This is working fine. Code below.

    <?php

    /**
     * Implements hook_form_alter().
     */
    function mymodule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface &$form_state, $form_id) {
      $form['field_slideshow_image']['#states'] = [
        'visible' => [
          'select[name="field_selection_display"]' => ['value' => 'slideshow']
        ]
      ];
      $form['field_image']['#states'] = [
        'visible' => [
          'select[name="field_selection_display"]' => ['value' => 'image']
        ]
      ];
      $form['field_video_embed']['#states'] = [
        'visible' => [
          'select[name="field_selection_display"]' => ['value' => 'videoembed']
        ]
      ];
    }

This method makes for a good UI, but it does not prevent more than one field being populated. Therefore I need to extend the module to;

1). Prevent an editor populating more than one field, perhaps by displaying an inline error message.
OR
2). Limit the display on the front end, to the field which has a visible state (based on the selection list choice).

My feeling is that number 2 would make for the best UX, but it would be good to try both.

How would I go about this?


texts: Drupal 7 commons AJAX bulk operations active queue error

texts:
Drupal 7 commons site with private trusted contacts enabled. When the accept trusted contact or break contact button is clicked this error appears.
An error has occurred.
Please continue to the error page

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /en/batch?id=6305&op=do StatusText: Service unavailable (with message) ResponseText:
ERROR PAGE - An error occurred while processing views_bulk_operations_active_queue_process with arguments: views_bulk_operations_active_queue_process
I have tried searching and this error seems quite wide with no results.
How do I resolve this?


texts: Making a Dashboard for admins to manipulate content

texts:
So I started customing the Drupal Dashboard to add nice views of content and site-users to make it user-friendly for the content managers. However when I went to test it with a content manager account, the Dashboard was empty. Upon further research, it would seem that the Dashboard is unique for each user.

Is it possible to create a single Dashboard that will appear for all content managers?

Edit:

I'm pretty sure the content managers have enough permissions. They have all permission on content, access to admin bar, access to dashboard, administer blocks, add/delete users.
With these permissions all the stuff I have in the Dashboard should be available to them.


texts: I know I can set "default value" for textbox in D7 webform. Unfortunately, user needs to remove the default value and key in their own information. Actually I want something like placeholder feature. How to do this setting?


texts:
I have Multi-Language website, I need this website to migrate new Drupal website.

I can use node export module for export the content; however, I have a multi-language site, how should I handle those translation nodes ?


texts: wysiwyg module and imce missing upload button

texts:
I am attaching an image....i have wysiwyg module with cke library and also imce module and imce bridge module.

When I click browse to upload images, i get a nonfunctioning screen....It does not work at all. no upload buttons. And there are jquery errors in developer. I updated jquery update to version 3 but still nothing.

I have selected 1,7 version jquery for administration, 1.10. default drupal jquery...nothing works....


texts:
I need to display a custom block on my homepage. This custom block retrieves some data that are not managed by Drupal. Since no event will happen in Drupal to say that those data have changed, the max-age cache property seems the way to go, and it's OK for me. The block appears exactly as expected, but the problem is thst the cache for this block seems to never expire. Actually, the block is never refreshed.

After researching, I found Setting cache max-age to 0 has no effect on Block built using BlockBase? that explains max-age cache property doesn't work as expected for anonymous requests. After adding the mentioned trigger, everything seemed to be all-right on my development environment.
Once on the production environment, it's the same as before: The block is never refreshed. Talking to the hosting provider, I was told that Varnish is used to cache the whole page, and I should use an ESI (Edge Side Include) to render this block with its own cache logic managed by Varnish.

I don't really know how to implement it in a clean way in Drupal. My first idea is to use a controller, render the block markup, and return in a response, forcing the needed cache-control header. This is the code I thought of for such controller.

$block_manager = \Drupal::service('plugin.manager.block');
$plugin_block = $block_manager->createInstance('my_block_id');
$buildedBlock = $plugin_block->build();
$renderedBlock = \Drupal::service ('renderer')->render ($buildedBlock);

$response = new Response(
    $renderedBlock,
    Response::HTTP_OK,
    array('content-type' => 'text/html')
);
$response->setSharedMaxAge(60);
return $response;

I feel it is a totally unclean way to do this. Does anybody a better approach to propose? Would my code work?


texts: Theme mobile optimization and upgrade suggestions

texts:
I am running a medium trafficked Drupal 6 site with some custom modules, theme and a few thousand nodes. Our major woe is optimizing the site for different media displays or just responsify the current custom theme, and perhaps upgrade to Drupal 7 along the way.

What do you suggest about the following pathways?

Should I not worry about upgrading to Drupal 7, create a seperate jQuery mobile site and separate the mobile traffic to m.domain.com using domain module? It is very challenging to make themes responsive in Drupal 6.
Upgrade to Drupal 7, recode the theme to be responsive. But by the finish line, Drupal 8 would have matured enough. Should I even bother to upgrade to Drupal 7?
Wait for Drupal 8 release

Which one would you choose and why? Or any other optimal suggestions?

Cheers
[raises a pint of IPA]


texts: Localize nearest store to a zip code in Drupal 7

texts: I just want to let the user enter a ZIP code, and return the nearest store from the database. I have read and I am trying Module Location + Gmap (for visual input), but I think that this module stores all data in a database. Wouldn't it be more reliable to go through a service like Google GeoCode or something? I would appreciate insights from people who has managed this problem before, as somehow I am confused with many different options available in the contributed modules.


texts: How to delete a particular variable from a configuration created by a custom module

texts:
I have created a custom module and a configuration say 'abc_settings'. This configuration creates a variable for each vocabulary present on the site like vocab1_options, vocab2_options, vocab3_options etc.
I want to delete 'vocab1_options' when vocabulary 1 (vocab1) will be deleted. How to achieve this ?


texts: How do I stop Xpath Parser from auto-calculating my timezone?

texts:
When I upload an XML file using the Xpath Parser, Drupal subtracts 8 hours to account for my Pacific Time Zone. This isn't helpful, as it requires for me to convert time in my head.

Is there any way to prevent Drupal from performing this automatic conversion? It works fine when I input nodes manually.

Example:

<activity>
    <date>2015-03-09 00:00:00</date>
    <time1>2015-03-09 9:00:00</time1>
    <time2>2015-03-09 10:00:00</time2>
</activity>

This returns...

Date: March 8th
Time1: 1:00:00
Time2: 2:00:00

When I want it to return...

Date: March 9th
Time1: 9:00:00
Time2: 10:00:00


texts: Is it possible to leverage browser caching?

texts:
I have ran a site through Google Page speed insights and one of its recommendations is to leverage browser caching for https://www.google-analytics.com/analytics.js.

Is this possible on a Drupal site?


texts:
I have a view with several tiers of arguments, navigated like so:

Camp > Date > Photo Gallery

I need a way to display a block of all the tags associated with the given content. So when Camp is selected, I need to display the tags associated with content for that camp. When Date is selected, I need to display the tags associated with content for that date AND that camp.

I've tinkered with Panels, I've installed EVA, I tried Views Field, and I just can't figure out how to do this thing.


texts:
I need to store a lot of data; the exchange rate for 42 currencies, every 15 minutes (collected via API). My current plan is to use a custom entity type (ECK) which simply stores the following properties (no fields):

Datestamp
Currency ID
Exchange Rate

In a year, this would be 1.4 million entities. I wonder if I should do something more like this:

Datestamp
Rate For USD
Rate for GBP
Rate for CNY
Rate for EUR ...

Which in a year would result in 35,000 entities. We will be adding more currencies overtime, so it would scale better too.

Which is the best method as far as Drupal is concerned (or maybe something else)? It will be used in to convert transactions from one currency to another, whilst retaining the exchange rate at time of transaction (hence the datestamp).

Thanks,
Paul.


texts:
I'm trying to migrate from drupal_write_record() to db_insert() / db_update(),
but db_insert() returns a weird key instead of the last inserted key.

On an empty table, I'm doing an insert, and instead of real row number (suppose to be 1, right?), I'm getting a wrong one.

$fields['created'] = REQUEST_TIME;
$fields['uid'] = 1;
$insert = db_insert('table')->fields($fields);
$last_insert_id = $insert->execute(); // suppose to be 1, but = 43587087

Any ideas?
Thanx.


texts:
I have 3 userpoint categories: Points, Fines and Bonus. I'd like the Total category to only track the Points and Fines category, while the other Bonus category is tracked separately.

I know the Category ID number, used in the database, for each separate category if that can the process any easier.

Is there anyway to edit what factors into the Total (all categories) section on Userpoints?


texts:
My module provides a configuration form which allows to select a content type and on submit 2 new fields will be added to the selected content types.

I want to add these fields to the content types programmatically and I tried this using hook_entity_bundle_field_info but the fields don't get saved.

How can I save the fields? And how can I delete the fields (if the user changes the content type in the configuration form)?


texts: I need to update a longblob value in the variable table using variable_set

texts: This would be in an install file in a module.  The purpose is to create setting for a module that is already installed (the module is node_revision_delete).  I know how to use variable_set to change a value in the variable table but not when it is longblob. Do I just use the variables from the module?  Do you know of any examples I could look at?


texts: Add static images to bottom of view page

texts: I have a view called Courses, which outputs an table of college courses. I'd like to add two standalone images to the bottom of the page. Fairly simple really, but I'm not sure how to implement this layout. How can I achieve this?


texts: load custom CSS/JS for each CKEditor instance on page

texts:
I would like to find out  the best way to load custom CSS/JS for each textarea with CKEditor. For me, each Content Type has different CSS/JS and I would like to load them with the CKEditor on that particular page.

How do I hook into the CKEditor module to do just that?

P.S CKEditor is an independent module and not part of WYSIWYG Drupal Setup.


texts:
Drupal has many specific terms that can have different meanings depending on usage (e.g. view vs. a Drupal View). It looks like another in Drupal 8 is plugin & module. Generically, both seem to imply extending functionality to existing code (e.g. FireFox plugin, WordPress plugin, Drupal module, Angular module, etc.). However, it seems like they are 2 different things in Drupal 8.

As I understand it, D8 plugins (the incorporation of CTools plugins in D8?) are reusable components like a form widget, while modules are extensions to Drupal 8 core code that can implement or create plugins. Is this correct?


texts: Is there module that will add a drop down widget that auto-populates with a list of the site users?

texts:
Looking to have a "field widget" that creates a drop down populated with the site's users.  I'm not sure "field widget" is the right term.  I just mean a widget that's used in a field.

Does anyone know of such a module?


texts:
I have 3 products: A, B and C. After the user buy the product A, I want to give the user 5 points, for B 10 points and C 20 points.

How do I do this with rules?


texts: Attach a webform into faq module content

texts:
I'm looking for a FAQ module where users can answer the "Did you find this answer useful? Yes-No" after reading help and I need a page where operators can check all responses.

Any idea?


texts: Image-clicking Q&A captcha alternative that is customisable?

texts:
I'm looking for a simple way to spam-proof new user registration that works along the lines of Confident Captcha (demo, module page).

These work by asking a simple question, then the user clicks on the appropriate image. Very easy for humans, very difficult for bots.

My problem with the Confident Captcha system, however, is that it relies on a 3rd party plugin which isn't customisable. I want to be able to set the questions, images and widget display to match the content and theme of my site.

Note: I'm aware that this approach has accessibility issues for blind or partially sited users. For my project, this can be dealt with manually and isn't an issue, but bonus points for options that have a built-in accessible alternative.

Also, bonus points for options that don't depend on a 3rd-party service.

One related module worth mentioning:

Captcha Questions - totally customisable, but appears to be text only requiring users to do more typing.


texts: Why call javascript behaviour within its own function?

texts:
Looking at the JavaScript below, what does calling the behaviourName do?

  Drupal.behaviors.behaviourName = {
    attach: function (context) {
      $('.someClass', context).once('some-handler').behaviourName(); // what does this do?
    }
  };

I though that the behaviourName was generally used for name spacing. I can see in the site that im working on that the behaviour name is normally called within itself like in this example. What is this for?


texts: Loading a views block inside another block

texts:
I'm pretty new to this, but I have been stumbling on a feature I would like to have. I'm using Drupal 7.

I've created a some blocks on my front page. In one of those blocks I have a some div's and text that goes inside of my block. That works just fine and looks great.

Problem is that I want to place some randomly generated testimonials inside this block and I can't figure out how to do so.

Now, I've already created another view block that lists my testimonials randomly, but I just need to know the correct php code. Note: I've also enabled the PHP filter module, but it doesn't seem to be working.

I can easily assign my random testimonial view to a block, but I want to combine some HTML along with the testimonial and I just dont know enough about php.

Example:

   Some random text here...
**PHP to bring in my random block of testimonials from views**
   Some random text here...

I've also heard that placing in PHP like this is not good practice. If anyone has a better way for me to do this I would appreciate it. Like I mentioned, placing this view in a empty block works fine. I just want to be together with some html.

Thanks!

-Dan


texts:
I'm trying to create a file attachment in a Drupal content node from a command line script. When I'm calling file_save_data(), passing a public://something URL as destination, it fails. I've tracked down the failure to the is_dir("public://") call in Drupal's file.inc that somehow returns false.

Attachments work from the regular Web interface - there's r-x permission on all relevant folders. The script should be running under the same user as Apache - I call it from Apache in the first place, using PHP's exec(). When I call is_dir(DRUPAL_ROOT."/sites/default/files") - that is, on the underlying filesystem folder - it returns TRUE, so it's probably not permissions. Looks as if the URL wrappers are somehow off when running under CLI. There's no open_basedir in php.ini, no safe mode either.

For completeness' sake, here's the relevant portion of the script:

//Drupal bootstrapping
define('DRUPAL_ROOT', getcwd());
require_once('./includes/bootstrap.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$user = user_load(1);

//Some irrelevant stuff here...
$file_content = file_get_contents($file_name); //Comes from somewhere else
$file = file_save_data($file_content,
        "public://".$file_name, FILE_EXISTS_REPLACE); //Returns false! :(

And here's how I call the script from my custom module:

function mymodule_entity_insert($entity, $type)
{
    if($type == "node" && $entity->type == "mytype")
    {
        $module_path = drupal_get_path('module', "mymodule"); //That's where the script is
        exec("php $module_path/thescript.php  ".
            ">/home/me/drlog.txt ".
            "2>/home/me/drlog.txt &");
    }
}


texts: How can I move a module block's title to display within the block's template?

texts:
When I give my module block a title it displays above my module block.
How can I move this to display within my blocks template and not display above the template?


texts: Auto-add today's date and time to new Entity title upon creation?

texts:
I'd like to be able to auto-add today's date/time to the title of a particular Entity type when a new entity of that type is created. For instance, if I create an entity called "My New Entity", I'd like the title of that entity to actually be saved as "My Entity - 020513 - 103501" (assuming the entity is created on February 5, 2013, at 10:35:01 am).

Is this possible? If so, how can it be accomplished on a Drupal 7 website?

Thanks!


texts: Where to place JS code to be used by Admin?

texts:
I have a simple requirement that I want to implement JS on couple of fields. Through JS, I want to hide few fields by default and show them when a checkbox is clicked.

The problem is where to keep this JS for admin. Below is the JS which is working. Weirdly, when I paste in the console of Chrome, the JS then works.

JS

jQuery('input#edit-field-mine-und').change(function() {
        if(jQuery(this).is(":checked")) {
            alert("Checked");
        }
        else {
            alert ("Not Checked");
        }
        //$('#textbox1').val($(this).is(':checked'));
});

Any help where I can place this JS so that it can be used in admin drupal pages?


texts: Add A Redirect Link In Webform Submit Button

texts:
I want to add a redirect link on Webform submission button when a user submit a webform I want to redirect them in different page.

How can I redirect a user after they submit the webform ?


texts: Is there a way to get all values for a particular node?

texts:
I would like to create a customized view and search page by writing my own module because I believe that Views is unable to do what I want.  This requires me to write my own SQL queries, as well.  Is there an API call I can use to get all the data and values about a specific node?  For example, if I had a content type that asked for your first name and last name:

$values = get_node($nid)

and $values would end up looking something like:

$values['first_name'];
$values['last_name'];

Right now, it seems that all the fields and values are in their own tables, which makes it a nightmare in writing my SQL query to gather all data about the particular node.


texts: View mode tabs no longer visible in Drupal 8

texts:
I have added custom display settings on quite a few content types, see image below:

The view mode tabs have now all of a sudden disappeared. I tried to uninstall third party modules and rebuilt cache multiple times but without any luck:

What can I try from here? I'm on 8.0.0-beta15.


texts: How to Update a Ckeditor enabled field with Jquery

texts:
I'm having trouble figuring out how to update a field in Drupal which has ckeditor enabled using Jquery. It seems the field no longer responds with the identifier id when ckeditor is activated for that field.

I would like to update a field which has ckeditor enabled when a user completes an action. How can I do this? I have searched and searched and came up with nothing. It seems ckeditor in Drupal is doing something different from the standard ckeditor software.

Thank you!


texts:
I am working on a site with different layouts for certain sections on a landing page and our work page. (please see screenshot )

my current thinking in regarding this is the following.

I used paragraphs where a paragraph can have title, image, class_field and a link_field.

the link field will determine which class wraps around the content block ie flex-30 which has a style class in  my css. The content editor will determine this depending on how they want the blocks to appear.

So this is like a 3 column setup, split in 60% and 30%

My question is, whether my following approach is fine, and how can i loop through and print the paragraph fields in my page-node--front.html.twig and other twig files eg. page-node--our-work.html.twig.

Would a views approach be the best solution, for this?

Hope I can get some help regarding this


texts: I can't access private files in CKEditor

texts:
I have this site someone else has worked on and they've asked me to see if I could fix something.
This site has private files available to users after they've filled in a form (they then get a email with a link to the private file). This all works the way it should.

Now what they want is to be able to add a link or image that is private.
When doing this the image doesn't show or the link to the file gives a 403 error.

What is the best way to fix this or make this work.

Search for picture through ckeditor

picture doesn't show


texts: update from text type field to term reference

texts:
Using Drupal 7 I have already created and populated a contenty type. I want to use the already info I have already setup for one of the fields in this content type as a ter mreference, pointing to the Taxonomy I have just created (ex: previous text type field 'banana' has to be converted to field type 'term referece' from 'Fruits' taxonomy, picking up 'banana' as it value).

This way would avoid removing previous nodes and reinserting again (it's the same info but pointing to a new field type ('term reference').

Is that possible?

thanks


texts: how i can reset the page num to 1 when i change to another exposed filter option?

texts:
Now,i have a view page with exposed filter(filter option:filterA,filterB) and full pager

when i go to the 3rd page of  filterA , change the filter option to filterB ,i find the page redirect to the 3rd page of filterB ,what can i do to let it redirect to 1st page of filterB


texts: How can you refer to content ID from underlying URL while adding a new node?

texts:
In Drupal 7, I have a content type with an entity reference field. When adding new content of this type, an entity reference view filters the available options.

A contextual filter on this entity reference view should check whether the data matches against the node ID from URL being viewed while adding the new content.

I'm not sure whether I understand correctly how Drupal is supposed to work here, as everything I've tried gives no results, unless I manually enter test data in which case it works fine.

Let's say a user is on page site.com/?q=node/75, then adds content. The new URL is site.com/?q=node/75#overlay=%3Fq%3Dnode%252Fadd%252Fcontenttype.

The contextual filter is set for "When the filter is not available" to "Provide default value" of type "Content ID from URL". This returns zero results, even though I could manually provide the filter value and it would show the actual results.

Is this because the "Content ID from URL" is coming from the underlying (originating) URL instead of the overlay new content part of the path? Or is there some other issue?

How is it possible to filter contextually against the content ID of the original page from which a user adds new content? If it could be done by passing arguments to the contextual filter with a token from the entity reference field, that would be fine too, however so far I have tried with current page node and more and run into the same problem, it does not filter any of the appropriate results.

Thank you for your help!


texts:
I'm using Drupal 8.

I need to hide blocks of certain type from blocks UI because I'm managing them from my custom module and I'm not using them as a regular blocks.

Is there any way of altering block list generated on blocks administrative page?


texts: Display Jalali (Shamsi) Date in Archive View

texts:
I have a Persian language website and I need to a archive block in my site.
but date of default archive view is Gregorian. I install Datex module and it convert all date of nodes to Jalali(Shamsi) Date but can't convert Gregorian date to Jalali Date in archive view.
I want to archive content in year+month format.
any one has another idea for convert date in archive view?


texts: How do I pass contextual filters to a view via services

texts: I have a view that accepts a contextual filter in order to return the correct results. I'm using Services 3 and Drupal 7. I'm able to create an endpoint, and retrieve the view via services. But it seems like there is no way to pass the contextual filter, because services_views only has a retrieve method (which uses GET). Does anyone know if this is possible, and if so how it can be done?


texts: cannot render a specific field using form_alter

texts:
I am trying to theme my form using alter form.
I want to render a specific field with theme('ctools_collapsible', xxxx).
For now I can only results field but without their values, any help ?

   //What I want to render
    $collapsed_content = drupal_render($form['field_markets'][$language][$i]);
    $form['field_markets'][$language][$i] = '';
    $form['field_markets'][$language][$i]['#markup'] = theme('ctools_collapsible', array('handle' => $collapsed_content, 'content' => 'here another content to display', 'collapsed' => TRUE));

I used this way to render the data in view mode (using hook process node), and It works fine, now I am trying to do same thing in edit mode.
The results of this, I can see fields but there are empty...


texts: Output data of different content types in same page

texts:
I have two content types :

Content type 1 named book with two fields author and language
Content type 2 named movie with two fields date and resolution

In my-theme/templates/page.html.twig I want to render a first section with all the books and a second section with all the movies :

Book Author 1

Book Language 1

Book Author 2

Book Language 2

Book Author 3

Book Language 3

Movie Date 1

Movie Resolution 1

Movie Date 2

Movie Resolution 2

Movie Date 3

Movie Resolution 3

How can I achieve that in Drupal 8 and Twig, is it mandatory to use pre-processing and provide the template with the variable, should I create views or blocks and render them in my page... What is the correct way to do that?

A concrete example will be much appreciated !

    {% for book in books %}

{{ [Book Author Here] }}

{{ [Book Language Here] }}

    {% endfor %}

    {% for movie in movies %}

{{ [Movie Date Here] }}

{{ [Movie Resolution Here] }}

    {% endfor %}


texts: How to send email invite user fill in webform automatically?

texts:
I'm using drupal 7, and had a seminar questionnaire form created using webform.

I would like to invite seminar attendee to fill in this questionnaire after they attend the seminar, by sending them email with link to the questionnaire.

Rather than manually open my email client and retyping the same invitation template for every seminar, is there anyway I can have this?

A standard template of email invitation content with webform link
Admin only need to type in different email address of each seminar
Email will automatically sent to address entered
Attendee do not need token or account to fill in the form
It's similar to google form share this form / invite through email function

Is there any module to do this? Or I need to use with other modules such as Rules?


texts: Printing the correct date value in a view

texts:
I have a content type with a Date CCK field that prints the correct date/time specified in nodes (using the correct timezone, format, etc.). I also created a view that uses this date field, but the time I am getting from the view date data is (+)4 hours off. The date information is being printed in a views template using the $row object (specifically, the raw array key inside of the date field array). This array provides the 'to' and 'from' dates (and time), the timezone, and all other relevant information, but the values are 4 hours off as I said above.

Is there something I need to do when printing these kinds of values in a view in order to get the correct time? I'm assuming the Date module does some sort of processing that the views data isn't getting. Any guidance would be great because I have no idea why this is happening.


texts: Homepage accessible to non-members though title of the page says : "Access Denied"

texts:
Since i upgraded to 7.8 i noticed that the homepage of my site now displays a title of "Access denied" as it used to be "Welcome to my site". Though it remains perfectly accessible to non-members.

I'don t recall modifying any permission so far so i doubt this is because of my code. Have anyone experienced that ? How could it be fixed ? Do i need to override menu title for that page ?


texts:
I am trying to create a page view that will display content by Content:Title which is part of the node's URL.
I have 3 content-types: Movies, Books, and TV Shows.
Each content type has a path alias matching the [node:content-type:machine-name]/[node:title]/[current-date:custom:Ymd] pattern.
I successfully created a view called movies with a filter on Movies that displays all the nodes with www.example.com/movies/ in the URL. If I click on a node in the Movies view, it displays the content using the node.tpl.php template file.
I added a contextual filter (Content: Title) using Scott Edmonds suggestion.
Contextual Filter for: Content: Title ). When filter is not in URL -> Provide Default Value -> Raw Value from URL -> Path Component=2. Use Path Alias=Checked. Then, When Filter Value is In URL: Specify Validation Criteria= "PHP Code" with the following PHP code: $handler->argument = str_replace("-"," ",$argument); return true; That did the trick. the PHP code converts the dashes to spaces so it can be evaluated correctly.
The result is that when I click on the "Star Trek is Great" post link I am taken to the correct URL, www.example.com/movies/star-trek-great/20130702,  but node.tpl.php is the template used instead of views-view--movies.tpl.php.
When I copy the title and paste it into the url, as "www.example.com/movies/Star Trek is Great/20130712" the views template page comes us.
Some where along the way I am missing something.  Any help out there?
FYI - I also have simply set the contextual filter on Content:Title with
Display all results for the specified field
Checked "Override title" and added %1 as the first argument
Seleced "lowercase" for the Case PATH
Selected "transform spaces to dashes in url"
But nothing worked :(


texts: Drupal 6 term based view not translating vocabulary terms

texts:
I have a dilly of a pickle here. Please do help if you can.

I have a site that uses internationalization translation to translate content.
Some of the content is not translating.
Specifically a "view" that is of type "term".  All my other views are translating correctly.

Here is the configuration page of my vocabulary

Here is an example of the term translations.

Here is the view for the taxonomy term countries.
The view here seems to not have the correct  filters available. For node based views, you can add a filter called "node translation-language" and set it to filter on the current language.  But with views based on taxonomies there is no equivalent "term translation-language".  How are we supposed to filter out the extra taxonomy terms from the view.

This is an example of a view based on nodes that has the filter "term translation-language"
My term based view is missing this filter

Here is the Countries view in action...notice that Haiti shows up for every language in it's non translated form (note that those are 3 different Haiti's)

Can someone please explain what I need to do to get a term based view translating and not showing extra terms?

Thanks,

David


texts: What's good form for calling views within a module (template, etc)?

texts:
I have about three views that will be used; Here's Daniel Wehner's answer:

 $view = views_get_view();
 $view->set_display();
 $view->filter['foo']->value = 'bar';
 print $view->preview($display_id, $args);

I built this based off his code, which while works, could be improved if including views is going to be a regular activity throughout your project:

$view = views_get_view('nodequeue_3');
$view->set_display();

$content['raw_markup'] = array(
  '#type' => 'markup',
  '#markup' => $view->preview(),
);

I'm also thinking this might not be done that often, because if you can build a module, why use views?

The utility of views should not be overlooked, in combination with (or without) a custom module.

Thanks for the patience, this community is awesome!


texts: Why is this Drupal services RESTful API not working?

texts:
I'm using the Services module on Drupal 7. I want to implement a service that allows me to submit a search term via AJAX and receive an array containing the top 5 nodes (node id and title) that loosely match the title. When connecting to http://example.com/api/ I receive this message

  Services Endpoint "search" has been setup successfully.

but when attempting to navigate to something like http://example.com/api/search/Test, I get a 404.


texts:
I need to load data from a Drupal View into an external (non-Drupal) site using PHP.

I'm using XML-RPC for PHP.

I'm able to connect to the system and login, but I'm unable to retrieve a View. I get the following error:
HTTP/1.1 401 Unauthorized: Missing required argument view_name

I haven't been able to find documentation on format of the RPC call required for views and how the session id is passed. Any pointers would be greatly appreciated. Code below. The name of the view I'm trying to get is "configurations".

require_once ("xmlrpc.inc");

// SYSTEM.CONNECT
$f = new xmlrpcmsg('system.connect');
$c = new xmlrpc_client($XMLRPC_SERVER);
$r = &$c -> send($f);

// SYSTEM.CONNECT SUCCESS
if (!$r -> faultCode()) {

    print('system connected...');
    $v = php_xmlrpc_decode($r -> value());
    $system_sessid = htmlspecialchars($v["sessid"]);

    // USER.LOGIN
    $f_login = new xmlrpcmsg('user.login', array(php_xmlrpc_encode('USERNAME'), php_xmlrpc_encode('PASSWORD')));
    $c_login = new xmlrpc_client($XMLRPC_SERVER);
    $c_login -> setDebug(1);
    $r_login = &$c_login -> send($f_login);

    // USER.LOGIN SUCCESS
    if (!$r_login -> faultCode()) {

        $v = php_xmlrpc_decode($r_login -> value());
        $sessid = htmlspecialchars($v["sessid"]);
        print('logged in...' . $sessid);

            $f_configs = new xmlrpcmsg('views.retrieve', array(php_xmlrpc_encode('configurations-xmlrpc')), array(php_xmlrpc_encode('configurations-xmlrpc')), array(php_xmlrpc_encode('configurations-xmlrpc')));

            $c_configs = new xmlrpc_client($XMLRPC_SERVER);
            $c_configs -> setDebug(1);
            $r_configs = &$c_configs -> send($f_configs);

            if (!$r_configs -> faultCode()) {
                print('got configs');
            } else {
                print('error getting configs...');
            }

        } else {
            print('error logging in...');
        }
} else {
    print('error connecting to system');
}


texts: Show various nodes in different ways on home page in drupal7?

texts:
I want to show nodes in different ways. For example, i want to show featured nodes, recent nodes. My question is that how we can show nodes in different ways on my home page.

See this demo site, i want my home page in drupal as like it.the problem is that how to manage nodes different ways as posts in WordPress.

thanks for the help


texts:
I have a site where there are several links to a single file.

Is there a module that allows me to upload a file into the CMS, generate a link and use it as for these links?

The Module would need to keep the same file name if re-uploaded.

Thanks in advance.


texts: Views and joining content types on specific field in Drupal 7

texts:
How can I 'LEFT OUTER JOIN' or 'LEFT JOIN' using Views in Drupal 7.

Here is what I'm trying to do, using an example from Wikipedia:

I have 2 content types: Employee's and Department's (tables below)

The "DepartmentID" noted in the Employee Table below in my case would be the NodeID of the department from the "Department" custom content type.

How can I use Drupal 7's Views module to Display a list of employees with the department name pulled from another content type as noted in the graphic below?

(The SQL statement below is really what I'm hoping to be able to do with the Views module, the table is the output I'm hoping to achieve.)


texts: How to override a JS function in the Media Module without editing the actual module files?

texts:
Drupal.media.browser.validateButtons = function() {
    // The media browser runs in an IFRAME. The Drupal.media.popups.mediaBrowser()
    // function sets up the IFRAME and "OK" and "Cancel" buttons that are outside
    // of the IFRAME, so that their click handlers can destroy the IFRAME while
    // retaining information about what media items were selected. However,
    // Drupal UI convention is to place all action buttons on the same "line"
    // at the bottom of the form, so if the form within the IFRAME contains a
    // "Submit" button or other action buttons, then the "OK" and "Cancel"
    // buttons below the IFRAME break this convention and confuse the user.
    // Therefore, we add "Submit" and "Cancel" buttons inside the IFRAME, and
    // have their click action trigger the click action of the corresonding
    // "OK" and "Cancel" buttons that are outside the IFRAME. media.css contains
    // CSS rules that hide the outside buttons.
    //
    // We don't add a "Submit" button if the form already has one, since in these
    // cases, another round-trip to the server is needed before the user's
    // selection is finalized. For these cases, when the form's real Submit
    // button is clicked, the server either returns another form for the user to
    // fill out, or else a completion page that contains or sets the
    // Drupal.media.browser.selectedMedia variable. If the latter, then
    // Drupal.media.popups.mediaBrowser.mediaBrowserOnLoad() auto-triggers the
    // "OK" button action to finalize the selection and remove the IFRAME.
    //
    // @todo An alternate, less hacky solution would be most welcome.
    if (!($('.form-submit', this).length > 0)) {
        $('Submit').appendTo(this).bind('click', Drupal.media.browser.submit);
        if (!($('.fake-cancel', this).length > 0)) {
            $('Cancel').appendTo(this).bind('click', Drupal.media.browser.submit);
        }
    } else if (!($('.fake-cancel', this).length > 0)) {
        var parent = $('.form-actions', this);
        if (!parent.length) {
            parent = $('form > div', this);
        }
        $('Cancel').appendTo(parent).bind('click', Drupal.media.browser.submit);
    }
};

(See also http://jsfiddle.net/S6WXc/.)

This function in the Media Modules js/media.browser.js is clashing with what I've added into the Media Select popup via Form Alter (A simple AJAX call to display thumbnails of images, that when clicked open up in a Colorbox modal window).

I've tracked the problem down to something in Media Module and Colorbox clashing, since when I click a thumb that opens the Colorbox modal popup, an event is launched that duplicates the 'fake' Submit / Cancel buttons in the Library tab, and also some of the Library thumbnails (my own thumbs are shown in the Web tab).

Not going in further detail, is there some way to override the function in the Media Module without editing the actual original .js file? I don't fancy doing edits each time I update it so to override it in my module or my own .js file would be preferable.


texts: Upload file in system_settings_form in Drupal 6

texts:
I have a code that was supposed to upload 2 files:

function lafemme_background_images_form() {

    $form = array();

    $form['#attributes']['enctype'] = "multipart/form-data";

    $form['background_left'] = array(
        '#type' => 'file',
        '#title' => 'Obrázok na ľavej strane',
        '#required' => TRUE,
    );
    $form['background_right'] = array(
        '#type' => 'file',
        '#title' => 'Obrázok na pravej strane',
        '#required' => TRUE,
    );

    return system_settings_form($form);
}

function lafemme_background_images_form_submit($form, $form_state) {

    $validators = array(
        'file_validate_extensions' => array('jpg','jpeg','bmp','png', 'gif'),
    );

    $file_left = file_save_upload('background_left', $validators, '/sites/default/files/lafemme/backgrounds/');
    $file_right = file_save_upload('background_right', $validators, '/sites/default/files/lafemme/backgrounds/');

    if ($file_left) {
        drupal_set_message('Obrázok na ľavej strane je nastavený');
    } else {
        drupal_set_error('background_left', 'Chyba pri uploade ľavého obrázka');
    }

    if ($file_right) {
        drupal_set_message('Obrázok na pravej strane je nastavený');
    } else {
        drupal_set_error('background_right', 'Chyba pri uploade pravého obrázka');
    }

}

But it doesn't work. Form is acting like there are no files selected on submit even if they are. Later I found out that it doesn't work probably becouse of system_setting_form function. In drupal 7 there is a managed_file type of input. But what about Drupal 6? It is possible to upload a file in system_setting_form()?


texts: How to customize permissions for a custom module

texts:
I created a custom module that hides a field in a content type editing screen from the user and simultaneously auto-selects a value for that field for the user. It works great for the admin role but for some reason my other user's who are able to login and who have permission to edit the content type don't get this functionality applied. They still see the field and can still select a value for it.

Anyone know how to make the permissions for a custom module apply to ALL users?

Here's my module code:

/**
 * @file
 * Auto saving to a term reference field.
 */
 /**
  * Implementation of hook_form_alter().
  */
function seven_form_resource_node_form_alter(&$form, &$form_state, $form_id) {
    hide($form['field_icon']);
}
/**
 * Implementation of hook_node_presave().
 */
function grouphideandselect_node_presave($node){
  //Condition for particular content type
  if($node->type == 'resource'){
    $icon_ary = array();
    //Array to map category with icon given as Category=>Icon
    $field_type_to_icon = array(1 => 1,2 => 1,3 => 1,4 => 2,5 =>
2,6 => 2,7 => 2,8 => 6,9 => 6,97=>6,98 => 6);
    $category = $node->field_type['und'];
    foreach($category as $k=>$c){
      $icon = $field_type_to_icon[$c['value']];
      if(!in_array($icon, $icon_ary)){
        $icon_ary[] = $icon;
        $node->field_icon['und'][$k]['tid'] = $icon;
      }
    }
  }
}


texts:
I'm implementing CKEditor Drupal plugins using CKEditorPluginContextualInterface in D8.

I wander if there is a way in which I can control the order/weight of the plugins so that I could change which plugin code executes first.


texts: How to set the default value of remember me in the persistent login module to on?

texts:
The persistent login module
gives a "Remember me" at login.

How to set this value default on?


texts:
I'm using Media gallery 7.x-1.0-beta8 with Media 7.x-1.4 module in drupal 7.34. Whenever I try to add a picture to my gallery I get this error LINK

Fatal error: Call to undefined function file_info_file_types() in C:\xampp\htdocs\drupal\sites\all\modules\media\media.module on line 1085

Is there some way I could fix this? I tried using different versions of both Media gallery and Media, but I keep getting some weird incompatibilities. Thank you


texts: How to use FULL Jquery.com files in Drupal content item?

texts:
I can use JS Injector and link to JS files through the info file, but what if the script is quite complicated with a lot of files and dependencies?

This accordion script has over 20 files...how to link all this and make it work?

Script is over here:

Download Builder


texts: Redirect to Different URl on validation errors in form builder

texts:
I am using drupal 8 fapi and i have user case as below

I have a form  on https://example.com/landing-page and I submit the  form and there are validation errors .the page should reload as https://example.com/landing-page#lead-form.

Is there any hack we can implement?

I came with logic

if validation has error set form redirect page to example.com/landing-page#lead-form

if($form_state->getErrors() ) {
  $response = new TrustedRedirectResponse('example.com/landing-page#lead-form');
  $form_state->setResponse($response);
}

some how its not working.

Is there any way we can change the url to example.com/landing-page#lead-form and show the validation error at same time .


texts: How do I remove the trailing time zeros after the Date

texts:
I'm using Drupal 8.4 Webform Module. I selected the Date element (not Date/time). In the Webform Date Settings, I'm using date picker, Medium date - D, m/d/Y (Mon, 11/27/17). (I also tried Custom, D, M j, Y.

I'm using this field in a View, Format = Default medium date and this is what I get, Thu, 12/14/2017 - 00:009:00 AMFri, 12/15/2017 - 00:005:00 PM
. How do I remove the trailing zeros?


texts: Get id of selected option in Drupal Forms API

texts:
I have a select element in my form.

function myid_print_user_page_form($form, &$form_state)
{
    $form = array();
    $form['options'] = array(
        '#type' => 'select',
        '#options' => array(
            0 => t('All'),
            1 => t("Printed ID's"),
            2 => t("Unprinted ID's"),
        ),
        '#default_value' => 0,
        '#ajax' => array(
            'callback' => 'myid_print_all_submitted_id_callback',
            'wrapper' => 'myid_print_search_idnumber_wrapper',
        ),
    );

    $form['myid_print_search_idnumber_wrapper'] = array(
       '#type' => 'item',
       '#markup' => '

'
    );
    return $form;
}

I'm stuck in the callback function. It always return 1, even though I selected other options.

function myid_print_all_submitted_id_callback($form, $form_state)
{
    return $form_state['values']['options'];
}

Where am I missing?


texts: When rendering a custom form, how do I use  instead of  for the button #type?

texts:
I have a render array for my custom form, which acts as a "Like" button for articles (but with custom functionality for our client). The button is defined like so:

...
    $form['like_btn'] = [
      '#type'   => 'button',
      '#markup' => '<img src="/path/to/like-icon.svg" width="32">',
      '#attributes' => [
        'class' => ['like'],
        'id'    => ['like-btn'],
      ],
      '#ajax'   => [
        'callback' => '::updateLikesCounter',
        'disable-refocus' => FALSE,
        'event'    => 'click',
        'wrapper'  => 'like_counter',
        'progress' => [
          'type' => 'none',
        ],
      ],
    ];
...

However, this renders the button as <input type="submit"> rather than a <button> element.

How can I make the "button" render element type utilize the <button> HTML element instead? Or, which render element #type should I use instead?


texts: Strict URL alias checking with optional 404 redirect

texts:
When I create a node with "This is sample title" as title, the Pathauto module will create "this-is-sample-title" as URL alias and some "node/123" as real node URL. But we can browse the same content with a different URL such as

SERVER/this-is-sample-title
SERVER/this-is-sample-title/some-garbage-here

In node head source code canonical url is set to "/this-is-sample-title" and shortlink to "node/123".
How do I make Drupal strict on the URL alias and redirect to 404 if URL garbage found (even if first URL segment is correct)?


texts:
I hope that someone can help me, because I am now becoming desperate. I've stared at this for hours and cannot figure out what is going wrong.

I am trying to set up a very simple migration following to the letter the example in Drupalize Me of baseball players.

I have built all the relevant files and checked the code.

I clear the cache with drush and then register the static migrations. It tells me that they are registered.

I then do a migration status call and it reports that the "Class XXXX no longer exists"

I cannot find my error and it's driving me mad.

Has anyone run into this, or can anyone recommend any pitfalls that I should consider please?

Chris


texts: how to modify drupal 7 mysite/user/login and mysite/user/registration pages "in-place"?

texts:
I am trying to find out a way to add fields/modify existing fields/theme the default Drupal 7 login/registration pages in-place.

What I mean "in-place" is to find a way to not create new login/registration pages through creating "page--user--register.tpl.php" files.

I am looking for a way to add/modify/theme the mysite/user/login and mysite/user/registration pages without having to create page--user--register.

However, if overriding the hook_theme() in "template.php" and creating "page--user--register.tpl.php" file is the only way, then is there a way to have it use the same theme as the rest of the pages? I can make the custom registration page have the same theme through coyping code from "page.tpl.php" and pasting it in my "page--user--register.tpl.php" file, but this seems wrong to me.

Any help or comments are appreciated.


texts: maintain password value after failed login attempt

texts:
I'm working on a custom login page for users. I have some special elements on the page, which might cause authentication to fail even though a user enters a valid username and password combination.

After a failed authentication attempt, the username field still keeps the username they entered, but the password field is blank. I would like the password field to keep its value, like the username field does.

I'm starting the form with user_login(). I added a check to add in the password:

if (isset($form_state['input']['pass']) ) {
// user has submitted the login form once.

 // maintain their entered password
  $form['pass']['#default_value'] = $form_state['input']['pass'];
}

Yet it doesn't survive.

How can I re-populate the password field after a failed login?


texts: Drupal Commons 7.x-3.29 Front page Create a post

texts: Create a post was a smallish box before 7.x-3.29.  You could click "go to full form" to get more options for your post.  Now it shows media attachment and group selection dialog which takes up a lot of the front page.  Can it be changed back to the way it was or eliminated from the front page?  Suggestions appreciated.


texts: Replacing an existing image via the admin interface

texts:
Have access to a Drupal 6 admin and attempting to replace a single image via the admin interface. My understanding is that to just replace an existing image that I'll need to access the sever directly. Is there any way to edit (aka replace) an existing image via the admin interface?

Might be worth noting that one reason I want to replace the image, and not just upload a new one is due to the fact that the image is referenced via template, and not in a block, page, etc.


texts: Why does my widget disappear when the node submission form returns an error?

texts:
I am the maintainer of a Drupal contrib module, Getlocations, and I am seeing a very odd problem in Drupal 7.

If a File or Image field widget is included on a content type, the getlocations_fields widget no longer works when returned with a required error, although it does work on the initial form load.

Further investigation shows that the functions that deploy the map, JavaScript, and CSS are not being accessed when the page has errored so no JavaScript or CS related to Getlocations is loaded.

If I remove the upload widget, it works as expected.

I really have no idea why this is happening, there are no entries in php.log or in Watchdog. What's going on?


texts: Menu tree from taxonomy terms and nodes which belong to them

texts: i need to create a collapsible menu tree from taxonomy terms and nodes which belong to them (not nested terms, but content pages) i'm totally stuck about it  i've found solutions for nested taxonomy terms only, but not for combined with content pages from the term. meaning menu tree like this:


texts:
I have problem in clean url i am trying to enable it but it showing radio buttons deactivated and showing Your system configuration does not currently support this feature.

My web is on shared hosting under the sub directory Like This
http://tailoredsuitonline.com.previewdns.com/oceanwis/ The main Web is "Oceanwis"

Your help is really appreciated


texts: Adding a form to a product drupal commerce

texts: I just want to add a form to a product and after I check the services in that form the amount increases. image of the page in the Picture the product price is 7$ but when I add the service it added 10$ then the amount become 17$. any solution for this?