texts: How can I make a field appears when you check on a checkbox?

texts: I'm making a module and on the administration page there is a form and I want to make one of the fields appears only when user check on a checkbox. Like the option to add a new content to a menu.


texts:
I've added title override %1, to contextual filter. Filter uses taxonomy to get nodes.

If I open page "catalog/1" I get title from term1 with all the content
If I open page "catalog/2" I get title from term2 with all the content
But if I try "catalog/1+2" I get title "No name" and the content for both terms.

How to define page title as title of first (any) term in the filter?

Upd it appears that there's a problem with title override. If I add title override %1, then I have "No name" title for multiple terms...


texts: Multilingual front page- redirect anonymous users based on browser language

texts:
I have a Drupal 7 site that is available in both English and Japanese.  I am using i18n and entity translation; I have configured the User interface text language detection at /admin/config/regional/language/configure as follows:

User
URL
Browser
Default

This is great for authenticated users and for all pages of the site except the front page, which is the most important.

I would like users with Japanese browsers to be taken to the Japanese version and all other users to be taken to the English version.  However, since the site default language is English, it appears that all users are by default taken to the English version.

If it matters, my front page is actually a panel.

How can I configure it so that users with Japanese browsers are redirected to the Japanese language version?  I don't want to move browser to the top of the list because I want to respect user preferences for authenticated users, and I also need URL to precede browser because I want people to be able to use the language switcher block to change the language if for some reason they are using a browser in a language they are not comfortable with.


texts: Populate a Chosen select list from a view

texts:
We have a request from a client to create an interface where they select nodes in a Chosen box. We have the Chosen module on the site and have successfully implemented features with it.

In this case, they want to have an admin interface where they choose which nodes populate a javascript image slider. I thought to simply make them a custom view where they can check a checkbox field to indicate whether to include the node or not. However, because they want the Chosen functionality, I need to populate a select box with the values from a view.

How can I create a select box that's populated by values from a view I've already defined? I've done some searching and found the Entity Reference View Widget module, but that doesn't seem to do what I am looking for.

Edit I'm not so concerned about the Chosen functionality, I can handle that. What I really want to know is how to get the values from a view to populate a select box, either with a widget, or defining a select box in an form array.


texts: How to properly set up Drupal Console on Windows 7

texts:
I have been trying to set up Drupal Console for quite some time now on Windows 7; however, there always seems to be some kind of error which I am unable to solve.

I have installed Drupal Console via the drupal.phar way which I placed in a directory that is included in the PATH variable and it gets called properly. However, every time I call the console from the command line it gives me the following notice:

Notice: Undefined index: commands in phar://C:/_Skripty/drupal/vendor/drupal/console-core/src/Utils/ConfigurationManager.php on line 273

The second weird thing is that I want to use it in multiple project and it does actually seem to be working, in a way, in one of the projects but not in the other. For example, I am able to get the list of available commands in one, but running that same command in the other produces the following fatal error in addition to the above mentioned notice.

Fatal error: Trait 'Drupal\Console\Command\Shared\ModuleTrait' not found in C:\xampp\htdocs\sam_stroje\modules\metatag\src\Command\GenerateGroupCommand.php on line 32

I suspect that this might be caused by some modules not correctly implementing the stuff that has to do something with the console but I'm not 100% sure.

What might be the cause of these problems?
Thanks in advance for all replies.


texts: How to solve "This version is not compatible with Drupal 7.x and should be replaced" error?

texts:
I keep getting, "This version is not compatible with Drupal 7.x and should be replaced." error. Could you please look at the content of my .info file and tell me what is wrong with it:

name = jeanb
description = sub-theme based on Bartik.
base theme = bartik
engine = phptemplate

stylesheets[all][] = css/jeanb.css

regions[header] = Header
regions[help] = Help
regions[page_top] = Page top
regions[page_bottom] = Page bottom
regions[highlighted] = Highlighted

regions[featured] = Featured
regions[content] = Content
regions[sidebar_first] = Sidebar first
regions[sidebar_second] = Sidebar second

regions[triptych_first] = Triptych first
regions[triptych_middle] = Triptych middle
regions[triptych_last] = Triptych last

regions[footer_firstcolumn] = Footer first column
regions[footer_secondcolumn] = Footer second column
regions[footer_thirdcolumn] = Footer third column
regions[footer_fourthcolumn] = Footer fourth column
regions[footer] = Footer

settings[shortcut_module_link] = 0

; Information added by drupal.org packaging script on 2013-04-03
version = "7.22"
project = "drupal"
datestamp = "1365027012"

Thank you!


texts: there any field in view that display Display author and date information

texts: I have created a view for my project, is there any field in view that displays "Display author and date information" ?


texts: How can i populate data from a reference node into another content type?

texts:
I have two content types. hospitals and referral form. I would like to pull data from the hospital form automatically, example hospital name, address, contact etc when the user fills in the name of the hospital in the referral form.

I have used entity reference but i cant get it to work. It only gets the URL of the node but not the other fields. And also i have used autofill but it only works for a single content type.
If any one has done this before or if anyone has an idea, please do help. looking forward to your responses.


texts: How can I search internal blocks in the admin section?

texts:
I've inherited a very large site that I didn't build. I am trying to find one particular block amid around a hundred - I'd like to search these blocks for some of the specific HTML classes they contain to edit them.

It looks like https://www.drupal.org/project/block_search isn't up to date anymore - is there a convenient way to search the admin section of a drupal site?


texts: Exract all node field values to json including reference entities with value

texts:
I am writing a module to export drupal's content to another platform, the module provides a UI to manage content types and their fields to be shared on another platform via API.
So far i have managed to get node field values using this sample code
$nid = 4951;
$node = \Drupal::entityTypeManager()->getStorage('node')->load($nid);
$data = [];
foreach ($node->getFields() as $name => $field) {
  $data[$name]  = $field->getString();
}

the $field->getString(); however do not provides reference entity values and only provide ids.
The out of the above code is like:
{"nid":"4951","uuid":"0fae7e9b-d860-43f0-9559-a8bd6bab22b7","vid":"1272611","langcode":"en","type":"article","revision_timestamp":"1612303794","revision_uid":"1166","revision_log":"","status":"1","uid":"866","title":"xyz Chapter April Update","created":"1555961981","changed":"1612303794","promote":"0","sticky":"0","default_langcode":"1","revision_default":"1","revision_translation_affected":"1","moderation_state":"published","scheduled_transition_date":"","scheduled_transition_state":"","metatag":"","path":"\/wisconsin-chapter-april-update, 17276, en","menu_link":"","body":"some this here, rich_text","field_article_author":"Wisconsin Chapter","field_article_chapter":"541","field_article_endnotes":"","field_article_questions_cta":"1","field_article_recommendation":"","field_article_recommended_link":"","field_article_related":"","field_article_related_link":"","field_article_resource_download":"","field_article_subhead":"Here's the latest news from the abc.","field_article_thumbnail":"","field_article_type":"news","field_blog_section":"","field_meta_tags":"","field_tax_article_type":"24, 28, 45","field_tax_audience":"","field_tax_breadcrumbs":"","field_tax_content_format":"50","field_tax_disease":"55, 56, 57, 58","field_tax_ga_type":"","field_tax_research_type":"","field_tax_topic":"90, 91, 92, 93, 94, 108, 109, 111"}

Scroll last and see for example field_tax_topic
Is there a direct or indirect way of automatically detecting reference entity field and extracting its values, also it should be dynamic solution and that must work with new field types as well.
Any pointer or direction to do it in the right way will help!


texts: What's the difference between Drupal 8.0.x and 8.1.x?

texts:
On the drupal core download page I see two development branches, 8.0.x and 8.1.x.

I'm sure in the old days it just went linearly 8.0 then next would be 8.1 etc. but this suggests development is now parallel as if 8.0 and 8.1 are really different.

I'm interested to learn why this is this way. Why, for instance, as a developer would I work off 8.0.x and not 8.1.x?


texts: Permissions to edit only the Status of an order

texts:
I have created a role called "Order Manager", he should be able to

View all the orders.
Update the status of any order.
Not be able to edit(can edit only the status field, nothing else)/or delete any order.

How do I achieve this in Drupal Commerce?


texts: Drupal 7: Edit/delete is not working on the custom module

texts:
I am a newbie to drupal. I am working to create a custom module in the name "course". I have read about the list of hooks to create a custom module. So, what's my problem is that i cant able to see the edit form for the module configure but i can do add management and its working fine.
I've used Existing contact modules as a reference.

Below are my code:
In course.module

function course_menu() {
  $items['admin/structure/course'] = array(
    'title' => 'Academy\'s courses',
    'description' => 'Create a system contact form and set up categories for the form to use.',
    'page callback' => 'course_list',
    'access arguments' => array('administer contact forms'),
    'file' => 'course.admin.inc',
  );
  $items['admin/structure/course/add'] = array(
    'title' => 'Add Courses',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('course_edit_form'),
    'access arguments' => array('administer contact forms'),
    'type' => MENU_LOCAL_ACTION,
    'weight' => 1,
    'file' => 'course.admin.inc',
  );
  $items['admin/structure/course/edit/%course'] = array(
    'title' => 'Edit Courses',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('course_edit_form',4),
    'access arguments' => array('administer contact forms'),
    'file' => 'course.admin.inc',
  );

  return $items;
}

and in course.admin.inc:

function course_edit_form($form, &$form_state, array $course = array()) {
  // If this is a new course, add the default values.

  $course += array(
    'name' => '',
    'course_id' => NULL,
  );

  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Course Name'),
    '#maxlength' => 255,
    '#default_value' => $course['name'],
    '#description' => t("Example: 'Available Course Names'."),
    '#required' => TRUE,
  );

  $form['course_id'] = array(
    '#type' => 'value',
    '#value' => $course['course_id'],
  );
  $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );

  return $form;
}

function course_edit_form_submit($form, &$form_state) {

  if (empty($form_state['values']['course_id'])) {
        db_insert('courses') // Table name no longer needs {}
        ->fields(array(
          'name' => $form_state['values']['name'],
          'course_url' => $form_state['values']['name']
        ))
        ->execute();
    //drupal_write_record('courses', $form_state['values']);
  }
  else {
     db_insert('courses') // Table name no longer needs {}
        ->fields(array(
          'name' => $form_state['values']['name'],
          'course_url' => $form_state['values']['name']
        ))
        ->condition('course_id', $form_state['values']['course_id'])
        ->execute();
    //drupal_write_record('courses', $form_state['values'], array('course_id'));
  }

  drupal_set_message(t('Course %name has been saved.', array('%name' => $form_state['values']['name'])));
  watchdog('contact', 'Course %name has been saved.', array('%course' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('Edit'), 'admin/structure/course/edit/' . $form_state['values']['course_id']));
  $form_state['redirect'] = 'admin/structure/course';
}

I can't able to find the exact problem, why add is working but not edit & delete? Help me on this.

Below image tells you what exactly i am asking for(Red mark).

If anything additional needed in this please let me know.


texts:
I have a local site which i'm working on. But somehow I got logged out and now when I want to login on localhost/user I have a login page without the login fields showing. So I can't login anymore. The weird thing is that I on the same page i can navigate to 'new account' or 'new password' and on those parts the entry fiels are showing, but at the login page they are not.
Somebody helpt get back into my site?


texts: Wrapping multiple cck fields into a single div tag for theming?

texts:
I have a content type that uses many cck fields, and I would like to theme the content type by grouping certain fields in "blocks" (not Drupal blocks but div blocks), preferably div tags, so that the fields aren't just displayed one after the other. I can edit the css of individual fields, but if I want a field to be in a div on the top right hand corner of my node types page, and then another group of fields to be along side it, and then another group of fields to fall underneath all of the other fields, that css could get messy and interfere with my themes main css. I'm not sure what to put in my template file, since all the fields just fall under "content."

I'm using Drupal 6, and a little new with php, but can do basic "print" and "if" conditions. Any help would be greatly appreciated! Thanks in advance!


texts:
In Drupal 8 you can create path aliases by going to: admin/config/search/path/patterns/add

Which allows me to, for example, say that all content of type "blog_post" can have something like this:

/blog/[category]/[title]

The problem is, I want the TOP path to be different, depending on the category. Specifically, I want any blog post that has the category = Competition, to have:

/competitions/[title]

While still being able to have

/blog/[category]/[title]

I can't seem to get this going. Is there a way to do this? I tried creating another aliases but I don't think there is any path I can specify that will give me this?


texts: How to not let users remove the entity reference once they added

texts:
I'm using D7.
I have one content type, let's say Content-A. And, the Content-A has a field whose field type is Entity Reference. Content-A's authors can reference other user with the content through the Entity Reference field.
I want to make authors be unable to remove the entity reference between the content and other users who he already referenced. Does anybody know how to do it? Any advice will be appreciated.


texts: Authenticated user cannot view custom content type pages

texts: I have a new Drupal 8 website which only two of us have login access to. I'm the administrator and the other person is an authenticated user. I've set the permissions so that authenticated users can see/edit/delete/etc. all the custom content types. In this case, I have a custom content type for our library branches. When this person logs in, she gets Access Denied when she goes to the library branch pages. What else should I be checking? Thanks!


texts: Determine the row number of an unformatted row in views

texts:
I'm using the Views module with the unformatted style with full content, and I'm using node.tpl.php to style the row. I'm looking for a way to determine what row it is (e.g. I want to style the first row different than the subsequent rows).

Is there any variable that is available to the template? Is this something I would have to add into the template.php (via a pre-process function, or something of that nature)?


texts: Views: get the fields from a Paragraph without duplicate records

texts:
I have a content type 'Testimonials' with a title field and a field configured as a Paragraph. I'm trying to create a view showing all the nodes of content type 'Testimonials'.

However, in the 'add field' section of the view creation page, i can only select the 'title' field. The fields that are part of the Paragraph are not selectable.

How can i get the fields from the paragraph so that i can show them in the view results?

  I tried with 'add relationship' (Paragraph referenced from
  field_dl_testimonial_components) this works but i get duplicate
  records in my view (1 record per paragraph).

Below a screenshot showing the paragraphs that are set for the field 'components main'


texts: How to override a twig template for only a specific page?

texts:
The title of this user view page contains the name of the user. I want modify it and, thanks to twig debug, I see the template used is page-title.html.twig:

{% if title %}
  <h1{{ title_attributes.addClass('page-header') }}>{{ title }}</h1>
{% endif %}

If I override it, how can I make twig use my overrided template only in the user view page?


texts:
I am trying to create a custom sorting option for view that will sort result on the basis of percentage of 2 fields.

field 1 = node__field_funding_amount
field 2 = node__field_funding_goal

and i am trying to do something like below

$percentage = "round(( $this->tableAlias.$this->realField/node__field_funding_goal.field_funding_goal_value * 100 ),2)";
    $this->query->addOrderBy(NULL,
      $percentage
    );

Full code is here
1:- code in views.inc

function crowdfundingproject_views_data_alter(array &$data) {
  $data['node__field_funding_amount']['views_cfp_almost_full'] = array(
    'title' => t('CFP Almost Full'),
    'group' => t('Content'),
    'help' => t('Project almost full'),
    'field' => [
      'id' => 'almost_full',
      'click sortable' => TRUE,
    ],
    'sort' => [
      'field' => 'field_funding_amount_value',
      'id' => 'funding-percent',
    ],
  );
}

2:- Code in sorting class

use Drupal\views\Plugin\views\sort\SortPluginBase;

/**
 * Basic sort handler for Events.
 *
 * @ViewsSort("funding-percent")
 */
class FundingPercent extends SortPluginBase {

  /**
   * Called to add the sort to a query.
   */
  public function query() {
    $this->ensureMyTable();
    $percentage = "round(( $this->tableAlias.$this->realField/node__field_funding_goal.field_funding_goal_value * 100 ),2)";
    $this->query->addOrderBy(NULL,
      $percentage
    );
  }

}

But it's showing me column not found error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'node__field_funding_goal.field_funding_goal_value' in 'field list': SELECT node_field_data.created AS node_field_data_created, node_counter.totalcount AS node_counter_totalcount, node__field_funding_end.field_funding_end_value AS node__field_funding_end_field_funding_end_value, node_field_data.nid AS nid, ABS(round(( node__field_funding_amount.field_funding_amount_value/node__field_funding_goal.field_funding_goal_value * 100 ),2)) AS absroundnode__field_funding_amountfield_funding_amount_ FROM {node_field_data} node_field_data LEFT JOIN {node_counter} node_counter ON node_field_data.nid = node_counter.nid LEFT JOIN {node__field_funding_end} node__field_funding_end ON node_field_data.nid = node__field_funding_end.entity_id AND node__field_funding_end.deleted = :views_join_condition_0 LEFT JOIN {node__field_funding_amount} node__field_funding_amount ON node_field_data.nid = node__field_funding_amount.entity_id AND node__field_funding_amount.deleted = :views_join_condition_1 WHERE (node_field_data.status = :db_condition_placeholder_2) AND (node_field_data.type IN (:db_condition_placeholder_3)) ORDER BY node_field_data_created DESC, node_counter_totalcount DESC, absroundnode__field_funding_amount.field_funding_amount_ ASC LIMIT 6 OFFSET 0; Array ( [:db_condition_placeholder_2] => 1 [:db_condition_placeholder_3] => crowdfunding_project [:views_join_condition_0] => 0 [:views_join_condition_1] => 0 )


texts: i m using ckeditor in a form that submits through ajax. when the submit is clicked and the submission is in progress my ckeditor converts into a plain text editor and all the controls are gone, as soon as the submit is complete, the controls are back, it looks ugly. Any solution?


texts: How do I use hook_action_info() actions with entity_create->save() during bootstrap?

texts:
I'm building a standalone script which uses Drupal's bootstrap because I need to render it as a page in an external application (a portal, specifically). The goal is to allow users to register for events with an Ajax call to this script.

The module I'm using is node_registration. It I'm able to create and save the entity (registration) using the API in the bootstrap script with no problem. However, there should be an e-mail that gets sent to the user after registering. This action does work when they register for an event in the CMS (not the external app/portal).

I'm fairly new to Drupal (not PHP), so I'm open to any suggestions. Perhaps I should be making an AJAX call to the form URL in Drupal?

This is the code I am using.

$eventRegistration = entity_create('node_registration', array(
  'uid' => 0,
  'type' => 'event', //bundle
  'node_type' => 'event',
  'nid' => $nid,
  'email' => $email,
  'slots' => 1,
  'author_id' => 0,
  'uid' => 0,
  'created' => REQUEST_TIME,
  'update' => REQUEST_TIME,
  'secret' => _node_registration_secret(),)
);

$eventRegistration->save();

The function I'm looking to have automatically executed is node_registration_send_mail_action(), and it is included in node_registration.actions.inc.

Here is what I'm using to bootstrap Drupal:

require_once(DRUPAL_ROOT . '/includes/bootstrap.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);


texts: webform telephone field validation fails

texts:
I am using webform-8.x-5.0 and created a telephone field with international phone numbers support. Before submitting the form if i enter some number like "+91fdfgdfg45646" it shows "Invalid phone number" (which i am not sure if it is a valid number or not). But when I submit the form it gets submitted. The issue is if it is invalid, the form should not have been submitted. Please suggest a solution. The form should not be submitted if it is invalid number.

Thanks in advance

Image for reference:


texts: How can I add a Twig template to a programatically created custom content type?

texts:
I created a module implementing a content type. How can I set a custom template file for that content type and for the teaser and full view modes? I need to use the template files in the folder of my module, not the theme the site is currently using.

These are some details about my module.

Module name: My Module
Content type name: My Content
Teaser template name: node--my-content--teaser.html.twig
Full template name: node--my-content--full.html.twig
Field template name: field--node--field-my-field--my-content.html


texts:
After upgrade from 8.7.10 to 8.9.13, i updated the pathauto module from ftp and trying to install from drupal admin but it showing an error like
"Unable to install Pathauto, pathauto.settings already exists in active configuration."
Based on the post
https://www.drupal.org/forum/support/post-installation/2016-01-29/already-exists-in-active-configuration-issue
i deleted the pathauto.settings row from config table and cleared the cache and trying to install the module , but still showing the same error.
Please help me.
Thanks in advance.


texts: Multilingual site page not found error on default language URL path prefix

texts:
I have a multilingual site with 3 enabled languages.
Default language is Dutch. However when going to http://MYSITE.com/nl I receive a page not found error. /fr and /en is working as usual.
How can I use /nl for my Dutch content? When using the user interface text block to display language links, on a /nl page the NL link is set to active.


texts: How to impose a global maximum limit on two webform number fields?

texts:
I'm using a webform as an online reservation form.
Apart from the name, email and phone number fields, there are two number fields to ask how many adults and how many children will be attending an event.

The thing is we want to restrict the online reservation to 8 participants (adults and children combined)
For example : It can be 8 adults or 4 adults and 4 children or 6 adults and 2 children etc..

Is there a way to use some sort of rule to impose this ?
thanks


texts:
Here is query which is, I am using

$query = db_select('users','u');
$query->join('users_roles', 'u.uid = users_roles.uid'); // JOIN users_roles with users
$query->fields('users', array('name','uid')) // SELECT the field name from users
    ->condition('users_roles.rid', 5);

  $results = $query->execute();

Actually i want the user name and id for that those user who are under role id = 5

  PDOException: SQLSTATE[42000]: Syntax error or access violation: 1066
  Not unique table/alias: 'u': SELECT users.name AS name, users.uid AS
  uid FROM {users} u INNER JOIN {users_roles} u.uidusers_roles.uid WHERE
  (users_roles.rid = :db_condition_placeholder_0) ; Array (
  [:db_condition_placeholder_0] => 5 ) in user_assign_list() (line 80 of
  C:\xampp\htdocs\nic\sites\all\modules\user_assign\user_assign.module).

This error shown on the browser. Actually i am creating the custom module file for this requirement. Is there any need to include sql connection for those custom module?
here is .module file

<?php
function user_assign_permission() {
  return array(
    'submit user_assign' => array(
      'title' => t('Submit user_assign'),
      'description' => t('Submit the user_assign form'),
    ),
    'access user_assign list' => array(
      'title' => t('Access user_assign list'),
      'description' => t('Access the user_assign submissions'),
    ),

  );
}
function user_assign_menu() {
  $items = array();

   $items['users-list'] = array(
    'title' => t('User Assign'),
    'page callback' => 'user_assign_list',
    'access callback' => TRUE,
    'access arguments' => array('access user_assign list'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

function user_assign_theme($existing, $type, $theme, $path) {
  return array(
    'user_assign_function' => array(
      'variables' => array('rows' => NULL),
    ),
    'user_assign_template' => array(
      'variables' => array('rows' => NULL),
      'template' => 'user_assign_template',
    ),

  );
}

function theme_user_assign_function($variables)
{
    $output = '';

//   print_r($variables);
    foreach($variables['items'] as $row) {

     $output .= '

'.$row[1].'&nbsp'.$row[2].'

';

    }

    return $output;
}

function user_assign_list() {
 // $query = db_select('users', 'n');

//  $query->condition('n.empname', '%' . db_like($_GET['empname']). '%','LIKE');

 // $query->fields('n', array('fe_id', 'empcode','empname','empphoto','empemail','empdesignation'))
  //    ->limit(4)
  //    ->addTag('node_access')
  //    ->groupBy('n.fe_id');
$query = db_select('users','u');
$query->join('users_roles', 'u.uid = users_roles.uid'); // JOIN users_roles with users
$query->fields('users', array('name','uid')) // SELLECT the field name from users
    ->condition('users_roles.rid', 5);

  $results = $query->execute();
     $rows = array();
  foreach($results as $result)
  {
    $rows[] = array(
        $result->uid,
        $result->name,
        );

  }
  $output = theme('user_assign_function', array('items' => $rows));
  return $output;
}

?>


texts: Way to programmatically add string translations?

texts:
is there a way (snippet) to programmatically add translations for strings (user interface translation), e.g. in hook_update_N()?

A way in Drupal 7 was http://dropbucket.org/node/323.

/**
 * Helper to manually add a single translation string.
 *
 * After adding strings use locale_clear_cache() for clearing caches.
 */
function locale_add_translation($source, $langcode, $translation, $context = '', $textgroup = 'default') {
  require_once DRUPAL_ROOT . '/includes/locale.inc';

  $report = &drupal_static(__FUNCTION__, array('additions' => 0, 'updates' => 0, 'deletes' => 0, 'skips' => 0));
  _locale_import_one_string_db($report, $langcode, $context, $source, $translation, $textgroup, 'Manual import via helper ' . __FUNCTION__ .'().', LOCALE_IMPORT_OVERWRITE);
}

/**
 * Helper to clear the locale cache.
 */
function locale_clear_cache() {
  require_once DRUPAL_ROOT . '/includes/locale.inc';
  // Clear locale cache.
  _locale_invalidate_js();
  cache_clear_all('locale:', 'cache', TRUE);
}

Is there anything like this for Drupal 8?


texts:
I have what should be a simple question.  I am coding a module that allows the user to add meta and link tags to the  of your HTML page..think of something similar to CSS injector. (I'm sure something like this already exists, but I'm using this as a learning project).  I am able to create the config forms and everything that the admin would need to create a new entry, and I'm able to input new entries and save them to the database.

What I want is below the "new entry" part of the form, I want to list all current entries with "edit" and "delete" links next to each one (every module under the sun has this functionality).  Can someone point me in the right direction on how to do this?


texts: How to be efficient and fast at writing boilerplate code for plugins?

texts:
What I am currently doing:

Using \Drupal::service for prototyping, for example \Drupal::service('path.matcher')->isFrontPage();
We have phpcs that is checking for this kind of things and it says
\Drupal calls should be avoided in classes, use dependency injection instead

So far so good, I know how to include the path matcher as a service, and I am doing that manually, but when I have several of those, it can get tedious.
Class properties, rather messy constructor method, I have to look for the proper interface, to include them, create method, etc.
Is there a quick way to inject service to a plugin in an already existing module, like using Drupal Console?


texts: How to theme the user picture to appear in lightbox

texts:
I want to enable viewers to click on an image and have it displayed as a lightbox.

in my user-profile.tpl.php I have access to '$user_profile['picture']'. After I dsm($user_profile) I see an array of $user_picture with #markup and #weight elements.

I'm not quite sure if this is the right approach and how to go about altering the markup before it's displayed so i can add 'rel="lightbox"'


texts: Opening user session programmatically using headers information

texts:
I'm developing a website with an external user authentication provider. The whole login process is external, that I don't need to worry about. Once a user is logged in, the external provider adds extra data in the request headers (i.e. customer id), that I can use to map an external customer id with a user from the Drupal users table.

Which hook suits the best to open a session and login the user programmatically on each page request? (hook_boot() ?)


texts: How to get update to check Feature Server

texts:
I have a custom module hosted on a feature server. When I update Drupal how can I get it to check the Feature Server to see if there is an update there?

In the back of my head I thought it was something you could add to .info. However I can't find an example.


texts:
how do I get taxonomy based node content through custom query? I have taxonomy terms displayed using drupal api function. Now I need to fetch content based on terms id or name from database? Can any one please help me.Either using entity field query or SQL?

$tree=taxonomy_get_children(1);
 foreach ($tree as $term)
 {
 $item[] = $term->name;
 $child_term = taxonomy_get_children($term->tid);
 if (!empty($child_term))
 {
 <a href="?name=<?php print $term->tid; ?>">
 <?php
 print $term->name."
";
 ?>

 foreach ($child_term as $child)
 {
 $item[] = $child->name;
 <a href="?tid=<?php print $child->tid; ?>" name="tid">
 <?php
 print $child->name."
";
 ?>

 <?php
 $nodes = taxonomy_select_nodes($child->tid);
 $node = node_load_multiple($nodes);
 $nidd=(int)$node->nid;
 foreach($node as $node1):
 $tids = field_get_items('node', $node1, 'field_product_sub_cat');
 foreach ($tids as $tid){
 if($tid['tid'] == $child->tid){
 print $node1->title;
 print render(field_view_field('node', $node1, 'body'));
 }
 }
 endforeach;
 else
 print $term->name."
";


texts: Drupal CSS is not loading after server move

texts:
After moving the server, my CSS files don't work. When I open them in a browser, an error shows up:

  SmartOptimizer Error: Could not create cache file(cache/so_11966173eab0271ad5607eadd11bf298.css.gz).

I have SmartOptimizer Installed, and I don't know if I need to change the settings.

How can I fix this?


texts:
My module provides config that creates a field:

field.storage.paragraph.field_accordion_section_title.yml

langcode: en
status: true
dependencies:
  module:
    - paragraphs
    - text
id: paragraph.field_accordion_section_title
field_name: field_accordion_section_title
entity_type: paragraph
type: text_long
settings: {  }
module: text
locked: false
cardinality: 1
translatable: true
indexes: {  }
persist_with_no_fields: false
custom_storage: false

I would like to update the field to use string_long instead of text_long.  I would like to handle this via hook_update() since the module was already installed on multiple sites.  I tried the following:

use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;

/**
 * Updates accordion section title to string type.
 */
function my_module_update_8001() {
  if ($fields = \Drupal::entityTypeManager()->getStorage('field_storage_config')->loadByProperties(array('field_name' => 'field_accordion_section_title'))) {
    foreach ($fields as $field) {
      $new_field = $field->toArray();
      $new_field['type'] = 'string_long';
      $new_field = FieldStorageConfig::create($new_field);
      $new_field->original = $field;
      $new_field->enforceIsNew(FALSE);
      $new_field->save();
    }
  }
}

I get the following error when updating: Failed: Cannot change the field type for an existing field storage.


texts: How to solve the strange behavior of content node in view

texts:
I found one strange behaviour in views. Like if I click on a node title of a view table, it will take me to node page. If I click edit and save the content will save faster.

But in the view, which has an edit field link, if I click on the edit link, and try to save the same node it takes several minutes to save.

Can anyone know why is this strange behaviour is happening and how to resolve it?


texts: How can I use rules to grab fields from one content type to another then delete the old nodes?

texts:
I have an D7 site using feeds that create dozens of nodes daily populated with RSS articles. I use the body fields from these articles as well so I can read them on-site without clicking to the actual publisher. Means my database is getting bigger. Here's what I want to do:

Any node over 4 weeks old of 'feed' type needs to create a new node called 'feed archive' and do this by using the old title and just the article URL - no other fields need to be transferred. Then the old node can be deleted. So I basically dump all the body content and other fields attached to the old 'feed' node and just leave the title and URL and create a new node with these two things.

I have created a rule using VBO views before so kind of understand that, but don't know how I say: 'create a new node, only grab these two fields from it, then delete it'

Any help greatly appreciated.


texts: Contextual links in block disabled when using Twig Tweak and UUID

texts:
In my taxonomy-term--NAME.html.twig I use a reference field to load a 'block_content'.

{% for item in term.field_blocks %}
  {% set uuid =  item.entity.uuid.value %}
  {{ drupal_block('block_content:' ~ uuid) }}
{% endfor %}

The block is rendered correctly but without the 'contextual links' (quick edit on front-end).

When I look into the twig_tweak module, I see you can add an array with configuration options.

public function drupalBlock($id, array $configuration = [], $wrapper = TRUE) {

    $configuration += ['label_display' => BlockPluginInterface::BLOCK_LABEL_VISIBLE];

    /** @var \Drupal\Core\Block\BlockPluginInterface $block_plugin */
    $block_plugin = \Drupal::service('plugin.manager.block')
      ->createInstance($id, $configuration);
    ...
}

Does anyone know how I can change the twig-rule to something like this:

{{ drupal_block('block_content:' ~ uuid, {show_contextual_links:true}) }}

I found this question, but that is not correct:
Programatically render block with contextual links (in php)


texts: Better Exposed Filters: filter options display

texts:
I have created some BEFs as checkbox list to allow multiple selectios, the filtering options are many, so I want only limited filter options to appear say 5. If I click on more then only it should show the remaining.

for eg:

FILTER OPTIONS
op1
op2
op3
.
.
.
opn

I want them to appear as

FILTER OPTIONS
op1
op2
op3
op4
op5
   more
on clicking more link it has to display the remaining options. How ca i achieve this?


texts: Filtering my products on drupal commerce

texts: I have imported 5.000 products to my drupal-commerce website.I want the user to be able to navigate fast on all of these products,so I just figured out that I need to make somehow a filter or a search that when the user chooses/selects some of the features of the product the result will be only the products with these features.How can I manage to do this on Drupal 7 and Drupal Commerce(Commerce kickstart?)


texts:
I upgraded a Drupal 6 site to Drupal 7. After upgrading, everything works fine. I had migrated all the content types and content. I am able to view all the content.

When I edit or add a content which contains an image field, I get the following error:

  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_image_alt' in 'field list': INSERT INTO {field_data_field_image} (entity_type, entity_id, revision_id, bundle, delta, language, field_image_fid, field_image_alt, field_image_title, field_image_width, field_image_height)

I came to know that field_image_alt is not found.

How can I manually add the field? I had run update.php specified in drupal documentation. But still i found that the field is missing. Anyone pls help me to add those fields.??


texts: Select fields from two tables using db_select()

texts:
I am using db_select() and I don't understand the syntax of the fields() method. I'm using a join() to join another table. So for tables t and n, I want to do something like

SELECT t.tid, t.field1, t.field2, n.title, n.author
FROM table t INNER JOIN node n ON t.nid = n.nid;

I have

$results = db_select('table', 't')
  ->fields( ... )
  ->join('node', 'n', 'n.nid = t.nid')
  ->execute();

But as you can see, I'm lost at fields(). The examples I've seen only specify fields for one table:

->fields('t', array('tid', 'field1', 'field2'))

What is the syntax that I want to use?


texts: How do I add a script just above the closing body tag?

texts:
How do I add a script on Drupal 8 site/app just above closing body tag?

Vendor provided some JS in the following form:

<script>
    ... code
</script>

Asked me to place immediately above </body>.

The script was only to run for Anonymous traffic.

Here's how I did it:

THEME = name of your theme

Removed <script> and </script> from code
Minified using https://javascript-minifier.com/
Created file name-of-my-script.min.js
Uploaded to THEME/js/custom/name-of-my-script.min.js
Added library to bottom of THEME.libraries.yml

name-of-my-library:
  version: 1.0
  js:
    js/custom/name-of-my-script.min.js: {preprocess: false} // {preprocess: false} is responsible for code showing up above </body>

Added the following code to THEME.theme to an already existing function: function THEME_preprocess_page(&$variables) {}

$logged_in = $variables['logged_in'];
    if (!$logged_in) {
    $variables['#attached']['library'][] = 'THEME/name-of-my-library';
}

Cleared cache.

Resourses that helped:

https://www.drupal.org/docs/8/api/javascript-api/add-javascript-to-your-theme-or-module
https://www.drupal.org/docs/8/creating-custom-modules/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-module


texts: If you update a routes file in Drupal 8 how do you clear the cache?

texts:
Having worked with Drupal 7 since its launch, I'm learning Drupal 8. At the moment I'm finding that whenever I change anything I have to do drush cache-rebuild to get things working again.

On my VPS this takes 15 seconds (and then the next page load also is slow). I have a feeling this may be a sledge hammer to crack a nut situation.

Is there a more efficient way to get Drupal to recompile the (changed) routes from {module}.routing.yml files?


texts: What is the proper way to set up the front page?

texts:
I currently have my front page set to a node/basic page through Configuration > Site information > Default front page. Will this cause Google to index both the home page and the default front page? I just don't want to get hit for duplicate content.

I’m worried because both were showing on the XML sitemap before I removed the default front page (droneswithcameras.com/search-best-drones-cameras). You can look at my site to see what I’m talking about. The default homepage is set to /search-best-drones-cameras.

Are the front page and home page essentially the same thing? It’s just strange to me that there are multiple URLs for the same page.


texts: How can I change a page's title for each page individually?

texts: I am wondering if there is a way that I can change the page titles so that users can see a nice title but that at the same time, the internal title of that same page be different?


texts: Multiple Content Types sharing a lot of common fields

texts:
I wanna have three types of Events on my website. All three types of events have common fields such as: name, date, location, time, host, price.. and many more.

Now each event type has few extra fields that do not apply to other events types.

It is very important requirement in UI administration form not to show fields that do not apply to a specific event type.

I was considering the idea of creating 3 separate Content types (one for each Event type), but somehow I feel this is not the best way to go since there is a lot of common elements.

Any suggestions?


texts: User register with OTP via email (verfification code)

texts:
I'm using Drupal 8 and I have the following requirement:

Once a user register, before logging in, they need to input a one time verification code received via email and NOT SMS.

I've used the module (https://www.drupal.org/project/otp_verification) and it works (despite the fact that it doesn't allow any email customization, identity wise), but it needs a liscence, which right now, i don't have the means to acquire one.

Is there ANY other way to achieve the reauirement above?

Thanks guys


texts:
I am trying to add a link to a taxonomy landing page, like this

$breadcrumbs->addLink(Link::createFromRoute($term_name,"/taxonomy/term/$tid"));

but I get the following error : Symfony\Component\Routing\Exception\RouteNotFoundException: Route "/taxonomy/term/2041" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 187 of C:\drupaldevsites\pup-dev\docroot\core\lib\Drupal\Core\Routing\RouteProvider.php).


texts:
Possible Duplicate:
  Views: How can I show a list of users who have a taxonomy term attached via a term reference field?

i want to assign users profile in taxonomy terms. So, i have created a vocabulary like Gender which has two terms like Male and Female. So, while registering an account in my website people need to choose his/her gender, and i wish if other people click on those terms from some one profile page, for example if they click on Male then on the taxonomy page all profiles with Male will get appear and same for other terms. But i see no result on those terms pages, to find a solution i have created a Views which successfully show users profile for each terms.Now, my question is how to integrate the Views for the terms pages? |OR| On user profiles how to link Terms pages to those Views page?


texts:
I client has recently been acquired by a new Group and has requested that I do a search and replace for their name e.g. "Foo Group" and replace this with "New Group". There will be multiple instances of this e.g. "Foo Housing Trust Group" and "Foo Housing Trust".

I can see in a previous post How to fix millions of alt text that are missing on body content that I can use the Search and Replace Scanner module but would this be the best way to do this rather than a DB Query?

Thank you for any help you can provide. Pete.


texts: Display of multi values image field problem

texts:
I am getting this output for example image:

I know it looks horrible, but main problem is that there is no [img] tag inside [a] tag.

Only first image of list render properly.


texts: Export content type: 'An illegal choice has been detected. Please contact the site administrator.'

texts:
I have a content type which uses a lot of conditional fields, along with an email field, field permissions. When I try to export the type, it produced the error 'An illegal choice has been detected. Please contact the site administrator.' and the export script seems to be truncated so the fields do not import correctly.
Any ideas what might be causing this?


texts:
I have two content types, Location and Offer. The Offer type has an entity reference field that points to one or more Locations.

A user of my Merchant role may create Location and Offer nodes. When creating an offer, they need to select from the list of Location nodes that they created.

I created a view with an "Entity Reference Source" display to build the Merchant's list of Locations when creating Offers. I limited the Locations to this Merchant by a relationship between author (of the Location) and currently logged in user.

Now, I need Administrator users to be able to edit Offers. The problem is that the view creates a list of the Administrator's Locations instead of the author Merchant's Locations.

How can I supply a list of entities to the locations entity reference field that is the current user's Locations when an Offer is being created and the author's Locations when an Administrator edits?


texts: Send an email to editor of webpage 6 months after creation/updated date

texts: I'm trying to find a way of emailing the editor of a webpage 6 months after it has been updated so they can check the information is still up to date. I've been reading through some of the existing posts on this subject such as Send email after content update but I wanted to find out if I was going along the right lines. I have Rules and Rules Scheduler installed. Do I need an email field on the content type or can it detect the email address from the editoral workflow. I also have the Content Moderation Notifications module installed, would this module be required for this purpose?


texts: Dynamic ordering of views based on argument

texts:
I'm sure this is possible, I'm just looking for some advice on the best way to approach it.

Here's the situation:

We have some English content. If the user is in Australia, we want to show them all content, with Australian tagged content sticky at the top. If the user is from another English speaking country, we will just show them all content in normal reverse chronological order.

At present, we are tagging content with Locations using locations.module. I have some code in hook_init which identifies the user's country, which is stored in their session.

I figure using an argument to locations.module's views argument support is the best way to do this, but we can happily use another solution like taxonomy if that is more appropriate.

Any ideas on how best to configure a view like this?


texts: How to create a custom context by using Drupal's context API?

texts:
I can access current node context in my block plugin by adding:

 *  context_definitions = {
 *    "node" = @ContextDefinition("entity:node", label = @Translation("Node"), required=FALSE)
 *  }

to its annotation. And then access node object by using:

$context = $this->getContext('node');

/** @var NodeInterface $node */
$node = $context->getContextData()->getValue();

Provided it's available. But let's say I want to create context that is active only if node has specific field.

I'm currently trying to reverse engineer this, because there are literally no resources on context API that I could find, but maybe someone have some working example to share?


texts: Timefield [entityform:field-name:value_formatted] token not working in Rules

texts:
I am having troubles using token replacement for the Time field field type provided by the module Timefield  in Rules.

The token pattern [entityform:field-name:value] works just fine (it gets replaced by the raw "offset value" of the field - I'm using this field in an Entityform), but I just can't figure out how to display the formatted value.

I've followed directions in the pattern replacement help text, and tried different combinations of hyphens and low hyphens to no avail: [entityform:field-name:value_formatted], [entityform:field_name:value_formatted] and [entityform:field-name:value-formatted] - none work.

I've already posted a request for support in the Timefield issue queue, but was wondering if anyone here has had a similar issue, and can point me in the right direction? Thank you in advance.

EDIT: After some additional testing, I've discovered that the [entityform:field_name:value_formatted] token DOES work in some situations, such as inside a Rules Component. It does NOT work if the Rule is triggered by the event After saving new content(for nodes) or After saving a new entityform submission (for Entityforms). Obviously this seems to be a bug, but I don't have the time to figure out where this problem happens. Apparently the value token of the field is built right away, but the value_formatted is not readily available when the Rule is triggered right after creating a new entity. Any thoughts?


texts: How to add class in title div for specific block?

texts:
I have created a block using Views module in website using drupal 7.
My block title's HTML structure is as bellow:

BLOCK_TITLE

I want to add a class in
.
Should I create a module for this or any other way?
Please guide me how can I do this?

Thank you in advance


texts:
I am trying to make gmap geofield which is a field of a node add/edit form to work inside a popup window. I tried ng lightbox, colorbox, lightbox and I always get the message

Uncaught ReferenceError: google is not defined geofield_gmap.js?nuubr4:66

Any ideas how can I solve this?


texts:
I have created content type ad with 2 fields:

field1 (select list)
field2 (select list)

created a block in views with contextual filters:

field1 and "provide default argument" > php code:

$node = node_load(arg(1));
return $node->field1['und'][0]['value'];
field2 and "provide default argument" > php code:

$node = node_load(arg(1));
return $node->field2['und'][0]['value'];

When node has all fields chosen, it works well, but if i omit 1st or 2nd field, views hiding my block. If i set "Show all values" if no default argument present, then it shows all nodes.

How can i make contextual fields optional? E.g. if first field has no value then just omit it and use 2nd contextual filter.


texts: Change de default status: Published to Not Published in Publishing Options

texts:
Is it possible to alter somehow the Publishing Options of the content type so that the default status of the article is Not Published?

I would like to do it in a preprocess function if possible. Thanks.


texts: "Fatal error:Class DrupalDefaultEntityController not found " error is showing after upgrading to 7

texts:
We have upgraded from 6.13 to 7.41, and we are getting the following error after upgrading:

  Fatal error:Class ' DrupalDefaultEntityController ' not found

The site runs on PHP 5.3, Apache 2, and MySQL 5.

How can I fix it?


texts: CSS is not aggregated anymore - how to debug?

texts:
On a rather complex Drupal 6 site (multi domain etc.) CSS files are not aggregated anymore and CSS style definitions appear directly inside the HTML pages.  The output of ´drupal_get_css´ is ok, but when I installed the Advanced CSS/JS Aggregation module, I see that the module reports the aggregated css files as Missing files.  But when these files are opened manually, they are ok.  The problem itself is not related to the the advagg-module, I only enabled it for debug reasons.

I have not switched themes on the site affected, but I have been playing around with a new theme (mobile jquery) and a correcponding jquerymobile module on a different module from the same installation.  I do not currently think, that the problem has been caused by this module.

I guess the problem is caused by some module weights, but I am having trouble debugging the theming process.  I am looking for help, where I should start debugging, why the aggregated CSS files are not used.

Update:
I have edited drupal_add_css to default to not preprocess files.  The difference is, that each css-block is inserted in a seperate style statement, whereas right now, only a single aggregated CSS style statement is generated.  So I am really tryng to find out, why I am ending up with the long css style definition, instead of a link to the aggregated stylesheet.


texts: Can't get the key of webform's select field in the results

texts:
Im facing a problem with Durpal Webform,
Ive created a select field and added options like said in the description (safe_key|Readable value)

The options are like :

w|Woman
m|Man

When I submit my webform, I would like to get the key in the results ('w') or at least in the excel file when I export it. But the Drupal default behavior is to display the selected readable value in the result ('woman') ...

How can it be done ?

For me it doesn't seem like a normal behavior, since when you create an html form with a select list, you can define the 'value' attribute (in which you can put a key) and you can define the displayed value (which will not be submit).
Drupal seems to use only the Readable value ...

Thanks !


texts: How to exclude Admin Toolbar from being Translated in Drupal 8?

texts: I have enabled 3 languages, but I always want to show Admin toolbar (menu) in English, I don't want that to be translated, how can I do that ? If I want to see front end content in Arabic then I don't want to see Admin menu in Arabic.


texts: Why does cloning a private git repository via Drush make file fail using SSH authentication?

texts:
I have multiple private git accounts set up with SSH system's keychain authentication for each git repo.

It works to clone private git repos from command line:

git clone git@git_ssh_alias:git-account/some_repo.git

The git_ssh_alias is the alias name declared in .ssh/config file that specifies the SSH key that should be used.

However, this same clone doesn't work when running from make file via Drush script as following.

From Make file:

projects[theme_name][type] = "theme"
projects[theme_name][version] = 7.x-1.0
projects[theme_name][download][type] = "git"
projects[theme_name][download][url] = "git@git_ssh_alias:git-account/some_repo.git"
projects[theme_name][download][branch] = "master"

From Drush script:

drush_invoke_process('@self', 'make', array($make_file), $options)

where $make_file is a path to a make file and options are:

$options = array();
$options['no-core'] = TRUE;
$options['yes'] = TRUE;
$options['contrib-destination'] = 'sites/all';

My question: How to clone private git repo with local ssh keychain authentication enabled?


texts: Permission Conflict - Commerce Order - Please give me a guidance

texts:
Today I a faced a confusing problem in my project.

let me introduce my project briefly.

I am creating a shop with drupal 7 and commerce module.

In my site 2 kinds of people exist. some people are seller and the others are customer.
I have created a role called "SELLER" for seller users.

as you know each member has a specific page in his client area called "orders". in this page a member is able to see his orders (it is history of user orders)

and in drupal 7 permission, it is defined that each person is able to see his/her orders only. there is no permission to see the other people's orders. (ONLY ADMINISTRATORS CAN SEE ALL ORDERS)

but in my project, I want to give permission to the sellers to see the other people' orders that contains at least a product that the current seller has introduced.

let me give you an example.
Imagine that we have a seller user in our site. his id is "seller_1"
seller_1 is selling product_1, product_2 and product_3 in site.

now a new user we called him "customer_1" wants to but product_1 .
he make an order and complete it. imagine that order number is "100".

now an order is saved in database and "customer_1" is able to see this order (order number 100) in orders page.

but in my plan the user "seller_1" must be able to see the order number 100 in a specific page that is created via a view.

=============================================

I tried to run this scenario but I have not found a solution yet.

in permission page, I gave "ability to see all orders" permission to seller roles. this modification solved my problem but it really breaks the security of site. because if we grant ability to see all orders to "SELLER" roles, the seller people are able to see all orders in the site even though there is no related product in the orders.

Now, do you have any suggestion for me?

Thanks a lot for your helps.


texts:
Short of replacing html.tpl.php and calling drupal_get_js/drupal_get_css functions and tweaking the output as required...

How else can I drop some of the JS or CSS that drupal (D7) seems to include in the resulting markup??

The ajaxPageState object is quite confusing I would rather start from minimal markup and stuff and build from what I know.

Any ideas/???


texts: How to print a custom user field in comment.tpl.php?

texts:
I'm trying to print a custom user field (field_avatar) image as a replacement for the user picture. Why? user picture file directory would not accept tokens. This mean, I could run into a scenario where there are 100k files in a directory slowing the website!

From googling answers for hours, this is the best solution I've read.

In comment.tpl.php placed in my custom omega 4 subtheme, I added this code.

<?php  print render(field_view_field('user', $user, 'field_avatar'));  ?>

However, above code prints the default field_avatar picture! not field_avatar based on the comment ID? or UID of the author?

Please shed some wisdom smart ones!


texts: How to configure Compass module with Basic theme?

texts:
I am trying to use compass framework with Drupal 7, Basic theme and Compass module on my local hosting on Windows. It is already installed on my computer.

Should i install it to my local webserver again somehow, how can i know the path of existing Compass exutable?


texts: Is there any convention about the form IDs?

texts:
Is there a convention for the form IDs?

I see that core sometimes uses module_name.form_name and sometimes module_name_form_name.
In my case, I'm using module_name.form_name.


texts:
I would like to display the rank position of a node based on a field value.

Let's say that in field_A there is the node's quantity of "points" and in field_B the node's category.

Then, I would like to display that the current node is 5th out of 15 in its category for example.

thanks for your help.


texts: For product type 'donation' allow customer to choose "price" and add allocation field

texts:
Using Drupal commerce I want to change checkout functionality to allow the user to choose the amount for product type 'donation' on the user details page. See here:

The user should be able set "the price". How would I go about this?

You may also see that I  want to add a custom input for choosing allocation of the donation. Would I do this using a hook to alter the form? How? And would it capture the data within commerce store admin?


texts: Exposed filter of content type set to related term

texts:
I have used Taxonomy term template in views to show ContentType-A*. While **ContentType-A has a field reference for ContentType-B, and I want to use ContentType-B as exposed filter. The problem with this filter that it shows all its content, and I wanted to be limited to terms it is set to.

So how to show only contentType-B as exposed filter, related to current term?

FYI: the taxonomy term view already has following contextual filters settings:

/* Contextual filter: Content: Has taxonomy term ID (with depth) */
$handler->display->display_options['arguments']['term_node_tid_depth']['id'] = 'term_node_tid_depth';
$handler->display->display_options['arguments']['term_node_tid_depth']['table'] = 'node';
$handler->display->display_options['arguments']['term_node_tid_depth']['field'] = 'term_node_tid_depth';
$handler->display->display_options['arguments']['term_node_tid_depth']['default_action'] = 'not found';
$handler->display->display_options['arguments']['term_node_tid_depth']['exception']['title_enable'] = TRUE;
$handler->display->display_options['arguments']['term_node_tid_depth']['title_enable'] = TRUE;
$handler->display->display_options['arguments']['term_node_tid_depth']['title'] = '%1';
$handler->display->display_options['arguments']['term_node_tid_depth']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['term_node_tid_depth']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['term_node_tid_depth']['specify_validation'] = TRUE;
$handler->display->display_options['arguments']['term_node_tid_depth']['validate']['type'] = 'taxonomy_term';
$handler->display->display_options['arguments']['term_node_tid_depth']['depth'] = '0';
$handler->display->display_options['arguments']['term_node_tid_depth']['break_phrase'] = TRUE;
/* Contextual filter: Content: Has taxonomy term ID depth modifier */
$handler->display->display_options['arguments']['term_node_tid_depth_modifier']['id'] = 'term_node_tid_depth_modifier';
$handler->display->display_options['arguments']['term_node_tid_depth_modifier']['table'] = 'node';
$handler->display->display_options['arguments']['term_node_tid_depth_modifier']['field'] = 'term_node_tid_depth_modifier';
$handler->display->display_options['arguments']['term_node_tid_depth_modifier']['exception']['title_enable'] = TRUE;
$handler->display->display_options['arguments']['term_node_tid_depth_modifier']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['term_node_tid_depth_modifier']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['term_node_tid_depth_modifier']['specify_validation'] = TRUE;


texts:
I have a block view that displays own articles created (this view is inside a panel page). But this view didn't displayed for other users except administrators, or when I check the permission 'Bypass content access control' to the other roles.

You know that this permission is a risk when it's checked, and I won't that other users have access to everything for nodes.

I checked the permissions like that :

inside the Views UI edit page : access option => View published content (I changed to 'none' also)
inside user permission page : "View published content" && "View own unpublished content" of "node" section are checked (also other permissions : create new article, edit own article ...)
there is no restriction in the block settings for a specific role.

Is really weird what happen here.
doese anyone have this problem before? Or how you can advise me to resolve this permission issue?

Thanks in advance.

ADD:

this is a list of modules in the website:

EDIT

I found from where is this problem :
my articles are not yet published and only published articles are shown in the view content. I made sure that the permission "view own unpublished content" is checked, but content still not shown when i unpublish again the articles (views content is not shown to the AUTHOR of these nodes)

I found this module to grant users to see all unpublished content but this is not good for me, because i need users to see only their content.

Any ideas ?
Thanks in advance.


texts:
I have this error when importing a single piece of config manually:

  Configuration foo.api depends on the MODULE extension that will not be installed after import.

There is no "MODULE" extension in the file system, core.extension config, the KeyValue table, config_snaphot, or anywhere else that I'm aware of that would be related.

If I delete the config

\Drupal::configFactory()->getEditable('foo.api')->delete();

Then try the import, it works. Great.

But as soon as I go back to my config form and save foo.api, the next time I try to import, I get the same error all over again.

This leads me to believe that a dependency tree must be stored somewhere, and that it isn't cleared when config is deleted.

Is this true, and if so where is it? If not, how can I resolve this?

I guess this could also be rephrased as How are module dependencies for basic configuration calculated, and how do you manually update them when they’re wrong?


texts:
In my template.php file for my theme I have tried the following:

function media_preprocess_page(&$vars, $hook) {
  if (isset($vars['node']))
  {
      // If the node type is "blog" the template suggestion will be "html--blog.tpl.php".
       $vars['theme_hook_suggestions'][] = 'html__'.$vars['node']->type;

      // If the node type is "blog" the template suggestion will be "page--blog.tpl.php".
       $vars['theme_hook_suggestions'][] = 'page__'.$vars['node']->type;

      // If the node id is "33" the template suggestion will be "page--33.tpl.php".
       $vars['theme_hook_suggestions'][] = 'page__'.$vars['node']->nid;
  }

    //Create page suggestion for first part of url-alias
    $url_alias = drupal_get_path_alias($_GET['q']);
    $parts = explode('/', $url_alias);

    $vars['theme_hook_suggestions'][] = 'page__'.$parts[0].'__alias';
}

This works for page--nodetype.tpl.php, but not for html--nodetype.tpl.php

You may be asking why do you need to override the html.tpl.php template per node type. It is because there is markup that I don't want to include for this particular node.


texts: Set the default value for a password field on a custom form

texts:
I have created a custom user register form. I want to set the default value for the password, and confirm the password fields.
My point is that, whenever form error occurs, the password fields get cleared. Users don't need to type the password again and again.


texts: How to block / restrict a list of URLs using Rules?

texts:
I'm currently blocking access to some admin menu pages using the Rules module as follows:

Events: Drupal is initializing

Conditions:

Data comparison > Data to compare:[site:current-page:url] then URL1 to block
Data comparison > Data to compare:[site:current-page:url] then URL2 to block
Data comparison > Data to compare:[site:current-page:url] then URL3 to block
...

Actions:

Show a message on the site
Page redirect to home

I want to supply a list of URLs in one field rather than multiple data comparison conditions, is this possible in Rules?


texts: How to compare text input with a user password stored in the database?

texts:
I've been trying to compare password values using a custom form.

Actually I want to show a relogin form after a particular amount of time. So I have created a custom form with two fields – email and password. And now I want to compare the password input from my custom form with the user's password stored in the database. If the passwords are same, then the user will be allowed to access the site agin.

I can't compare the hashed password with the custom form password. I know we can't compare the password values, because the password in the database is hashed.

Is any other way to compare them?


texts: Help with the sub-groups for Organic groups module

texts:
I want to have this functionality in my website, but I really do not know how to use this module, I tried to follow this tutorial http://mohitaghera.drupalgardens.com/content/creating-subgroup-organic-groups

But there is a step I do not understand, you have to set the sub-group content type a group or a group content in the og settings?

Please have someone used this module? how to use it. How does it work, what is the workflow of this module.


texts: Setting custom key names for exported JSON view fields

texts:
I have a result set similar to this (using Views RESTful Export):

My question, how to change created_1 key and name it something else?


texts: how to get values for my content type drupal 8

texts:
i have a problem to get values in my twig for my content type , i have just the '{{content}}' variable with a lot of  arrays , how can i get for example my field 'field_image' ?

<div{{ attributes.addClass(classes) }}>
  {{ title_prefix }}
  {% if label %}
    <h2{{ title_attributes }}>{{ label }}</h2>
  {% endif %}
  {{ title_suffix }}
  {% block content %}
    <div{{ content_attributes.addClass('content') }}>

      {{ content }}

    </div>
  {% endblock %}
</div>


texts: Is there a nodecomment equivalent/replacement for D7?

texts:
When I build help ticket systems for folks on D6, I use one content type for the ticket and a second content type with Nodecomment for replies. This lets me ensure that only the ticket owner and the internal helpdesk can see ticket history, and keep internal-only notes unpublished (vs no ability for internal notes with a comment).

Is there an equivalent for this in D7, or a better approach to take with contrib, or do I need to write a custom module to handle this?


texts: Set mod-rewrite to forward everything accept for one subdomain

texts:
I am trying to set up mod rewrite to forward the site example.com to www.example.com. This is fairly easy, because there is a line in the built in .htaccess file that I just have to uncomment. The problem is, I can't figure out how to set it so that all domains of example.com forward to www.example.com, accept m.example.com which I want to keep the same. These are the line's I'm using right now:

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

How can I set it to so that only m.example.com stays the same?


texts: Image height/width not saved using CKEditor and Full HTML input format

texts:
I just upgraded a Drupal site from 5.22 to 6.22.  Everything is working except for one small problem.  I replaced FCKEditor with CKEditor using CKFinder to manage file uploads.

The problem is that when I insert an image into the CKEditor and adjust the width/height, it is not saved.

I am using Full HTML for the input format, so I don't understand why it's not working.


texts: I am using drupal 6. I can create a group inside of a content type, but I can't see any way of attaching a field to the group. In a different installation of drupal on my computer, I see a box right under the new field name where you can enter a group, but this doesn't show up in this installation. Why would that be?


texts:
I need to load an entity definition to add a constraint and test it, I found that this is possible with the following code:

$manager = \Drupal::entityDefinitionUpdateManager();
$entity_definition = $manager->getEntityType('node');
$entity_definition->addConstraint(‘name’);

But I wonder if this is the correct way or if exists another.


texts: 30+ small modules versus 5 large modules versus 1 HUGE module: Which is better?

texts:
So, we have a large, complex Drupal 6 site, which has lots of secret sauce and magic glue making it work.

Where we can, we've contributed modules back and made them generic, but we still have 30 or so custom modules to keep it working the way we need it to. Each module (in most cases) has a specific function e.g. our hook alters for the notification system.

We are doing a huge code review at the moment and looking at improvements we can make. One thing suggested is to merge the large number of modules into a few smaller master modules, with lots of include files. We would, perhaps group by general site area e.g. "community", "admin" and "messaging", instead of specific modules per functionality.

Is the effort in doing this worth it? Will it speed up the site?
What module grouping would you recommend?

by site area ("community", "admin", "upload")
by hook ("form", "node", "user", "theme")
everything in one module
something else?

What naming conventions should we use for the include files to keep the codebase sane?
Am i right in assuming the goal should be tiny .module file with includes per hook / menu / area?


texts: I have created a view which displays a list of product in table grid formate with four rows. I have fields related to the product like image,price,descriptions and so on. Now I want to create a field which should display the  discount time left for each product. I tried to use jQuery countdown timer module to implement this but it didn't work. Can any one suggest which module I can use to create a timer field in Druapl7.


texts: User login link is always visible in menu

texts:
I have created user login link in the user account menu but the link is visible all the time(even for logged users). The user profile menu link and the user logout links are displayed properly(they are added by the user module).

My link definition doesn't differ from the user's module link definitions in any way but still this happens. Also the user.login route has proper requirements so this should just not happen but it does.

This is how user module defines menu links:

user.page:
  title: 'My account'
  weight: -10
  route_name: user.page
  menu_name: account
user.logout:
  title: 'Log out'
  route_name: user.logout
  weight: 10
  menu_name: account

This is how I define my login link:

user.login:
  title: 'Log in'
  weight: -10
  route_name: user.login
  menu_name: account


texts:
I have enabled the Pay pal module as a checkout option but I need to add a new option for the customer to request an invoice. I realize I need to modify some rules but it seems that the first item I need is a Payment method which the customer can choose that will fire off the Billy invoice. I have looked everywhere but cannot seem to find a suitable method. Should I use the Exmaple paymnet method and try to modify this?

Cheers
/bo


texts: Do Drupal websites have bad performance or are heavy?

texts:
I'm facing a lot of problems with my shared hosting company regarding the performance of my website.

My website is not complicated at all, just text pages, and also some pages using the Views module, I'm not using Panels, and I aggregate my css and js, and also I have 7 image styles (thumbnail,large etc...).

But even so my hosting company told me that I exceeded the memory limit and I have to optimize the website.

I have also another site in a different hosting company .... another problem appears in the database and this is the error message:

  PDOException: SQLSTATE[00000] [1129] Host '...' is blocked because of many connection errors;

I don't know if the problem is because of Drupal or something else.


texts: Define module parent item to contain other module items

texts:
I want to define section of items in administrative area, for my custom module operations.

I defined some items with hook_menu in /admin/config/development/
But i would like now to make a section, that will containt those menu items, so on click on that parent item i would be presented with those "contained" items.

It is like, when you have admin/, you click Configuration and you get to the screen with all the items contained ( admin/config/ ).

It is probably very simple, but somehow could not trample on it!
Thanks!


texts: A module to add a field for display as a column in the administration area

texts: I would like to display a column with the email address to the listing of users in my site's administration area. does anyone know of a module that does this?


texts: Add "n" fields when click on "Add another item"

texts:
When I click on "Add another item", It should create 10 new fields.
Is there a way I can do this?


texts: write data in another drupal website / rest

texts:
I need to implement the following setup:
- master site (drupal 7)
- child site (drupal 7)

User create/update nodes in the master site. Then the nodes should be copied to some child sites, depending on some selections. The records in the child site should be updated if they already exist. Also deleting should be possible. These sites are hosted at another hoster than the master website.

I was doing some research and found among other techniques the REST Services.
Did I understand right, that with the REST services I can implement what I want? Or are there better alternatives?

thanks for any help


texts:
I'm trying to update Drupal core to lasted version with composer update drupal/core --with-dependencies. I followed the instructions given on Update core via Composer, but Composer claims there is nothing to install or update. It also prints the following message.

  Package "drupal/core" listed for update is not installed. Ignoring.


texts: How do I let IPE add rows to the layout?

texts:
I have a site based on AdaptiveTheme with Panel nodes being edited using the In-Place-Editor, because my users want to dynamically arrange their content on their respective Panel nodes.

They especially want to be able to arbitrarily change amounts and orders of columns and rows (not their measures, though). Hence, they e.g. want to be able to do sth like this:

Row1
-- Col1 (50%): Content ABC, Col2 (50%): Content DEF
Row2
-- Col1 (100%): Content GHI
Row3
-- Col1 (33%): Content JKL, Col2 (33%): Content MNO, Col3 (33%): Content PQR
Row4
-- Col1 (100%): Content STU

Now they want to use the IPE's WYSIWYG functionality to reorganize the whole thing into e.g.:

Row1
-- Col1 (100%): Content DEF
Row2
-- Col1 (50%): Content JKL, Col2 (50%): Content MNO
Row3
-- Col1 (100%): Content GHI
Row4
-- Col1 (50%): Content ABC, Col2 (50%): Content PQR
Row5
-- Col1 (100%): Content STU

The problem now is that the responsive Panels layouts are extremely restricted just by their fix number of rows.

I could provide them with the possibilty of using a flexible layout (the layout builder), but

that's not supported by the responsive AdaptiveTheme Panels integration
it's not the true WYSIWYG feeling provided by the IPE
its whole workflow is not exactly user friendly (add column > add row > add region > add content)

What I have in mind would be some sort of extension of the IPE, providing the possibilty of adding/removing/moving rows to the layout - to be picked out of a predefined set (like 100, 50/50, 33/33/33).

Has anyone got an idea how to achieve this perhaps with already existing modules? I'm not stick to Panels if there's anything else which basically does what I need..

Anyway, if someone's got an idea how to extend Panels/IPE, like where to start/a basic concept, I'd love them to share that with me..

* EDIT *

I found a better summary of the problem description: what im looking for, is a visual WYSIWYG tool for dynamically changing both rows and columns.
The Panels IPE only lets you manage columns within a predefined structure of rows. And the layout builder doesn't correspond to the WYSIWYG concept.


texts:
I have a view that select some nodes.

In views_post_execute I remove some results that cannot be directly removed by the query.

To do so, I have something like:

foreach($view->result as $key => $record) {
    if(my_test == true) {unset($view->result[$key]);}
}

To have this working, I had to remove the pager, otherwise $view->result contained only the first group of results.

After that foreach, I have the correct $view->result and I would like to display the results using a pager.

I tried with:

$view->set_items_per_page('25');
$view->init_pager();

but it doesn't work.

Any idea?
thank you!


texts: Update fields to use a different FieldFormatter during an update hook

texts:
I have a drupal.org module that has changed its fieldformatter ID in a later version and I need the update hook to update all isntance of the content to use the new formatter, but cant seem to figure out how to do this.

e.g.

/**
 * Plugin implementation of the 'field_example_simple_text' formatter.
 *
 * @FieldFormatter(
 *   id = "example_field_formatter",
 *   module = "example",
 *   label = @Translation("example"),
 *   field_types = {
 *     "example_field_type"
 *   }
 * )
 */

has changed to

/**
 * Plugin implementation of the 'field_example_simple_text' formatter.
 *
 * @FieldFormatter(
 *   id = "new_example_field_formatter",
 *   module = "example",
 *   label = @Translation("example"),
 *   field_types = {
 *     "new_example_field_type"
 *   }
 * )
 */

I need to update the content/fields to be using the new formatter as it overwrites the previous one.


texts: Drupal Album/Photos modules error. Not show photos/image/uid

texts:
www.sitename.com/photos/image/697 --> go... But, not show image and other content and blocks...

Error messages:
1- Unable to generate the derived image located at public://styles/large/public/photos/image_1/6396455561366990133.jpg.

2- DrupalDefaultEntityController->load() array_flip() [function.array-flip]: Can only flip STRING and INTEGER values!.

3- format_date() /includes/common.inc dosyasının 2014 line) date_timezone_set() expects parameter 1 to be DateTime, boolean given.

Help me please...


texts:
Finally I get to ask my first drupal-related question here. I'm glad to be here ;)

I'm planning to create some goal-management functionality like this:

Goal 1: Write a nice little module

    Sub-goal 1.1: Get information

        Check google and stackexchange

    Sub-goal 1.1 achieved

    Sub-goal 1.2 Implement the module

        Do the coding

    Sub-goal 1.2 not yet achieved

Goal 1 not yet achieved

The idea here is that the user will be able to nest as many sub-goals as desired. The nested list above should be displayed on the website, and the user should be able to add additional (sub-) goals, or mark already created (sub-)goals as completed.

Is there already some module that provides this kind of functionality?

If not I will have to do the coding in good old php, but I have no idea how I can make a render-able array out of this kind of data. Creating nestable goals is easy in php (I could make them objects, for example), but making drupal display them right seems pretty hard (I guess I'll need to make a nested array and put it into theme_item_list()?). Does anyone know some good resources on that toppic?

Thanks in advance for any advice and/or useful links!


texts:
I have a shell script that executes drush sql-dump, compresses the result and then sends it to a backup server.

It works fine when run from the command line as root but it is failing silently and dispatching an empty file when run as part of a scheduled cron job.

This script has worked previously for me on another website as a cronjob and so I am somewhat confused what would be wrong now.

I work with Drupal 8.3.1 and Drush Version 8.1.11.

Any suggestions?


texts: How do I add rate widget to certain content type?

texts:
I have a certain content type I want users to be able to rate. I decided to go with the rate module, since I want to be able to change the value of each star.

My problem is I don't know how to add the certain rate widget to a content type. In widget settings there are no checkboxes in the "Node types" option. Screenshot below.


texts:
My Drupal 7 site is upgraded from Drupal 6. When I install the Domain Access (not installed with Drupal 6) module, I need to rebuild permissions.

I tried rebuilding them from the administrative pages, but it fails; I tried doing it with Drush, but it failed again.

drush php-eval 'node_access_rebuild();'

I can't find any information in watchdog and PHP logs.

Does anyone know why it happens, or how I can fix this?


texts: Default Style for token - webform_submission:values

texts:
I'm wondering if there is a way to theme the default style for the webform token [webform_submission:values].

The emails being sent with no space between the label and the value.
So they look like this:
Example LableExample Value

I just want to add a semicolon and a space after the label.
Is that possible without having to use a custom body for every webform?
Like this:
Name: [submission:values:name:nolabel]


texts: Template suggestions showing up in Twig Debug, but not pulling in files

texts:
I am using some preprocesses to add template suggestions for Views that are a child of a Paragraph type.

function riverside_theme_suggestions_views_view_alter(&$suggestions, &$vars) {
  if (isset($vars['view'])) {
    if (isset($vars['view']->child_of_paragraph)) {
      $suggestions[] = 'views-view--' . $vars['view']->child_of_paragraph;
    }

    if (isset($vars['view']->child_of_paragraph_field)) {
      $suggestions[] = 'views-view--' . $vars['view']->child_of_paragraph_field;
      $suggestions[] = 'views-view--' . $vars['view']->child_of_paragraph . '--' . $vars['view']->child_of_paragraph_field;
    }

    $suggestions[] = 'views-view--' . $vars['view']->id();
    $suggestions[] = 'views-view--' . $vars['view']->id() . '--' . $vars['view']->current_display;
  }
}

function riverside_preprocess_paragraph(&$vars) {
  foreach ($vars['content'] as $field => $field_content) {
    if (isset($field_content['#field_type']) && $field_content['#field_type'] == 'viewsreference') {
      $field_content['0']['contents']['#view']->child_of_paragraph = $vars['paragraph']->bundle();
      $field_content['0']['contents']['#view']->child_of_paragraph_field = str_replace('field_', '', $field);
    }
  }
}

I can then see in my console, that those suggestions are coming through as I would expect:

However, if you look in my file structure, I have files matching the names on the 'File Name Suggestions:', but they're not being pulled in.

If I create the file 'views-view--events.html.twig' or 'views-view--events--block-2', those will work as expected. Is there something else I'm missing? I'm wondering if there is a character limit on the template names? If so, is there somewhere to increase the character limit?


texts: How to active payment pane in Commerce Kickstart?

texts:
I am using Commerce Kickstart and I am trying to configure the checkout process.

But control is not going in payment module. Instead it's going in last step directly.

Can anybody help me find out what is wrong?


texts: Is there any compatibility issue with Amazon Aurora?

texts:
I'm exploring the possibility of using Aurora as a database backend for a large-ish Drupal 7 site because of the potential performance gains. Before I do that, though, I'd like to know if there are any outstanding issues with this kind of setup.
So far, the only resource I've found are this fixed Drupal.org issue and a number of rather old questions on this site. I'm still a bit concerned because the Aurora FAQ states:

Q: What does "MySQL-compatible" mean?
It means that most of the code, applications, drivers and tools you already use today with your MySQL databases can be used with Aurora with little or no change. The Amazon Aurora database engine is designed to be wire-compatible with MySQL 5.6 using the InnoDB storage engine. Certain MySQL features like the MyISAM storage engine are not available with Amazon Aurora.

(Emphasis mine)
It's the "most" that has me worried, specifically. Are there any pitfalls when using Drupal 7 with Aurora?


texts: How to check if an entity bundle has a field?

texts:
How can I check if a bundle has a field? I know I can use $entity->hasField() if I have a specific entity (as is defined in this post), but how can I get this info with just the entity_type and bundle info?

I'm assuming I could just create an entity of the type and bundle (and never save it), and check against that, but that seems gross.


texts:
I am using Drupal 7 commerce; I would like to set up the check out process to skip the payment portion and just send an email to the admin and the customer. How do I do that?

Thank you for you help.


texts: How to disable message in webform "Changes you made may not be saved."?

texts:
I have a message from the webform module "Changes you made may not be saved." which I do not want to see anymore. I get it on any form.

I try to disable this form. Therefore I added a js to the theme. In the hook_form_alter I add this js script to form attached

The JS file looks like this:

(function ($) {

    $(this).click(function() { window.onbeforeunload = null;
    });

}(jQuery));

Any idea why it is not working?


texts:
Is it worth to switch from MyIsam to InnoDB for a Drupal 7 site that has 2000 visits per day? Would it be worth if it has 10000 visits in the future?

How much faster can a site become with InnoDB if it has mostly reads and not writes? And how much if it has a lot of writes in the database?

I'm asking all this because some articles I have read are negative about InnoDB, and opinions are split.

So, does the generally spoken statement "InnoDB is better always" reflect reality?


texts: how to automatically retrieve selected value

texts:
is there a way to automatically retrieve selected value from dropdown or radio to form below? example in the image below, if i select radio button "randy", then the value "randy" automatically fill in the form Nama below

$header1 = array('Name'); // Prepare table header
$query = db_select("homo", "r"); // Select table
$query->fields("r", array("nama")); // Select fields
$result = $query->execute(); // Execute query
$rows = array();
while($data = $result->fetchObject()){ // Looping for filling the table rows
$rows[] = array( // Fill the table rows
  $data->nama,
  );
}
$form['table'] = array (
 '#type' => 'tableselect',
 '#header' => $header1,
 '#options' => $rows,
 '#multiple' => FALSE,
);
$form['f1'] = array(
 '#title' => t('Detail Anggota'),
 '#type' => 'fieldset',
);
$form['f1']['namaa'] = array(
 '#title' => t('Nama'),
 '#type' => 'textfield',
 '#required' => TRUE,
);


texts:
I am porting a module to Drupal 8. I have correctly setup the path in routing.yml but it always says access denied even I am logged in with user 1.

routing.yml

flood_control.flood_control_config_form:
  path: '/admin/config/flood-control'
  defaults:
    _form: '\Drupal\flood_control\Form\SettingsForm'
    _title: Flood Control
  requirement:
    _permission: 'administer site configuration'

.links.menu.yml

flood_control.flood_control_config_link:
  title: Configure Flood Control
  description: 'Configuration Form for flood control'
  parent: system.admin_config
  route_name: flood_control.flood_control_config_form

What am I missing wrong?


texts: How can I force a migration to not create stub nodes?

texts:
I have multiple migrations that rely on one another for entity reference fields.  When I created the queries these migrations I made sure I was only getting the nodes I want.  When an entity id is given and was not previously migrated (because the query did not return it as a result), it creates a stub node.  Then the number of unprocessed nodes for that node migration go into the negatives because more nodes of those types were imported than I had returned in the query.  Now I have to run update migrations because there is a newer version of the legacy database available.  The problem is that because the number of unprocessed went into the negatives, I cannot import any more, it just defaults to 0.

So how do I force entity reference fields to not import if it doesn't exist in the new site?


texts:
[current-date:custom: F, Y]

This displays December, 2016 when today's date is 1-31st December, 2016.

How can we start showing December, 2016 from last 5 days of November?


texts: Is there any away to randomize a display message in rules?

texts: I would like to disable drupal's standard message when a new node has been saved and then via Rules (or any other recommendations) provide a pool of random messages to be displayed to the end user when a node is then saved. They will essentially say the same thing, but just in a different way.


texts: Entity browser or Media Library for PDF uploads?

texts:
Client has a custom Content Type for downloadable PDF document detail pages, which contains an entity reference to the File media type.
They want Full and Teaser view modes to display a thumbnail image, user-friendly title (not PDF filename), and link to download.
I added the field_media_image to the media file bundle, and I used the media file's Name field for the "friendly name" of the file.
The image and name could be edited by clicking the pencil icon on the image field to edit the media file directly, but it is a better user experience for content editors to edit the media file attributes from the detail page node, along with the rest of the document details.
If I change the field widget for the entity reference in the detail page's form display from Media library to Entity browser these fields are easy to edit from the detail page node by clicking the Edit button.

This works well for editing existing content, but this widget is not configured correctly for uploading new PDF content:

There are some customizable widget settings in the form display configuration, but nothing that seems useful for my purposes.
The client is accustomed to uploading PDFs using the Media library widget, which looks like this:

Unfortunately, the Media library widget does not allow user to edit fields on the media file bundle. This widget does not offer any customizable settings in the form display configuration.
Is it possible to write a small Drupal 8 module to use the Media library widget on this field if it is empty (or NULL), but use the Entity browser widget on this field if a PDF has been uploaded?
That would be ideal. If it's not possible, perhaps someone can help me to configure the Entity browser widget to behave more like the Media library widget for PDF uploads.
EDIT:
I think I might be on the right track:
Home >> Administration >> Configuration >> Content authoring >> Entity Browsers
I'm trying to add a new PDF Entity Browser. But when I use that, I get the following error message:

What am I missing?


texts: Drupal + DKAN: override dkan_user_menu default view

texts: I'm using Drupal with DKAN and I don't know how to override the standard block__dkan_sitewide__dkan_sitewide_user_menu appearance. Can you help me?


texts:
Drupal 7.  I'm bringing in an RSS feed, and for the most part it's working.  It's not, however, bringing in the images with each entry.  I tried adding an  to the list of allowed tags in the admin screen, to no avail.  The lines come across as this:

<media:thumbnail url="http://www.bjtonline.com/uploads/tx_bjt/FINAL3_Flexjet_thumb_b.jpg"/>

Any ideas?


texts: Taxonomy images display in different view rows

texts:
I have a vocabulary that has an image field. To access this field in views, I added a relationship and then added the field in the fields section.

However, I have multiple terms and each term creates a new row... As this is highly undesirable, I would like to know how to fix it without making and embedding an additional view.


texts: How do I get an instance of AccountInterface in my Unit Test

texts:
I want to write a Unit test. But the class I want to test has a AccountInterface dependencie Injection.

When I try to get the AccountInterface Object I get:

  Drupal\Core\DependencyInjection\ContainerNotInitializedException:
  \Drupal::$container is not initialized yet. \Drupal::setContainer()
  must be called with a real container.

My test looks like this

<?php
namespace Drupal\mymodule\test;

use Drupal\mymodule\MyModuleQuery;
use Drupal\Tests\UnitTestCase;
use Drupal\user\Entity\User;

class MyModuleQueryTest extends UnitTestCase {

  protected $user;

  public function __construct() {
    $this->user = \Drupal::currentUser();
  }

  public function testResult() {
    $MyModuleQuery = new MyModuleQuery(1, $this->user);
    $countUser = $MyModuleQuery->mymodule_get_user();
    $countNode = $MyModuleQuery->mymodule_get_node();
    $bool = FALSE;
    if (!isset($countNode) && !isset($countUser)) {
      $bool = TRUE;
    }
    $this->assertTrue($bool);
  }
}


texts:
I have tried to set up an online example of a form using Drupal 7.

When I run it, the radio buttons do not show at all.
I also get the following errors:

  Notice: Undefined index: #title_display in form_pre_render_conditional_form_element() (line 3090 of /var/www/sandbox7/includes/form.inc).
  Notice: Undefined index: #title_display in form_pre_render_conditional_form_element() (line 3090 of /var/www/sandbox7/includes/form.inc).
  Notice: Undefined index: #id in drupal_process_states() (line 4549 of /var/www/sandbox7/includes/common.inc).
  Notice: Undefined index: #id in drupal_process_states() (line 4549 of /var/www/sandbox7/includes/common.inc).
  Notice: Undefined index: #id in drupal_process_states() (line 4549 of /var/www/sandbox7/includes/common.inc).


texts: How to style a webform like a spreadsheet?

texts:
I've been asked to develop a webform to look like a spreadsheet.
Unfortunately, the site is written in D6 and I've only really developed in D7.

Can anyone recommend a module / method to achieve this?


texts:
On Drupal 8, there is a page on /node/add. I want to customize this page by replacing the links with buttons, but I have not found a template to do that.

I have also enabled the debug mode, but there is no template suggestion.

How do I customize the page?

Ajouter du contenu

Annonce

Article

Discussion

Recette