texts: How to fined the fields biggest weight in form

texts:
I have made a content type in /admin/structure/types/add and then, created for this content type  extra fields from /admin/structure/types/manage/CONTENT TYPE_NAME/fields/add-field.
 After i created a module that will alter this content type by hook_form_BASE_FORM_ID_alter() in .MODULE file, and after i reset the default button that has content type that is SAVE button, and added new button:

    $form['register'] = array
  (
    '#type' => 'submit',
    '#value' => t('Register'),
    '#submit' => array('NAME_OF_A_FUNCTION'),
    '#weight' => '?',
  );

But when I do this the button is rendered first and after comes the content type fields. How to change the button row weight so that the button will always will show at the last plaice. In aver words how to get from all fields that has content type form and search for the biggest weight that has field and put this 'value + 1' in my new submit button '#weight' => '?'.
Dose anyone has solution for that...
Thanks in advance


texts: Apply different css files according to user selection

texts:
Use case: content managers would have permissions to change the color scheme of the site.

Solution: I would make a page from hook_menu and give option to select from different pre defined css files.

Is there a hook/function I can use to render css files accordingly as per selected by user.

like: user selects red option the red named css file should render on site and previous, default css should be overridden.

Thanks


texts: How to remove form elements before submitting the form?

texts:
All form items in Drupal must be created with Form API, otherwise form values in $form_state and in $_POST variables are empty after submitting the form.

But sometimes I need to have in form some other items, not created with Form API.  For example  I want to use external jquery plugin like Pickadate (similar like datepicker). This js plugin adds some HTML form elements into  object. And many other js plugins creates their own form elements on client side.

But when I use these plugins, form sent empty values after submitting. So before submitting the form, I need to remove these custom elements from form. I don't need values from these elements, they just help to pick the value selected by user.

Is there any workaround, some event, that can help me remove these elements right before submitting the form?


texts: Remove SKU label from product reference select list

texts: Is there a way to remove/hide the SKU value in the product reference widget (select list)? Because we don't want to show the SKU value to the editors.


texts: Drupal views show all taxonomy of specified vocabulary

texts:
I have a taxonomy vocabulary with the followings terms.

Benginner, Intermediate, Advanced.

I want to show a view that show these terms, but one term is associate to node, and I need stand out this term, but show all terms of this vocabulary, try to find the solution and nothing.


texts: I have created grid view page. When I go click on one specific grid its display content of that grid. Now I want to put one 'back' link in side the page of content, that back link displays main view page.


texts: Change content of views_field_view field using hook_views_pre_render

texts:
I am using the views_view_field module for embedding a view inside another view.

I want to concatenate some text with that field in hook_views_pre_render based on a condition.

But when I printed the $view->result array, that field is not there.

So How can I do this?


texts: Views - how to display a column showing who made the last update

texts: I'm updating the main content2 view, and I'd like to add another column to show which user made the last update. I'm using workbench moderation, in case that makes any difference.


texts: Drupal 6: Custom Menu not Expanding when Parent (generated by views) is selected

texts:
I have a Drupal 6.26 site with a custom menu like so:

-Category 1
--Page
--Page
-Category 2
--Page
--Page
...

All Category pages are genrated by a view (e.g. sitename.com/intranet/category)

All pages that are children of each category are nodes.

My primary problem is, when a category page is selected, the menu it's associated with doesn't expand. The site owner doesn't want the menus expanded by default.

A secondary problem is the menu won't expand when one of the child pages is selected unless it has the path /intranet/category/*, which is not always desired.

Hopefully a bit of code can solve this issue.


texts: Separate classes in include file not loading?

texts:
I have a peculiar problem... I'm trying to simplify my module by breaking up a ton of code into classes, and I have all of the classes in a separate include file that I'm registering in my .info file with the files[] directive.

However, when I go to use these classes in my module code, PHP dies.  It's like they're not being loaded.  I thought they were supposed to autoload at first use since I was using files[]?

module.info

name = Module
description = Module description
package = Module Package
core = 7.x

scripts[] = my_module.js
files[] = includes/my_module.class.inc


texts: How do I translate the weekday in a date?

texts:
I created a view from a JSON file; the dates in that file follow the 2020-07-28 20:00 format. I do a rewrite of the date to <span>{{ value_1|date("l d/m/Y") }}</span> and I get Tuesday 28/07/2020, but I want to get the weekday in Dutch.
Is there code for this?


texts: How do I show the site-wide contact form on a page in Drupal 7?

texts:
I have seen other posts about this, but none specifically for Drupal 7, and I can't get it to work. I am trying to get the default contact form to show up below the main content of a page, perhaps in a block.

Do you have any suggestions?


texts: Error on update from 2.3 to 2.8 and 2.7?

texts:
I'm using drupal commerce 2.3 and want to update to commerce 2.8.

I just copied the files to the new folder and get the error:

PHP Fatal error:  Uncaught Error: Class 'CommerceGuys\Addressing\AddressFormat\FieldOverride' not found in C:\www\crypto-excel\modules\contrib\commerce\modules\store\src\Entity\Store.php:272
Stack trace:
#0 C:\www\crypto-excel\core\lib\Drupal\Core\Entity\EntityFieldManager.php(206): Drupal\commerce_store\Entity\Store::baseFieldDefinitions(Object(Drupal\Core\Entity\ContentEntityType))
#1 C:\www\crypto-excel\core\lib\Drupal\Core\Entity\EntityFieldManager.php(171): Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions('commerce_store')
#2 C:\www\crypto-excel\core\lib\Drupal\Core\Entity\EntityManager.php(182): Drupal\Core\Entity\EntityFieldManager->getBaseFieldDefinitions('commerce_store')
#3 C:\www\crypto-excel\core\lib\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem.php(72): Drupal\Core\Entity\EntityManager->getBaseFieldDefinitions('commerce_store')
#4 C:\www\crypto-excel\core\lib\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem.php(118): Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenc in C:\www\crypto-excel\modules\contrib\commerce\modules\store\src\Entity\Store.php on line 272

Fatal error: Uncaught Error: Class 'CommerceGuys\Addressing\AddressFormat\FieldOverride' not found in C:\www\crypto-excel\modules\contrib\commerce\modules\store\src\Entity\Store.php:272
Stack trace:
#0 C:\www\crypto-excel\core\lib\Drupal\Core\Entity\EntityFieldManager.php(206): Drupal\commerce_store\Entity\Store::baseFieldDefinitions(Object(Drupal\Core\Entity\ContentEntityType))
#1 C:\www\crypto-excel\core\lib\Drupal\Core\Entity\EntityFieldManager.php(171): Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions('commerce_store')
#2 C:\www\crypto-excel\core\lib\Drupal\Core\Entity\EntityManager.php(182): Drupal\Core\Entity\EntityFieldManager->getBaseFieldDefinitions('commerce_store')
#3 C:\www\crypto-excel\core\lib\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem.php(72): Drupal\Core\Entity\EntityManager->getBaseFieldDefinitions('commerce_store')
#4 C:\www\crypto-excel\core\lib\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem.php(118): Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenc in C:\www\crypto-excel\modules\contrib\commerce\modules\store\src\Entity\Store.php on line 272
Drush command terminated abnormally due to an unrecoverable error.                                           [31;40m[1m[error][0m
Error: Uncaught Error: Class 'CommerceGuys\Addressing\AddressFormat\FieldOverride' not found in
C:\www\crypto-excel\modules\contrib\commerce\modules\store\src\Entity\Store.php:272
Stack trace:
#0 C:\www\crypto-excel\core\lib\Drupal\Core\Entity\EntityFieldManager.php(206):
Drupal\commerce_store\Entity\Store::baseFieldDefinitions(Object(Drupal\Core\Entity\ContentEntityType))
#1 C:\www\crypto-excel\core\lib\Drupal\Core\Entity\EntityFieldManager.php(171):
Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions('commerce_store')
#2 C:\www\crypto-excel\core\lib\Drupal\Core\Entity\EntityManager.php(182):
Drupal\Core\Entity\EntityFieldManager->getBaseFieldDefinitions('commerce_store')
#3 C:\www\crypto-excel\core\lib\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem.php(72):
Drupal\Core\Entity\EntityManager->getBaseFieldDefinitions('commerce_store')
#4 C:\www\crypto-excel\core\lib\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem.php(118):
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenc in
C:\www\crypto-excel\modules\contrib\commerce\modules\store\src\Entity\Store.php, line 272

But when I go to :
 C:\www\crypto-excel\modules\contrib\commerce\modules\store\src\Entity\Store.php

This file is just there.

I tried the same to goto commerce 2.7, but then same error applies.

Somebody any suggestion?


texts:
We're upgrading from Bootstrap 2 to 3. Now I need to replace CSS classes in the body fields of many nodes. This needs to be done in at least 5 sites. What is a good way to replace text in all nodes of a site?

Ideally I'd do it with something like drush replace old_str new_str. Found one thing from 2009 that didn't work at all and then I found drush sar, which didn't do the job either.


texts:
I am trying to render the theme logo as a block.

When I call path_to_theme() in page.tpl.php, it returns a true path, but when I call it in modulename.module, it returns "modules/system".


texts: get drupal base path in views rewrite result

texts:
i want to get Drupal base path in views rewrite result. but rewrite result doesn't support PHP code.

how can i add Drupal base path to replacement patterns in views rewrite result? i try installing some modules like entity api, token but it doesn't help.

i know there is http://drupal.org/project/views_php and i get base path with php code  but it has a dev release.


texts: Can i populate /fill a Views exposed filter with a Rules result

texts:
I have a group of nodes which are delivery nodes -prices-location-type etc.

I can sort them with a View and exposed filters - 'country' 'type' 'weight' to out put a price - really happy with it so far.

This works great - however I wish to populate the weight field with a value 'calculated weight' calculated in Rules - leaving only the 'country' and 'type' field open to the user.

I have looked for days now and think I have module overload!

Really would be grateful for any insight!

Thanks


texts: How can I remove the remains of the Mass Contact module not properly uninstalled?

texts:
I tried the Drupal 8 version of the Mass Contact module (8.x-1.0-beta2, released on June 2017).

As I was not fully satisfied, I decided to uninstall it.
Once done, I got errors when I tried editing a user account.

  The website encountered an unexpected error. Please try again later.
  Error: Call to undefined function mass_contact_opt_out_allowed_values_callback() in options_allowed_values() (line 89 of core/modules/options/options.module).

Digging a little bit, I found that the code to uninstall the module was not fully implemented: it leaves (at least) two configurations (field.field.user.user.mass_contact_opt_out and field.storage.user.mass_contact_opt_out) and a table in the database (d8_user__mass_contact_opt_out).

How can I get rid of that and have a clean uninstall?


texts:
I've got an existing cart and the inventory has separate products for different weights and they're separate entries. I want the varying weights to be combined and searched by attributes. What's the best way to do this with ubercart.

I'm using drupal 6 ubercart 2.


texts:
Background

I'm having a go at porting the JavaScript random views module from 6 to 7.

Problem

One of functions I think is intended to override the default pager value to load extra rows per page. (i.e. pager says load 8. This overrides it and says load 20).

To accomplish this it uses hook_views_pre_execute

function views_javascript_random_views_pre_execute(&$view) {
  .....

  // Here it saves the current settings of the pager for use later
  .....

  // Set new settings
  $view->set_items_per_page($sorts['js_random']['client_node_count']);
}

Unfortunately the set_items_per_page function doesn't seem to work. While it still sets:

$view->items_per_page

This then seems to have no effect on how many rows are then loaded in:

function views_javascript_random_preprocess (&$vars, $hook) {
   ....
   dpm($vars);
}

In $vars->rows, it still only loads the number of rows set by the pager (i.e. 8 not 20)

The API function definitely still works in 7. Could someone explain why it's not working correctly in this case?


texts: Pass URL alias info to default value of Webform field

texts:
I'm running the Storm (project management) module and for each task, the user needs to fill out a form regarding information about the task, including uploading images about certain information captured in the form. I'm trying to pass the url alias from the task page to the default value of a field I created in webform. My current URL's look like this: ?q=content/82245940-initial-services
. My problem (well, at least my first problem) is that I use the %get[q] but get node/5 as the default value. I don't understand and know enough about PHP programming yet, to know how to fix this so that I get 82245940-initial-services as the default value instead. Any help is much appreciated for the noobie. Thanks in advance!

EDIT By the way I have read these posts that while I have found helpful to understand the general concept, the details are over my head:

http://drupal.org/node/296453#webform-url-default

http://drupal.org/node/228622

So, I've tried, I just don't know enough yet!


texts: Conditional drupal_add_css and _js are adding code to every page

texts:
I am trying to add a CSS and JS files when a certain content type is being viewed (Drupal 6).  The problem is that the code is being added to every page.

I have tried this first, included in template.php:

function phptemplate_preprocess_node(&$vars, $hook) {
  $node = $vars['node'];
  if ($node->type == 'mytype') {
        drupal_add_css(path_to_theme() . "/css/mytpess.css");

        drupal_add_js(path_to_theme() . "/javascripts/jquery.masonry.min.js");
        drupal_add_js("$(document).ready(function(){
                          $('.node').masonry({
                            itemSelector: '.field-type-flexifield'
                          });
                        });",'inline');
  }
}

Then I moved it out of there and placed it in node-mytype.tpl.php:

drupal_add_css(path_to_theme() . "/css/mytpess.css");

drupal_add_js(path_to_theme() . "/javascripts/jquery.masonry.min.js");
drupal_add_js("$(document).ready(function(){
                  $('.node').masonry({
                    itemSelector: '.field-type-flexifield'
                  });
                });",'inline');

But either way it gets added to every page.  How can I resolve this?


texts: Which hook to use when a date is going to be saved into the database

texts:
I have a situation where I would like to know when a date (for an event) is going to be saved into the database so that I can modify the corresponding date in another module to match it. That is it in a nutshell. I need to do this because of the way this other module works. What is the best hook to use to accomplish this? Is it hook_node_update?

Thanks.


texts: how to set and unset javascript files for specifc path aliases in Drupal 7?

texts:
I am trying to set particular javascript files for a specific node page by getting the path alias. like this:

$path=drupal_get_path_alias();
if($path == 'about-us')
  drupal_add_js(drupal_get_path('theme', 'mytheme') . "/page-download.js");

which it doesnt work.
But when i add the particular javascript file to my .info file it works.
Also in other pages i will have to unset some of the javascript files if the above does not work but still unsetting javascripts does not work.

unset($vars['js']['all']['page-download.js']);


texts: Google shows node links instead of Custom URL

texts:
I have got a serious problem. My drupal website was going well. All Links crawled and indexed by Google were custom(natural), But some days ago my website went down because of bandwidth problem. After then, all my links in Google started appearing in /node/number form. e.g I had a link like http://www.myexamplee.com/all-good and now its appearing as http://www.myexamplee.com/node/234 . Can any body help? (I have done autopath tricks, robot.txt node exclusion and clean url like stuff but did not get any results in one week of time). Any expert any paid service any idea will be welcomed.
Many thanks to all readers and experts.


texts: How to disable edit their own profile per role?

texts: In Drupal 7, How to disable the edit profile permission per role? I found the "Tab Tamer" module, but this does not apply the feature per role.


texts: Getting Error : "You must declare "ids" as a unique array of fields in your source settings." while trying to migrate for paragraph in Drupal 8

texts:
I have created a yml configuration for migration from CSV source into drupal using composer. After running the "drush migrate:import mbe_book_paragharphs", I am getting the error as You must declare "ids" as a unique array of fields in your source settings.

I am using migrate_source_csv 8.x-3.1

id: mbe_book_paragharphs
migration_group: mbe_migrations
label: 'Import book paragraph'
source:
  plugin: csv
  path: '/var/www/html/drupal/author.csv'
  header_row_count: 1
  ids: [id]
process:
  field_mbe_title: Title
  field_mbe_author: Author
destination:
  plugin: 'entity_reference_revisions:paragraph'
  default_bundle: mbe_book
migration_dependencies: null

I need help on how to resolve this issue

In the YML configuration file, instead of "ids", i was using "keys" before but was getting the same error


texts: how to preserve interface language for a multilingual website?

texts:
I have a multilingual website with five different languages represented. I have to manage and maintain all the languages, but each time I switch to a particular translation for a piece of content the interface changes too.

I speak English - how do I maintain the interface language in English while managing the translated content?

This too is true for coworkers - the native Japanese speaker needs to be able to maintain the Japanese while he works.

The language preferences for each user is set to their native language - is there a way to have that enforce the interface language we are working in when administering the site?

thanks


texts: How to create a suggested content view using Flag and Flag Terms modules?

texts:
I am using Flag and Flag Terms modules to allow users tagging the content and taxonomy terms they like or dislike.

How do I create a view or a block that shows and sorts content based on tags assigned to, the way that prioritizes tags the current user subscribed for ?

Set up as in my previous question:  How do I set up user's "Favorite Tags" and "Ignored Tags" tag subscriptions?.


texts:
I am attempting to use PHP in Drupal rules to update the values in submitted webform submissions. I can access and view the data correctly. When I assign a new value to a field it will even show up correctly if I use print $submission->data[61][0]; But when I navigate to the submission results page the field hasn't been updated.

I have tried using the webform_submission_update() function to push my change but still no luck.

Question: How do I programmatically update an existing submitted webform submission in Drupal?

Code:

$submission = webform_menu_submission_load($nid, $sid);

// Two ways I've tried to update the data
$submission->data[61][0] = "testwork";
$submission->data[61]['value'][0] = 'Declined';

// If I do print $submission->data[61][0]; it will show the new value.

webform_submission_update($nid, $submission);


texts:
Is there a way to load a file by URI in Drupal 9 and/or Drupal 8?
In Drupal 7 it is possible using the following code.
$uri = 'public://file.xyz';

// Take a look at: file.inc::file_load_multiple
$files = file_load_multiple(array(), array('uri' => $uri));
$file = reset($files); // If empty, $file will be false, otherwise will contain the required file

Taken from here https://www.drupal.org/forum/support/module-development-and-code-questions/2012-06-06/load-a-file-by-uri#comment-6493610


texts: How to import feed content as child pages of a book?

texts: I am able to import nodes using CSV and feed import, but I want imported content to be child pages of particular book. How to do this?


texts: How can I automatically add taxonomy terms to a page's  keywords in the HTML?

texts: When Taxonomy is used for "free tagging", it basically becomes keywords for the content. From an SEO perspective, it would be great to automatically include these taxonomy terms in the  HTML tag for keywords, letting users help drive your SEO, or giving a non-technical site maintainer the ability to easily edit the keywords used on any given node. How can I do this in Drupal (both 6 and 7)


texts: Notices: Undefined index and trying to get property of non-object include()

texts:
I have a "page--front.tpl.php" and get these notices:

  Notice: Undefined index: nodes include() (line 47 in file /home/dunmicro/public_html/sites/all/themes/dunartis/page--front.tpl.php).

  Notice: Trying to get property of non-object include()(line 47 in file /home/dunmicro/public_html/sites/all/themes/dunartis/page--front.tpl.php).

Here is my code:

<?php if ($site_name): ?>
    <?php if ($title): ?>
      <div id="site-name"<?php if ($disable_site_name) { print ' class="hidden"'; } ?>>

          <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home">
                      <?php print $page['content']['system_main']['nodes']['63']['#node']->title; ?>

    <?php else: /* Use h1 when the content title is empty */ ?>
      <h1 id="site-name"<?php if ($disable_site_name) { print ' class="hidden"'; } ?>>
        <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home">
                    <?php print $page['content']['system_main']['nodes']['63']['#node']->title; ?>

    <?php endif; ?>
  <?php endif; ?>

How do I fix these notices?


texts:
I've done a database query which returns the results in the following array:

Array ( [0] => stdClass Object ( [field_latitude_value] => 25.2000000000 ) [1] => stdClass Object ( [field_latitude_value] => 51.9456801568 ) [2] => stdClass Object ( [field_latitude_value] => 51.9471747475 ) [3] => stdClass Object ( [field_latitude_value] => 51.9471218425 ) )

How do I process this information so I get just the values instead of the added keys? I.e a list of said values.

I'm currently using the following code, which gives me a recoverable fatal error:

<?php

$query = db_query('SELECT field_latitude_value FROM {field_data_field_latitude}')->fetchAll();

print_r($query);
foreach($query as $value){
    echo $value;
};?>


texts: How do I give access permission for specific node to anonymous User

texts:
I have removed "Access Content " Permission from Anonymous user. Now want to display specific node to the anonymous user.

As this is for only 1 or 2 nodes, It's not a good idea to use a contributed module like https://www.drupal.org/project/access_by_entity. I am looking for a solution as a custom code only

I have tried mymodule_node_access also but it's not working.


texts:
In my site there are lot of static content such as section headers and random content. I want to translate them.

Can I translate with them {% trans %}my content{% endtrans %} in twig?

If yes, where to insert the translations in the backend?


texts:
I have 3 node types:

category
subcategory
product

These are all linked using Entity Reference module. All pages have a path (using autopath). What I want to do is show a view depending on the path.

So if I go to categories/category-a/ I want to show all subcategories of that category
Same for the products. I want to show all products referenced based on the path.

I'm trying to make a view with path = categories/%

I set a "contextual-filter: content: nid" - "provide default value" - "raw value from url". But when I visit "categories/category-a/" I see the node with this path. The view isn't shown.

Any idea what's wrong here?


texts: Send e-mail when webform submission changes

texts:
Well, I want to send an e-mail when the web form is submitted, and when it is edited, so how can I do this?
The employee fills a form, and submit it, an email have to be sent to the boss, then, the boss approved or denied the form, and e mail is sent to the employee.


texts: simplenews subscription form on front page with frontpage module

texts: I want to place a Simplenews subscription form on my front page that I implemented using the Front Page module in 'full' mode. How do I do this?


texts: Why does my background image only sometimes show?

texts:
I have a background image set for #region-header-first on this page http://www.smith-howard.com/resources?type=article&sort_bef_combine=created%2BDESC

However, it only shows sometimes in Chrome (mostly not). If I clear all Drupal caches (and browser cache) it will show once, but on the first refresh and so on it doesn't show any more.

If i check web inspector in safari (where it always works), it definitely shows the background image in the CSS.

#region-header-first background:url(http://www.smith-howard.com/sites/default/files/resources-articles2_0.jpg);

But inspecting it in Chrome doesn't show that the background image is set in the CSS at all. This is just mind boggling.
Any help is greatly appreciated.


texts: How do I create content programatically?

texts:
In WordPress I can use wp_insert_post() to create content programatically.

Is there any similar function available for Drupal 7, that will allow me to insert posts (and pages) into the database programatically?


texts:
I am installing Drush on my Mac following the instructions I found on https://linode.com/docs/websites/cms/drush-drupal/.

Everything works perfect, but I got stuck at the end while creating the symbolic link. Please find the error below.

Mudasirs-iMac:/ mudasir$ sudo ln -s /usr/local/src/drush/drush /usr/bin/drush

ln: /usr/bin/drush: Operation not permitted


texts:
I need to show a breadcrumb on my client website but it is required to be in two languages I have tried several approaches and modules but all of it show the breadcrumb in one language only.

Please, If anyone have an idea about this I appreciate your help.

Besides, Could you please explain more about using default drupal breadcrumb what should I have been installed to use breadcrumb correctly? Do I need breadcrumb + another module ???

Regards,


texts:
I'm needing to change the 'Entity Selection' mode on an entity reference field for a content type from 'Simple' to 'Views: Filter by an entity reference view'.

However, the 'Views: Filter by an entity reference view' option does not appear. 'Simple' is the only option. I have tried creating new test fields to see if it's an issue with that particular field, however this issue persists across new fields as well.

Additionally, I've noticed that if I try to create a new view, the option to change the display type to 'Entity Reference' is also missing.

I've been unable to determine what is preventing these options from appearing, and I'm wondering if the issue might be with either the Entity Reference or Views modules themselves. I haven't been able to locate someone with a similar problem on Stack Overflow or the Drupal forums yet.

Any thoughts on what I might be overlooking that could be causing this?


texts:
Sorry if this an extremely newby question but I am a beginner and still trying to learn how to navigate through the site.  Anyway, I am trying to create a form uploader.  For example, I want someone to go to their profile page, hit upload, and then a form with 5 or so fields come up where they can fill things out and then upload it to the main content page.

Here is a use case that I am thinking of:  I have a picture that my little sister drew, and I want her to add a description, the title of her picture and date it.  When I hit upload there will be a upload image field and three text fields for the title, date and description.  Then I want it to display on the homepage.

Sorry if that was a really tedious description for a really simple function.  I appreciate all the help though!  Thanks in advance for all your time and help.

Pete


texts: Tips for Information Structure & Superfish Menu

texts: I am thinking of using the superfish menu module. The site will have three levels of navigation. Any tips for creating the nodes/pages so that the Menu structure works out properly? Or as long as I create all the level one pages and then use them as the parent menu for any child pages, will the menu be generated ok?


texts: Get path to theme assets in Twig template

texts:
I have a question about getting a path to an image in a Twig template. The image is not assigned to a field or something. Just a static image which is stored in "MYTHEME/image/icon/my-icon.png".

In Drupal 7 I get the path in my node.template with the following code:

<img src="<?php print base_path() . path_to_theme(); ?>/image/icons">/my-icon.png

How does it work with in Drupal 8? I tried to pass a variable in template_preprocess_node().

MYTHEME.theme:

$variables['images_path'] = \Drupal::theme()->getActiveTheme()->getPath() . '/image/';

Twig template:

It doesn't work. There is no PHP error, but the path is wrongly said to be http://localhost/node/themes/template/image/icons/my-icon.png.


texts: Same secondary menu bar on different pages and lead to different content

texts:
not sure if I can describe the situation clearly, here is the thing:

I am using D7. I have this site: there are three menu items in the main menu will lead to three product pages, their layout will be identical: start with a product image, then a secondary menu bar and the according content according to the secondary selected menu item. I intend to use a same custom node template for the three pages, and put different content into the fields I determined.

the secondary menu bar should be identical on all three pages, which may contains these menu items: Features, Technical Specs, Sales, Support.

When someone clicks on the main menu items, they will go to the product with the right image on the top and the url like mysite.com/PRODUCT_A. When someone then clicks the secondary menu items, the product image and the layout on the page remain the same, but the according content will show up in the content area. And the url will be mysite.com/PRODUCT_A#feature

A layout like this:

PRODUCT A | PRODUCT B | PRODUCT C

[PRODUCT B IMAGE]

features|technical specs|sales|support

[these are the features about PRODUCT B...]

Any I probably will use View for the content blocks, but I cannot get my head around how exactly I can make the whole thing dynamic enough for the administrator to add content comfortable. Also to get the right url dynamically.  Any thoughts please? Thanks a lot!


texts: How to resolve the jQuery error in the Search Autocomplete module?

texts:
I've just installed the Search Autocomplete module on my Drupal 7 site and try to get it to work. For this I also installed the jQuery update module and put it on jQuery 1.10. I didn't change any of the default settings of the search autocomplete module. When I start typing in my search field I get this jquery error:

  Uncaught TypeError: Cannot read property 'label' of null
  jquery.ui.autocomplete.min.js?v=1.10.2:4 Uncaught TypeError: Cannot
  read property 'label' of null

So I tried finding out what is wrong by setting a breakpoint in the autocomplete jquery file. What I found out is that that on line 474 of this file there is this check:

if ( items.length && items[0].label && items[0].value ) {   return items; }

But it says that items is [null]. So I went back to views. The automatic generated view made by the autocomplete module outputs this:

[
  {
    "link" : "http://site.local:8888/content/elke",
    "value" : "Elke",
    "fields" : {
      "view_node" : "view",
      "title" : "Elke"
    },
    "group" : {
      "group_id" : "",
      "group_name" : ""
    }
  },
  {
    "link" : "http://site.local:8888/content/peuterdans",
    "value" : "Peuterdans",
    "fields" : {
      "view_node" : "view",
      "title" : "Peuterdans"
    }
  },
  {
    "link" : "http://site.local:8888/content/sofie",
    "value" : "Sofie",
    "fields" : {
      "view_node" : "view",
      "title" : "Sofie"
    }
  }
]

So it's not null but is it the right output (following this http://api.jqueryui.com/autocomplete/ it is) for the jquery autocomplete? What am I doing wrong here?


texts: Change the default upload file location for a particular content type

texts:
I have a content type "Test" which have "upload file" field. Only for this "Test" content type i want to change the location where uploaded file is stored. I want to store anywhere in my drupal instance not just only in sites/all/default/files/subdirectory.

How can I achieve this.


texts: 500 (Service unavailable (with message)) on login or register

texts:
Effectively the same as this (Drupal 500 Internal server error on login page) but i am unable to bump or comment so resorting to adding my own question.

The site is running Drupal 7.54 php version 7 and uses LoginToboggan module with login.

I am receiving "500 (Service unavailable (with message))" on the user and register pages, this occurs against user/login and ?q=user/login equivalent. Otherwise the site operates normally. There are no PHP errors in the log or browser console so i have nothing to try and trace.

I have amended the .htaccess file to use Rewrite as suggested elsewhere (this was already enabled anyway as the site sits in a subdomain).

Clean URLs are enabled.

I have added error reporting to settings.php to try and pick up on errors i've otherwise missed, nada.

I have used phpMyAdmin to clear the sessions table as suggested on another old thread. This resulted in me being kicked out and unable to get back in.

I can now only access the site db via phpMyAdmin and the site files via ftp (unable to log in as admin as login throws the error)

I tried to run update.php (removing login requirement from settings) out of sheer desperation but this had no effect.

Again in desperation i removed the LoginToboggan module (via ftp, i know) to try and revert the login to core but this had no effect.

I thought the main domain was conflicting in some way so i removed it (it wasn't actually used for anything and had an independent db so i just uninstalled it. No effect.

I really am at a loss, i can't figure out the cause and so have no way to implement a fix..


texts: Shopping cart remove button is not removing the products on ubercart

texts: I am using Ubercart module and on my cart page "remove" button is not removing the products from the cart. It is displaying the message "Please check your quantity and try again".Please help!!


texts:
I created a view and am expecting the More link to appear but it isn't.

The Content: Body field formatter is set to Trimmed and the trim length is 100. Create more link is ticked, and I have entered "More" in the More link text text box.

Any advice would be greatly appreciated.


texts:
I am using hook_node_presave to add this validation and its working fine for most of the scenario.

But sometime, this validation is not working so duplicate node is generated.

I am using following code
Using node_presave

/**
 * Implementing hook_node_validate
 */
function sample_changes_node_presave($node) {
  if ($node->type == 'daily') {
    global $user;
    $userdata = user_load($user->uid);
    $cid = $userdata->field_profile_center['und'][0]['target_id'];
    $dated = date("Y-m-d", strtotime($node->field_daily_report_date["und"][0]["value"]));
    if (empty($node->nid) && (daily_report_exist($dated, $cid) == TRUE)) {
      drupal_set_message(t('Daily Report is already Created for this date.'), 'error');
      drupal_goto('node/add/daily-report');
    }
  }
}

Where daily_report_exist() is Boolean function to return TRUE/FALSE.

Using form_alter

/**
 * Implaments hook_form_alter.
 */
function sample_changes_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'daily_node_form') {
array_unshift($form['#validate'], 'daily_report_exist_validation');
}
}

function daily_report_exist_validation($form, &$form_state) {
   if (is_duplicate($form, $form_state)) {
      form_set_error('title', 'Daily Report is already Created for this date.');
    }
}

Where is_duplicate is Boolean function to return TRUE/FALSE same as daily_report_exist().
One thing i also notice, whenever validation failed and duplicate node is created, the node-created time difference is only 1 or 2 sec.

May be someone help me to fix this.


texts: How do I customize a table display with views

texts:
I want to setup a View that will display all Title's within the company in a certain way.

History (not sure if necessary, but I imagine it can't hurt): I had a lot of duplicate Title's, because I grab the title from the user node, no distinct features seemed to help. I found a way of using hook__query_alter(QueryAlterableInterface $query) to make sure the titles were in order and they were not duplicated. If I display the View, as is, as a table, it looks like a normal list:

But I want the table to look like the following:

Can I do this without code? No idea how, If I can't, which is fine, my real question is below:

I can grab the view in template_views_pre_render(&$view), I noticed I can also snag some of it in the hook_preprocess_views_view(&$vars), and I can grab pieces in the template (...tpl.php) files like views-view-field-w/e.tpl.php and views-view--w/e.tpl.php. But as it stands I really don't know where to begin my algorithm and sifting through. In order to do this I imagine I build 3 arrays, array A, B, and C (eventually also D, E, F, etc.) and just spit them out in one of the template files to build rows for each alphabetical column in a table structure, but where do I build these arrays up, I hear preprocess hook is where it might be done? If so, how do I hand them over to the template files (stuff them back into the views array?). If I shouldn't be doing it that way, should I just build up my arrays and spit them out in the table format all in the template files?


texts: Can't Get Batch Processes To Complete/Start Anymore - No Progress Bar

texts:
I have tried many different actions that use the /batch?op=start&id operation in Drupal. For some reason, nothing is working anymore. Can't download module updates, delete users, run VBO operations or anything of the sort.

I have searched what seems like everywhere and some people have experienced this, but haven't posted their solutions.

Can someone please help me solve this. All of these functions are required on this site regularly and now it's not working.

Thank you!

Billy


texts: Features conflicts when field bases are used by other feature

texts:
I recently downloaded the Features module and was so glad over how smoothly I now can export functionality from dev to prod. But now when I'm trying to create a second feature I'm getting conflicts because I already used a lot of the same field bases in my first feature.

What can I do to resolve this? Are you not suppose to be able to use the same fields in different features? It doesn't seem right that I should have to define as many fields for "body text" that I have features, or image fields for that matter. Those fields could and should be shared right?

What are my options here?


texts:
Does anyone know how to / know if Drupal 7 Views 3 is capable of using the inverse of a contextual filter to display results?

Basically I want to display a result not involving the logged in user ID. I can get the view to display only the data associated with the user ID using the contextual filter. I just want the opposite of it. I have tried using the current user filter and checking no for the particular relationship but was unsuccessful. If anyone can point me in the right direction that would be greatly appreciated.

Unfortunately no.. This helped but this does not establish the relationship I need.
The data is in two tables. I basically need query like this:

(the first select grabbing all the nid's available)

SELECT DISTINCT n.nid
 FROM node n
  WHERE n.status = '1'
    AND n.type = 'job'
    AND n.nid not in

(the second select grabbing all the nid's that are associated to a specific uid)

(SELECT DISTINCT n2.nid
  FROM node n2
  LEFT JOIN applicationsTable ON n2.nid = applicationsTable.nid
   WHERE n2.status = '1'
    AND n2.type = 'job'
    AND n.nid= n2.nid
    AND applicationsTable.uid ='999');

Oddly enough my query doesn't work as a straight db call so feel free to correct me on that too :P


texts: Increasing maximum number of Apache solr facet blocks

texts:
Installation Details

I have installed apachesolr module in Drupal 6.
The version of Apache Solr is 1.3.
Number of facet blocks enabled via admin/settings/apachesolr/enabled-filters as well as from admin/build/block/list are 30.

Currently I am facing following issues

Whenever I select options from more than 4 facets, apache solr doesn't return any result and it throws a message "The Apache Solr search engine is not available. Please contact your site administrator."
If I add more facet block via
admin/settings/apachesolr/enabled-filters as well as from admin/build/block/list, apache solr stop work altogether and throws the message "The Apache Solr search engine is not available. Please contact your site administrator." .

I guess this is an issue with Apache Solr Settings i.e. increasing the maximum limit of facet blocks. But I don't know what those settings are.


texts: Creating custom node aliases inside a simpletest

texts:
I am attempting to write simpletests to replicate the steps to reproduce on this d.o issue.

I need to create a test node with a custom alias, as if I had unchecked the "Generate automatic URL alias" checkbox and supplied my own value.

Currently, attempting to insert it with

$edit = array(
  'title' => $this->randomName(),
  'path' => array(
    'source' => 'node/1',
    'alias' => 'qwerty',
  ),
);

fails, and generates errors, as does

 $edit = array(
    'title' => 'asdf',
    'path[alias]' => 'qwerty',
  );

So, I tried:

$path = array('source' => 'node/1', 'alias' => 'qwerty');
path_save($path);

The above successfully creates an alias, but when I inspect $node->path[
alias'] it shows me something other than qwerty.

drupal_lookup_path('alias', "node/".$node->nid) also returns only the Pathauto-generated alias, and not any alias that was created manually, even in the node edit form.

Additionally, if I create a new alias from the same source, my original alias is not replaced, as it would be if I had manually entered a new alias into the field on the node edit form.

As I am attempting to exactly duplicate the steps to reproduce in the linked d.o issue, it matters how the alias gets created. Is there any way to more exactly replicate the manual creation of an alias on the node edit form, inside a test?


texts: Why can't I debug twig templates with intellij idea?

texts:
I can't get intellij idea to break on twig files. It is breaking on theme and module files fine. This means that xdebug must be setup correctly. I don't believe that it is caching as I've deleted the cache files

drush ev '\Drupal\Core\PhpStorage\PhpStorageFactory::get("twig")->deleteAll();'


texts: Forms get glitchy with too many nested paragraphs

texts:
We have built a complicated structure for building pages out of paragraph components, but are now quickly running into performance limitations.

It seems that the node form is monolithic, and is built, submitted and cached entirely for each operation (eg. expanding, adding, deleting or removing paragraph items). It barely takes a few dozen items before the serialized form array hits limits on mysql query size or PHP's memory limit, or other silent failures that cause data to be lost in unpredictable ways.

Is there a solution that would allow editing a single paragraph in its own form (eg. a modal) rather than the whole node? I would really rather not refactor the whole content structure to use entity-referenced nodes instead of paragraphs...


texts: connect to mysql with unix socket instead of tcp

texts:
I'm not looking for the "use 127.0.0.1" solution.
I want to run the site on my local development environment and use the unix socket to connect to the database. In my settings file I've set the host to 'host' => 'localhost', and I've tried 'unix_socket' => '/tmp/mysql.socket', as well, but both result in a PDOException: SQLSTATE[HY000] [2002] error in the apache logs.

When I connect directly to mysql through the command line I connect through the unix socket, but when I run it through Drupal it only connects through the TCP connection. I am under the impression Drupal will connect through the socket if the localhost host name is used, but this doesn't appear to be the case here.

Perhaps there's some other local configuration I'm missing.


texts: Is it possible to show 403/404 messages on the front page?

texts: Is it possible to have - instead of a dedicated 403/404 page - just a custom div inserted into the front page? 'Cause when I think of what I'd like to show up at 403404, I want everything that the front page has. So, whatever the front page looks like over time, I would just want it to adopt a 403/404 message div.


texts: Create components of webform including an email component by default when a node is created

texts: I want to create webform components by default  when node is created, all component labels/options of dropdown components/email id for email component are derived from the $node variable on save. is there any hooks or api's I can use?


texts: How do I show a list of users and display only partial email addresses?

texts:
I have created a list of users with views and I can add the user email field. However, I don't want to show the full email address. Instead, I would like to show the first few letters followed by ****@domain.com. (e.g. patr***@gmail.com or kell******@yahoo.com)

The purpose is to help users remember what email address they used when creating an account without revealing the full address.


texts:
I was wondering how to specify a specific template for rendering a node when it's referenced from another content type.For example I have a content-type (product) and I use the node--product.tpl.php template to render nodes of this type. Then I have a content-type named container that have a node reference field that may related a number of product nodes.I would like to use a different template when rendering a product when the product is referenced from the container content-type.
I just installed the theme developer module and check suggested templates, I then created a new template named node-reference--product.tpl.php in the same folder as node--product.tpl.php but this file is only used if node--product.tpl.php is removed.
I guess one approach would be to use some kind of theme_preprocess hook and load a node based on the arg(1) value and then check if the type is container and if it is add a template suggestion in the $variables parameter.


texts: How to show more than two fields in a Openlayers popup on a views_geojson layer?

texts: I have finally gotten my OpenLayers working, and I'm trying to show 7 fields about my points in a popup. By default, Views_geojsononly allows you to define a title and description fields for tooltips. I am assuming that this applies to the popups as well. Only being able to show two fields kind of limits the utility of the feature.  So, I'm wondering how I can show more of my fields in the popups? I'm using the Dev version of OpenLayers 7.x-3 and all the stable dependecies.


texts: Delete all nodes from database except from user1 and admin

texts:
I have got thousands of junk entries in my Drupal 6 website. Is there a way I can Delete all nodes from database accept from user1 and admin.

I also want to delete all users accept user1 and admin.


texts: Drupal Views - how to show a sporting club record holders all at once?

texts:
I have a database of football games like this:

date, opponent, venue, our score, their score etc

Id like to have a view that extracts things like

highest winning margin
highest score
most goals etc

and displays them all at the same time

The only way I can think of doing this is to have a view with lots of attachments- one for each statistic.  Is there a better way? (I have to maintain this myself so no php)


texts:
I have a site divided by in multiple section which are actually some taxonomy views (taxonomy/term/term_ID).

It works like this:

I have some specific blocks for each section.
Content can be found in multiple sections

The problem is that (because the node is part of multiple section) I don't know how to display the same blocks on the node page as the ones in the section the user just left.

Any ideas? Thanks


texts: Should a site be in maintenance mode when running the Drush Up command?

texts:
I'm not asking if I can update my website with Drush. I'm not asking if Drush can make it in maintenance mode.

My question is ... if I'm using the command drush up to update my Drupal core or a module is the best practice to put my website on maintenance mode or does not matter?

In the past, I update all my modules without putting my website in maintenance mode, and so far I have not any problems, but I'm looking for the best practice.

BTW, I already test my Drupal core update in a Dev environment, and everything is working fine.


texts: How to create a child page that has the same content type as parent page?

texts:
I enabled the Book module on drupal 7 and created 2 new content types. Let said I created a new "content type A" and "content type B", and keep the book module content type as "Book page". The issue I have is that whenever I adding a child page on a "Content type A" or the "Content type B" page, these child pages are "Book page" content type. How to keep these child page the same content type as parent page?

PS: I see there is a "Books" setting under "content > books" tab. But it only allow me to select one content type as child page.


texts:
I'm working with a drupal 7.50 installation on a local host.

My problem is that the basic content types are missing from my site. My custom content type is still visible and usable.

So far, I have checked under all menus to see if they've moved or been disabled, but I don't even see them. I've also tried clearing my cache, which didn't fix it.

Some of the modules I have enabled are drupal commerce, display suite, panels, and search api.

Any help would be much appreciated.


texts: What is causing /user/*/taxonomy/term/* to redirect to /taxonomy/term/*?

texts:
I got a view with contextual filters set up as the following:

Global: Null (Fixed value "user")
Content: Author uid (User ID from URL)
Global: Null (Fixed value "taxonomy")
Global: Null (Fixed value "term")
Content: Has taxonomy term ID (Taxonomy term ID from URL)

When I go to mysite.com/user/*/taxonomy/term/* I'm being redirected to mysite.com/taxonomy/term/*.

How can I prevent this?

I also got Pathauto to change the URLs to [user:name] for user/* and tags/[term:name]for taxonomy/term/*.

Edit: If I disable the URL alias for the taxonomy terms it still redirects to mysite.com/taxonomy/term/*.


texts:
I'm pretty new to Drupal but have take my company's half-baked site from the server and gotten a working instance of it in my local wamp stack working.  The only problem is that it seems on every page there is a section of code being inserted:

<?php
if ( isset($entity->field_job_id['und'][0]['safe_value'] )) {
   $job_id = $entity->field_job_id['und'][0]['safe_value'] ;
   $application_link_form = '
<form action="/careers/application" method="POST">
    <input type="hidden" name="job_id" value="' . $job_id . '" />
    <input type="submit" value="Apply online" class="job-application-link" />
</form>';
   print $application_link_form;
}
 ?>

This is showing a section of this code plus an "Apply Online" button at the top of each section of content.  It doesn't seem to matter what the content type of the content and the site which I imported all the files and db from has no such code - not even when I view source is there anything even commented out.  Hopefully this code gives you some context as to where this is ocurring - it comes immediately following this series of divs:

In any case, I cannot figure out where to find this code in order to get rid of it.  I'm not seeing any modules relating to this, etc.  And I just am baffled as to why it would start showing up after importing from a site that doesn't display this.  If anyone can think of any possibilities, please let me know!


texts: Page scroll issue when using dropdown menu

texts:
I am using a view in this page, and using sexy exposed module for filter criteria.
The page shows the horizontal scrollbar. How can I get rid of it?


texts: FieldCondition in an EntityQuery for media is causing a website error

texts:
This entityQuery in a theme preprocess function in Drupal 8 is working great:

$query = \Drupal::entityQuery('media')
    ->condition('status', 1)
$result = $query->execute();

But as soon as I add this fieldCondition for a boolean field, I get a website error:

$query = \Drupal::entityQuery('media')
    ->condition('status', 1)
    ->fieldCondition('field_flagged', 'value', '1', '=');
$result = $query->execute();

What is wrong in the above code?


texts:
I used the combination of Views + Views Slideshow + Views Slideshow: Galleria. And got the slider as I need which was given in the http://galleria.io/themes/classic/ . But I also need to show the title field below respective thumbnail image and the second thing is, onclicking the thumbnail image should show the title on the larger image too.

I have added both the Image and Title field but the galleria shows only the images not the Title.What steps I have to take for these result? Could anyone help me in this?

Thanks in Advance


texts:
I'm using Entityreference Prepopulate module. Is there way to pre-populate the field more than once?

Example:

example.com/add/node/custom&field_venue=92,92,92,183

I want the field venue to prepopulate 3 times. I can only do this if I type in the referenced node on the field, but I want it to prepopulate from the URL.


texts:
I am editing a site someone else built for my small nonprofit organization, and as you will see, I know very little about working with drupal (or anything beyond basic HTML, really.) I apologize in advance for that and will be so appreciative if anyone can help me.

I am trying to fix a problem. I am trying to add a listed page to a block, and the block is now not showing up on any pages it was previously associated with. When I went into a different block and tried to add a page, that block also stopped showing up. (You can see an example here: http://africaid.com/upcomingevents -- the left hand side block has disappeared.)

I am wondering if the problem is related to two warning messages. The first, on the "Administer" home page, says "One or more problems were detected with your Drupal installation. Check the status report for more information."

When I go to list content, I get the following message:

strict warning: Non-static method view::load() should not be called statically in /home/africaid/public_html/sites/all/modules/views/views.module on line 843.
strict warning: Declaration of views_plugin_display::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home/africaid/public_html/sites/all/modules/views/plugins/views_plugin_display.inc on line 1877.
strict warning: Declaration of views_plugin_display_page::options_submit() should be compatible with views_plugin_display::options_submit(&$form, &$form_state) in /home/africaid/public_html/sites/all/modules/views/plugins/views_plugin_display_page.inc on line 481.
strict warning: Declaration of views_handler_field_broken::ui_name() should be compatible with views_handler::ui_name($short = false) in /home/africaid/public_html/sites/all/modules/views/handlers/views_handler_field.inc on line 641.
strict warning: Declaration of views_handler_field_user::init() should be compatible with views_handler_field::init(&$view, $options) in /home/africaid/public_html/sites/all/modules/views/modules/user/views_handler_field_user.inc on line 48.
strict warning: Declaration of views_handler_sort_broken::ui_name() should be compatible with views_handler::ui_name($short = false) in /home/africaid/public_html/sites/all/modules/views/handlers/views_handler_sort.inc on line 82.
strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home/africaid/public_html/sites/all/modules/views/handlers/views_handler_filter.inc on line 585.
strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /home/africaid/public_html/sites/all/modules/views/handlers/views_handler_filter.inc on line 585.
strict warning: Declaration of views_handler_filter_broken::ui_name() should be compatible with views_handler::ui_name($short = false) in /home/africaid/public_html/sites/all/modules/views/handlers/views_handler_filter.inc on line 609.
strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /home/africaid/public_html/sites/all/modules/views/handlers/views_handler_filter_boolean_operator.inc on line 128.
strict warning: Declaration of views_bulk_operations_plugin_style::options() should be compatible with views_object::options() in /home/africaid/public_html/sites/all/modules/views_bulk_operations/views_bulk_operations_plugin_style.inc on line 280.

If anybody can help me with this, I will be grateful for eternity.

Thank you,
Ashley


texts: Access / Alter user registration form submit button in $form variable

texts:
In drupal 8, I have created a custom module to alter the user login and register forms in 2 class that extends UserLoginForm and RegisterForm respectively.

Whereas for the login form I can add some link in the $form['action'] array or add a class to the submit button:

 $form['actions']['submit']['#attributes'] = [
    'class' => ['btn', 'btn-primary'],
 ];

a contrario, there is no action array in user register $form variable(!)

So how can I access in my class the submit button, and more generally, the action array?


texts: How do I create a full project from a sandbox project?

texts: We have created a module for Drupal 8 on drupal.org, but it is a sandbox project. How do I make it a full project?


texts: Can we upgrade a site directly to latest version (without an extra fresh site)?

texts:
As far as I understand, the only way to upgrade Drupal (core-only) sites today is with having two sites: One is the Drupal 7 site with its own folder, and another which is a fresh Drupal 8 site in another folder; We then enable the core-based Drupal 8 migration modules in the fresh Drupal 8 site and with them Migrate-upgrade the Drupal 7 site into that fresh site.

Is there a way, maybe with Drush or with Drupal console, to actually Upgrade the existing Drupal 7 (core, or core&Ctools&Views) site directly as it is, without actually opening a fresh Drupal 8 site, besides it?

In other words, can we use the Console or Drush to update an existing Drupal 7 site directly, without any kind of migration?


texts: Button to selectively include content in an RSS feed

texts:
When creating or editing some content types I want to be able to have the option to add the content to an RSS feed thats generated by Views.

Is this achievable?


texts: How to alter the owner/authored by field to the current user when using quick_node_clone

texts:
Using Drupal 8 with quick_node_clone module.

When a node is cloned I need to change the 'owner' or 'authored by' value to the person who is cloning the node.

There is an opportunity of manually changing this but I need to automate this.
I am have been trying the hook_form_alter with some alternatives, see the commented out section, without success.

function quick_node_clone_form_alter(&$form, FormStateInterface $form_state, $form_id) {

 print_r($form_id);

 if ($form_id == 'quick_node_clone') {
  // change author
  //$form['author']['name']['#value'] = $user->uid;
  //$form->setOwnerId($current_user);
  //$form->uid = $user->uid;

  print_r($form['field_author']['nid']['nid']['#value']);
  global $user;
  $form['field_author']['nid']['nid']['#value'] == $user->uid;
 }
}

Any direction would be appreciated.


texts:
In drupal 8, I am writing a custom module and in one of the function in controller -I am fetching data from an external API, then displaying it in table format using -
 foreach($rec as $data) {
    ksm($data);
    $rows[] = [// mydata
]};

return [
    '#type' => 'table',
    '#header' => $header,
    '#rows' => $rows,

  ];

This is working correctly.
But I want table cells to be editable and when user edits the data, a listener gets invoked (or provide an update button for the user).
Now this listener would  do some stuff  with updated data(make external API call).
My doubt is how can we do this with tables? Is there any way to make some columns of table editable and register a listener in Drupal.
Would I need to create a node for each row of this table data?
If a node is required, then how to do ?
I am new to Drupal 8, just started a month ago, kindly help.
Thanks in advance.


texts:
Is there any way to prevent deleting a taxonomy term if it used in any node ?

I have a Taxonomy that is used in Field Collection in my Content Type , I want to warn/prevent deletion of any Term in that Taxonomy if it is used in any node.

I checked taxonomy_term_confirm_delete it is where the confirmation message is formed,
I read from some posts about using

db_query("SELECT COUNT(nid) FROM {taxonomy_index} WHERE tid = :aid", array(':aid' => $tid) )->fetchField()

to get the number of nodes a term is used in but this is not working in my case -maybe because the taxonomy is in field collection ?


texts:
For changing a theme name, can I use Grep to find-replace the name in the database and codebase?
I did this once before, without visible problems on a test site.
However, I need to be sure that there are no hidden surprises for production sites.

The idea is to

download the database and codebase
use Grep to find and replace all instances of the theme name (if the themename is not a very general string which is likely to appear elsewhere)
replace database and codebase.

Any suggestions or experiences?


texts: Can't get drush to work after moving to Acquia Dev Desktop

texts:
I installed Acquia Dev Desktop. Most things work but drush does not. I get an error:
Drush was not able to start (bootstrap) the Drupal database.

Because I had previously installed php and mysql on my local, I removed those old versions and adjusted my ~/.bash_profile to ensure I was loading the Acquia Dev Desktop version of php, mysql, and drush. To test, I run "which php", "which mysql", and "which drush" all of which returned the Acquia Dev Desktop version.

To test mysql, from my drupal site directory I entered the mysql cli with "mysql". I ran "show databases" and confirmed the Acquia Dev Desktop Database is in this Mysql server.

To test the php, from my drupal site directory I ran "php -r 'phpinfo();'". I confirmed the PHP version/config loaded is the Acquia Dev Desktop version.

I see in drush looks for aliases in ~/.acquia/DevDesktop/Drush/Aliases/aliases.drushrc.php
I inspected that file and see the alias configured as loc.mysite.dev. I tried my drush commands using that alias. "drush @loc.mysite.dev status". This made no difference.

My drupal install is setup like a multisite. Maybe that is an issue though I always use multisite and have no issue with this same site and drush in a vagrant box (not using Acquia Dev Desktop). I am running my drush commands from my site directory (sites/mysite.org) which is where my settings file is (sites/mysite.org/settings.php).

Here are some drush debug outputs
This is the issue after installing Acquia Dev Desktop https://gist.github.com/maestrojed/78ff27cfae1f65821ce8
This is the issue after installing Acquia Dev Desktop AND my attempts to get drush to use the correct Acquia Dev Desktop versions of Drush and PHP. https://gist.github.com/maestrojed/45c1635f5d1d88d4bd9e

I have to use Acquia Dev Desktop and I don't think I can live without drush. I am happy to provide any other info to help debug. Any tips are greatly appreciated! Thanks.
- See more at: https://forums.acquia.com/acquia-products-and-services/dev-desktop/cant-get-drush-work#sthash.bZJBgcc0.dpuf


texts:
I have a content type "event" which has an image field.
I tried to deleted the nodes, but I got the repeated errors when deleted the nodes.

    Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of D:\xampp\htdocs\mysite\includes\entity.inc).

I did not use any hook to delete nodes. I just deleted the nodes from the page "admin/content" by selecting "Delete selected nodes" in the UPDATE OPTIONS.

I checked the node related tables including field tables and I found that they were deleted as expected. When I tried to query the file tables, I found that some records were not deleted and the files in the file directory were not deleted too.

BEFORE DELETE

mysql> select * from file_usage where id = 41 order by fid;
+--+--+--+--+--+--+--+--+--+--+--+--+--++
| fid | module      | type | id | count |
+--+--+--+--+--+--+--+--+--+--+--+--+--++
| 30  | file        | node | 41 | 1     |
| 31  | file        | node | 41 | 1     |
| 32  | file        | node | 41 | 1     |
| 172 | file        | node | 41 | 1     |
+--+--+--+--+--+--+--+--+--+--+--+--+--++

mysql> select fid, filename, uri from file_managed where fid in (30,31,32,172);
+-----+------------------------------------+-----------------------------------------------+
| fid    | filename                        | uri                                           |
+-----+------------------------------------+-----------------------------------------------+
|    30  | Festival.jpg                    | public://Festival_0.jpg                       |
|    31  | Festival.jpg                    | public://Festival_1.jpg                       |
|    32  | Festival.jpg                    | public://Festival_2.jpg                       |
|    172 | Festival_465x350.jpg            | public://Festival_465x350_0.jpg               |
+-----+------------------------------------+-----------------------------------------------+

AFTER DELETE

mysql> select count(*) from node where type = 'event';
+----------+
| count(*) |
+----------+
| 0        |
+----------+

mysql> select * from file_usage where id = 41 order by fid;
+--+--+--+--+--+
| fid | module | type | id | count |
+--+--+--+--+--+
| 30 | file | node | 41 | 1 |
| 31 | file | node | 41 | 1 |
| 32 | file | node | 41 | 1 |
+--+--+--+--+--+

mysql> select fid, filename, uri from file_managed where fid in (30,31,32);
+-----+---------------------+-------------------------------+
| fid    | filename         | uri                           |
+-----+---------------------+-------------------------------+
|    30  | Festival.jpg     | public://Festival_0.jpg       |
|    31  | Festival.jpg     | public://Festival_1.jpg       |
|    32  | Festival.jpg     | public://Festival_2.jpg       |
+-----+------------------------------------+----------------+

They became orphan. What could that be why they are not deleted as expected?
Is there any fix for this?
My Drupal version is 7.15.


texts: Views joining/relating a custom table entity to users through a field?

texts:
Using Drupal 7 and Views 3 - I have created a custom entity and can view it fine through Views using EntityDefaultViewsController. The Table is a view shared to the drupal database and is constructed like:

Table A
------------
id_key
data

I have a drupal user field - field_tableA_data that contains the same data type/items in the Table A data field (they are not linked in any way - two separate systems load this data - in TableA the data is generated by another system and the User field is loaded by the LDAP module)

I want to make it so that I can make a "View" such that when viewing Table A Items I can also make a relationship to the User entities such that:
Table A > field_tableA_data > User

Is this possible in code and if so how?

Here is some code I have tried and to no avail:

class TableAEntityViewsController extends EntityDefaultViewsController {

  /**
   * Edit or add extra fields to views_data().
   */
  public function views_data() {
    $data = parent::views_data();
    $data['tableA']['data']['relationship'] = array(
      'handler' => 'views_handler_relationship',
      'base' => 'field_data_field_tablea_data',
      'base field' => 'field_tablea_data_value',
      'title' => t('TableA Data'),
      'label' => t('TableA Data'),
    );
    return $data;
  }
}

and in the module (table A entity I have a hook):

function (module)_views_data_alter(&$data) {
    $data['tableA']['table']['join'] = array(
    'field_data_field_tablea_data' => array(
      'left_field' => 'field_tableA_data_value',
      'field' => 'data',
    ),
    'user' => array(
      'left_field' => 'uid',
      'field' => 'field_data_tablea_data.entity_id',
    ),
  );
}

The best this gives me though is User:field_tableA data and no other fields from User - I'm trying to get uid and username.


texts:
I am having a slight problem with my code; I am trying to do a if statement to make the date not print if a node is using a certain term. I have parsed $node to narrow down what term I would like to exclude the date from being used.

This is what is returned in the dump:

Array ([und] => Array ([0] => Array ([tid] => 103 )))

This is what I have for my code to have the date being displayed:

      if (arg(0) == 'node' && is_numeric(arg(1))) {
        $node = node_load(arg(1));
        $user = user_load(array('uid' => $node->uid));
        foreach ($node->field_newsections['und']['0'] as $node_time);
      }

      hide($content['comments']);
      hide($content['links']);
      $nodecontent = render($content);
      $newcontent = preg_replace("/
]*?>/", "", $nodecontent);
      $newcontent = str_replace("
", "

", $newcontent);

      if ($node->type == 'post' || 'news') {
        echo '
'. date('l, F j, Y g:ia', $node->created). '
';
      }
      else ($node_time == '108') {
        echo 'working';
      }

      print render($newcontent);

I am probably over looking something small.


texts:
I've been having troubles with form_set_value(). I've extended the Search form, everything works, but after submission, the form values for those fields added by me return to default (see the code).

What am I doing wrong?

Thank you!

<?
/**
 * implementation of function hook_form_FORM_ID_alter
 */
function myModule_form_search_form_alter( &$form, &$form_state, $form_id ){

    $form['myM_options']['entity'] = array(
                                            '#type' => 'radios',
                                            '#title' => 'Search by',
                                            '#default_value' => 'gene',
                                            '#options' => array(
                                                                "gene" => "Genes",
                                                                "ortholog" => "Orthologs",
                                                                "microarray" => "Microarray Features"
                                                            ),

                                        );
    $form['myM_options']['plant'] = array(
                                            '#type' => 'checkboxes',
                                            '#title' => 'Choose plants',
                                            '#options' => formatPlants(),
                                            // select all checkboxes by default
                                            '#default_value' => array_keys(formatPlants()),
                                        );
    $form['#validate'][] = 'myModule_search_validate';
    $form['#submit'][] = 'myModule_search_form_alter_submit';
}
/**
 * validation functoin
 */
function myModule_search_validate( $form, &$form_state ){
    // this works as expected
    form_set_value($form['basic']['processed_keys'], trim($form_state['values']['keys']), $form_state);

    // this doesn't !!!
    form_set_value($form['myM_options']['entity'], $form_state['values']['entity'], $form_state);
    form_set_value($form['myM_options']['plant'], array( 'id_1', 'id_2' ), $form_state);
}


texts: How secure are variable_get and variable_set?

texts:
I have a custom module that saves variables with FTP usernames and passwords. Is variable_get secure? Ie. Can it be accessed outside of the module.

Is variable_set equally secure?

Obviously they are being saved to the database and are only as secure as the DB but I'm assuming the DB is secure.


texts: Where are functions being called from when errors are vague?

texts:
I have the following errors which show up randomly when browsing the site. It's hard to reproduce, but also hard to debug. I was able to get it in the error state and have it stay during a reload in order for me to debug it.

I tried going to the code in question which resides in includes/theme.inc But when going to that line 1525. It doesn't really tell me much. The error states that its missing a tpl file, but doesn't say which one as I'm assuming its due to the $template_file  variable being blank.

How can I trace where is this function being called in order to find the module that is the culprit of this error?

I don't have xdebug installed as I know that can be used to do the tracing. I also don't have experience with it neither as I've mainly solved most of my php issues just by doing a print_r() 99% of the time and I'm able to find where the issue lies, but this time its different.

What methods are there to debug it and find the source of the problem?


texts: Meta tags, title and description not showing up on home page

texts:
I have a regular page set as the home page on my site. The Meta Tags, Title and Description are all set on the node, but do not show up on the home page.

Any ideas why?


texts: Using hook_form_alter() and hook_cron() together

texts:
I am interested in adding a function to the cron queue after I submit a form. I am confused how to call the cron after the form submits.

I am using hook_form_alter for catching the submit:

function rating_form_alter(&$form, $form_state, $form_id) {
    switch ($form_id)  {
        case 'comment_node_form':
            $form['#submit'][] = 'add_rating_queue_function';
            break;
     }
}

function add_rating_queue_function($form, &$form_state) {
    ....
}

my hook_cron_queue_info:

function add_rating_cron_queue_info(){
  $queues['update_rating'] = array(
    'worker callback' => 'add_rating_queue_function',
    'time' => 120,
  );
  return $queues;
}

I am a little confused on how to call hook_cron or hook_cron_queue_info to add my add_rating_queue_function to the cron.

Can I just call $form['#submit'][] = 'add_rating_cron_queue_info'; inside my hook_form_alter


texts:
Is it possible to send traffic to another server with different NS only for a specific page?
I would like to have only one page of my website pointing to an external server - Unbounce.
Wordpress has a plugin that allows a page on Unbounce servers to integrate with the same domain of an existing CMS website.

For example:

www.mydomain.com --> Drupal
www.mydomain.com/page1 --> Drupal
www.mydomain.com/page2 --> Drupal
www.mydomain.com/all-pages --> Drupal
www.mydomain.com/only-one-page --> Unbounce

if that's possible, i would like to have the homepage, pointing to an Unbounce server and the rest of the pages to remain on Drupal.

thank you


texts: drupal module secure pages toggles between http and https on reload

texts: I am using the secure pages drupal module to enable https for some of the pages , but i have noticed one bug in this , each time i reload the page its toggling between http and https, and if i go from a secure page to another secure page(ex: login to registration which are bith secure according to settings) the destination page will be in http but if i refresh it toggles between secure and non secure , a similar issue is reported here


texts: How to append #rss to each RSS feed item's URL built with Views?

texts:
Problem

I have an RSS feed built with Views on a Drupal 7 installation. I want to append the following string to each feed item's URL but don't know how: "#rss"

For example, let's assume my RSS has a feed item linking to a blog post

http://www.example.com/blog/post.html

I would like to add the hashtag to the end of it, so I get

http://www.example.com/blog/post.html#rss

Why?

This hash tag will allow me to see who is visiting the site from my RSS feed as it'll appear on my Analytics program.

I could use Feedburner or other 3rd party feed tracking alternatives, but I am purposefully staying away from them, for reasons we don't need to go into.

Anyhoo, I only managed to get the Views RSS to work recently and have no idea how to modify the feed item URL. Can anyone help? Please assume I am a novice at this.


texts: Form in custom module using Controller: The HTML tag form isn't present in Twig

texts:
I'm trying to render limited user edit form on custom page using Drupal Controller.
In the routing.yml I defined _controller, I do not want to use _form.
I want to display on the form e.g. only timezone field, but not the rest. And I'm not able to achieve it. I can render this field, other fields like form_build_id, form_id, form_token
But form html tag is not rendered at all.
It works only if I display the whole form with {{ form.form }}.
This is the content of the files I am using.
my_module.info.yml
name: 'My module'
type: module
description: 'my module'
core_version_requirement: ^8.8 || ^9

my_module.routing.yml
my_module.mymodule_controller_view::
  path: '/my-module'
  defaults:
    _controller: '\Drupal\my_module\Controller\MymoduleController::view'
    _title: 'My module'
  requirements:
    _permission: 'access content'

my_module.module
function my_module_theme($existing, $type, $theme, $path)
{
    $templates = array(
        'my_module_form' => [
            'render element' => 'form',
        ],
    );

    return $templates;
}

MymoduleController.php
namespace Drupal\my_module\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\user\Entity\User;

class MymoduleController extends ControllerBase
{

    public function view()
    {
        $data['header'] = [
            '#type' => 'markup',
            '#markup' => '
HEADER
',
        ];

        $user = User::load(\Drupal::currentUser()->id());
        $formObject = \Drupal::entityTypeManager()
            ->getFormObject('user', 'default')
            ->setEntity($user);

        $form = \Drupal::formBuilder()->getForm($formObject);

        $data['form'] = [
            '#theme' => 'my_module_form',
            'form' => $form,
        ];

        $data['footer'] = [
            '#type' => 'markup',
            '#markup' => '
footer
',
        ];

        return $data;
    }
}

my-module-form.html.twig

TWIG TEMPLATE

{{ form.form.timezone }}
{{ form.form.form_build_id }}
{{ form.form.form_token }}
{{ form.form.form_id }}
{{ form.form.actions }}


texts: Dealing with #disabled and #access in hook_field_validate

texts:
is there any way to disable hook_field_validate when the corresponding field widget is disabled (via #disabled = true or #access = false) in corresponding form?

Or, alternatively, is there at least any way to retrieve information about the form that called the hook_field_validate? To be specific, is it possible to get the information whether the field widget was #disabled or had #access set on false?

I'd need to run my validations only when the corresponding field widget is actually editable in the form that called the validation. At the same time, I'd prefer something that is attached to a field rather than just a form.

I know I could alter the form, run check whether the field is 'disabled and access'able and then (if it's ok) attach my own validation... that would work but it would be form-specific which is something I'd rather not do.


texts: Drupal 7 - Give permission to manage users but not permissions

texts:
We have setup a site in Drupal 7 on which we would like certain users to have access to the user management page, and be able to create new users, assign roles, etc., but we don't want to give them access to the Roles and Permission pages.

Currently Drupal only has 2 permissions Administer Permissions and Administer users.

With the Administer users permission, the user has access to the User Management page, and can create new users but cannot assign roles to users.

If the user has the Administer permissions permission, he can assign roles to users and also access to the permission and role management pages.

How would you grant a user the right to assign roles to users, but prevent him from accessing the permission page?


texts:
in a drupal 8 custom module, how do I get a node object if I have the node id?
I tried :

$node = new Node($nid);
$node->save();`

but got this error:

  Argument 1 passed to
  Drupal\Core\Entity\ContentEntityBase::__construct() must be of the
  type array, string given,


texts:
I have a node form which I placed in a block, and user need to login to submit the form. There is a login link in the form itself where user can login which I implement through ajax and its working fine, but after login when the user submit the form it is not getting submitted and I am getting a "Invalid form POST data." error in "Recent log messages" in admin.

Anybody have any clue. I will post my code if needed.


texts:
can we get the raw SQL query based on the search API views?

Actually, the search result didn't return the result (sorting) in the way I need it to be done.

An example I have a product name "Bicycle 100" and there are other product names such as "Bicycle 100 spare parts", "Bicycle 1100", "Bicycle 1000", "Bicycle 2100".

If user search for "Bicycle 100" and the first result I would like it to display "Bicycle 100", "Bicycle 100 spare parts", then only by the others like "Bicycle 1000", "Bicycle 1100", etc.

I am thinking whether I can write a raw query with union with the search api query.


texts: Need help to find right language detection configuration

texts:
We are developing a site with 10s of thousands of nodes and 12 interface and content languages. Having spent hours trying different configurations for language detection, I cannot find one that meets our requirements. Advice would be greatly appreciated. Here is our requirement:
A. When someone comes to the website for the first time
If our site has the language of their browser default, then the interface language and initial content should show in their browser language. Otherwise it defaults to English.
B. After they have first arrived
If the interface language (and content) a visitor sees is not the one they want, they will probably try to change to their language (if it exists) via the language selector.
Once they have their desired interface language set, most users are unlikely to change it to another.
So as they move around the site they see content in their chosen language, if it exists, otherwise the content appears in English (or another language, if no English version of the content).
The interface language should never change unless the user selects a different one in the language selector dropdown.
C. Further questions
Is it best practice in Drupal that there should always be a language code in the url, even if it is the default language (in our case English)?
If so, can we avoid having multilingual URL aliases?
Since if someone goes to a url without a language identifier they get a Page Not Found error, can one set up a redirect so that if there is no language code in the url it will default to /en?
Our configuration that does not work
To achieve our requirement I assumed that the config in this screenshot would achieve it. But it does not. The /en (or other language code) in the url does not call the right content, and the ?language=fr parameter does not force the right interface. What am I doing wrong?


texts: Print module theming address for user page

texts:
I am using the print module to have print-friendly pages. I followed theme suggestions, I could not make the theming work for user pages. So far, I tried the following I would like to theme user pages for printing but I could not figure out how.

print--html--user.tpl.php
print--html--user--%.tpl.php
print--html--page--user.tpl.php

Example pages to view theme suggestions, here and here.


texts:
The Ajax framework is very nice but i want more complex effects. So I am trying to do the Ajax calls via Jquery. The goal here is to load nodes by clicking some links on the menu but the nodes  contains an image which pop ups with a lightbox and also contains a from which submits via Ajax. For demo site i am using Drupal commerce. here is the demo to check out.

I am using    Drupal.attachBehaviors(document); to re-attach the needed js scripts. The problem is that some of the behaviors are attached and some others are not. For example the first menu link 'Products' is a view and it uses ajax pagination but it loses this functionality but the image lightbox in this view does work. So i am little confuse here.

This is my code.

/*
 *  Implemets hook_menu()
 */

function myajax_menu() {
$items = array();

$items['myajax'] = array(
    'title' => 'Ajax',
    'page callback' => 'myajax_callback',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
);

$items['myajax/view'] = array(
    'title' => 'Ajax',
    'page callback' => 'myajax_view_callback',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
);

return $items;
}
/*
 *  Ajax handling
 */
function myajax_callback($nid = '') {
      $node = node_load($nid);
      $vnode = node_view($node);
      return theme('node',$vnode);
}

function myajax_view_callback($view = '') {
      print views_embed_view($view, 'default');
}

and my js file

(function ($) {

Drupal.behaviors.myajax = {
    attach: function(context,settings){
        $('#main div.column').before('
Loading...
');

        $('a.ajax_link', context).once().bind('click',function(e){
            $(this).addClass('ajaxafy');
            e.preventDefault();
            var url = $(this).attr('href').split('/');
            //console.log(settings);
            $('#loading').fadeIn();
            $.ajax({
               type: "POST",
               url: Drupal.settings.basePath + 'myajax/' + url[2],
               data: {'js':1}, // you can also pass block name and act more dynamicly
               success: function (response){
                  $('#loading').fadeOut()
                  $('#main #myajax', context).html(response)
              Drupal.attachBehaviors(document);

              },
            });
        });
        $('a.ajax_link_view',context).once().bind('click',function(e){
            e.preventDefault();
            var url = $(this).attr('href').split('/');
            $('#loading').fadeIn();
            $.ajax({
               type: "POST",
               url: Drupal.settings.basePath + 'myajax/view/' + url[1],
               data: {'js':1}, // you can also pass block name and act more dynamicly
               success: function (data){
                  $('#loading').fadeOut()
                   $('#main #myajax', context).html(data);
                   Drupal.attachBehaviors(document);
              },
            });

        });

    }
};

})(jQuery)

Alse the webform submits also using Ajax but it loses that behavior.

What i am missing here? Please check the demo to see what's going on. Thanks in advance.


texts: Why can't my user see the private groups they are members in?

texts:
I just installed Drupal Commons 7.x-3.x. I configured two private groups, and added a normal user to them. That user can see content posted to those groups, but it cannot see the group itself, or post content to the group.

Why?

I've added the user as an administrator in the group.

I've cleared all the Drupal Caches on the performance page.

I've cleared my browsers cache.

I've logged the user in and out.

I've rebuilt node permissions.

I've run cron manually.

I've double checked the people/permissions to make sure the user had permission to create groups, just in case that mattered.

No matter what I do, if I try to go to commons/groups/privategroupname with my non-user1 user I get an "Access Denied" page.

If the user wasn't a member, it would not be able to see the content in the list on the /home page.

Public groups work fine.

When creating the private groups, I selected: "Joining requires an invitation. The group and content is hidden from non-members." in the Privacy Settings.

So, I'm at a loss. Help!


texts:
So I am currently trying to access our old website which was set up using Drupal. I re-downloaded all of the databases as well as the site files and set it up on a localhost.

The problem I am having is the only page shown is basically a white version of the old site with just the text of what was on it (without any of the CSS styles). When I try to click on a page it directs me to an "Access denied* page, unless I use the search box which just redirects me to a white page.

Does anyone know why I cannot get this site to work? I am just trying to access the articles that were published (which are located in the databases).

(I am running this on a local host version thru MAMP)

This is how the site appears.


texts: How do I load a file as entity knowing its full path?

texts:
I want to replace a file entity while uploading it via hook_entity_insert().

I upload a file using its full path, for example /var/www/web/sites/default/files/test.png
I convert it to some another format, for example /var/www/web/sites/default/files/test.jpeg
I want to replace the default entity file with a new entity pointing to the converted image

How can I achieve this?


texts: Why would some features still show Overridden after a revert all --force?

texts:
Why would some features still show as "Overridden" even after running a full features revert with the force switch? Below are the commands I am running, for the sake of clarity.

drush fr-all --force -y
drush fl


texts:
I want to add extra fields during user registration. I don't Understand Where I can access to user form and user twig, because I want to validate and reformat the Form.

My background is symfony, and I expect The model if I want to add some properties ( in drupal maybe is entity ) and the twig ( the view Parts ), Instead here I don't know where is the user form.

I'm trying to create the module and use some hook, but I don't know if the right way to customize the form


texts: How to extend duration of the the one time login link?

texts: Is it possible to change the valid duration time of the one time login link that is send out by mail to the new user? I think by default it is 24 hours, ist it possible to change this to 72 hours?


texts: Cannot set menu link content field values in *links.menu.yml

texts:
I added a field to the menu_link_content entity, but am unable to set the value of this field in my my_module.links.menu.yml.

Here is my hook_entity_base_field_info:

/**
 * Implements hook_entity_base_field_info_alter().
 */
function my_module_admin_menu_entity_base_field_info_alter(&$fields, EntityTypeInterface $entity_type) {
  if ($entity_type->id() != 'menu_link_content') {
    return;
  }

  // Create the base field definition for the allowed roles. This field will
  // reference user entities.
  $fields['my_module_admin_menu__show_role'] = BaseFieldDefinition::create('entity_reference')
    ->setName('my_module_admin_menu__show_role')
    ->setTargetEntityTypeId('menu_link_content')
    ->setLabel(t('Roles able to see the menu link'))
    ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
    ->setSetting('target_type', 'user_role')
    ->setDisplayOptions('form', [
      'type' => 'options_buttons',
      'weight' => 0,
    ]);
}

In my my_module.links.menu.yml, I provide a menu link like so:

my_module_admin_menu.article:
  title: 'Article'
  menu_name: admin-per-user-role
  url: internal:/node/add/article
  parent: my_module_admin_menu.create
  bundle: menu_link_content
  my_module_admin_menu__show_role:
    settings:
      target_type: user_role
      handler: default
    target_id:
      - authenticated

The link shows up, but doesn't show the field:

When a link is added via the menu UI, the field is shown:


texts: How do I present the user login form from a callback, and redirect them after login?

texts:
I need to present the user login form from a callback function that I have registered in hook_menu(), at that specific URL.  When the user logs in, I need to direct them back to that URL to present them with other options. Currently, I call:

if (!user_is_logged_in())
    drupal_goto('user/login');

Of course, that takes them to the login page.  I imagine I need to call drupal_get_form() to present the form from here, but how do I direct them back to this page after login?


texts: Is there any way to know if a string is not translated?

texts:
I have my own module that I want to translate to some languages. I use the t function and also I have my lang.po files.

I try to update the lang.po files every time I use the t function but maybe I forget to update some text string.

Is there any way to know if there are some t-strings without translation in the lang.po files?

I can go to admin/config/regional/translate/translate but I only need to check the strings of my module.


texts: How to rewrite the output of $content inside a pane template?

texts:
I am trying to reformat / rewrite the output of pane content inside my panel template.

Here is what I have:

panels-pane--panels-mini--some-name.tpl

Inside this file I have:

print render($content)

I need to break apart the items inside of content. What is the best way to go about doing this?


texts: Where to place the utility and internal functions for a custom module?

texts:
I have a custom module with some utility (can be used for other modules) and internal (can be used only for the module) functions inside, so I decide to place this functions in another file.

But reading the coding standards I can't find a place for this, I have as a candidate src/Utility/ for the utility functions and then create some files related to the utility category like in core (Utility classes and functions). This will be made in a new module and this new module will be added as dependency, in this way I will have in only one place all the common utilities functions and the other modules (that can need the functions) can add this new
module as a dependency too.

But for the internal functions I'm thinking to use /src/Utility/InternalFunctions.php as file for this.

So, where is the correct place for the utility and internal functions for a custom module?


texts:
I have set up user comment email notification on my Drupal 7 site. When a comment is posted the author is notified by email. I did it using rules module as described here.

Now the user has the option to get notified or not. For this, I added a new boolean field checkbox on the user's account form page. So currently the user must go to his user account page to change this setting. I would like to make this setting available in a panel.

How can I add a checkbox to a panel in order to control that "notify me setting"? (The panel currently displays content type fields, comment forms etc).


texts:
Am I misunderstanding how this works?

https://www.drupal.org/node/3003163#comment-13134024

We have checked "Clear Value(s) When Hidden" but the values in the hidden fields are not cleared and are submitted with visible form fields.

Enter value in fields Sitting and Year.
Hide "Sitting" and "Year" fields by selecting another conditional field, General Assembly.
"Sitting" and "Year" fields are not cleared when hidden.
Values are submitted for "Sitting" and "Year".

&general_assembly=65&sitting=spring&year=2016


texts: Library item field doesn't show up the remove button

texts: I am using paragraphs and paragraphs library module in my drupal project. The paragraph (Paragraph A) has a text field (unlimited). I don't see a remove button on the field. I only need one item for one page but it shows up more that one fields. Is there a way to remove it?


texts:
I want the menu tab to be active for children of certain page that is listed with on of the menu tabs.

|HOME|Research|Contact Us

Everything in /research/whatever links,

will activate the Research tab


texts:
How do I programmatically use an external database?

$databases = array();
$databases['default']['default'] = array(
  // Drupal's default credentials here.
  // This is where the Drupal core will store its data.
);
$databases['my_other_db']['default'] = array(
  // Your secondary database's credentials here.
  // You will be able to explicitly connect to this database from your modules.
);


texts: How do you programatically determine who submitted a webform?

texts: When I add a value element to a new webform draft and I attempt to prepopulate the element with a token listed as available, the element does not get populated.